diff --git a/src/main/java/io/github/sefiraat/networks/integrations/HudCallbacks.java b/src/main/java/io/github/sefiraat/networks/integrations/HudCallbacks.java index 6dba97d9..417b650b 100644 --- a/src/main/java/io/github/sefiraat/networks/integrations/HudCallbacks.java +++ b/src/main/java/io/github/sefiraat/networks/integrations/HudCallbacks.java @@ -1,5 +1,6 @@ package io.github.sefiraat.networks.integrations; +import com.xzavier0722.mc.plugin.slimefun4.storage.util.StorageCacheUtils; import io.github.schntgaispock.slimehud.SlimeHUD; import io.github.schntgaispock.slimehud.util.HudBuilder; import io.github.schntgaispock.slimehud.waila.HudController; @@ -7,14 +8,15 @@ import io.github.sefiraat.networks.slimefun.network.NetworkGreedyBlock; import io.github.sefiraat.networks.slimefun.network.NetworkQuantumStorage; import io.github.thebusybiscuit.slimefun4.utils.ChatUtils; -import me.mrCookieSlime.Slimefun.api.BlockStorage; import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu; import org.bukkit.Location; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; public class HudCallbacks { + private static final String EMPTY = "&7| 空"; + public static void setup() { HudController controller = SlimeHUD.getHudController(); @@ -30,7 +32,7 @@ public static void setup() { controller.registerCustomHandler(NetworkGreedyBlock.class, request -> { Location location = request.getLocation(); - BlockMenu menu = BlockStorage.getInventory(location); + BlockMenu menu = StorageCacheUtils.getMenu(location); if (menu == null) { return EMPTY; } @@ -51,8 +53,8 @@ private static String format(ItemStack itemStack, int amount, int limit) { String amountStr = HudBuilder.getAbbreviatedNumber(amount); String limitStr = HudBuilder.getAbbreviatedNumber(limit); String itemName = meta != null && meta.hasDisplayName() - ? meta.getDisplayName() - : ChatUtils.humanize(itemStack.getType().name()); + ? meta.getDisplayName() + : ChatUtils.humanize(itemStack.getType().name()); return "&7| &f" + itemName + " &7| " + amountStr + "/" + limitStr; } diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkController.java b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkController.java index 493ba19a..e0b0699f 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkController.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkController.java @@ -88,7 +88,7 @@ protected void prePlace(@Nonnull PlayerRightClickEvent event) { for (BlockFace checkFace : CHECK_FACES) { Block checkBlock = target.getRelative(checkFace); - SlimefunItem slimefunItem = BlockStorage.check(checkBlock); + SlimefunItem slimefunItem = StorageCacheUtils.getSfItem(checkBlock.getLocation()); // For directly adjacent controllers if (slimefunItem instanceof NetworkController) { diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/tools/CraftingBlueprint.java b/src/main/java/io/github/sefiraat/networks/slimefun/tools/CraftingBlueprint.java index 65ed51a5..40435b3d 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/tools/CraftingBlueprint.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/tools/CraftingBlueprint.java @@ -56,9 +56,4 @@ public static void setBlueprint(ItemStack blueprint, ItemStack[] recipe, ItemSta blueprint.setItemMeta(itemMeta); } - - @Override - public boolean canStack(ItemMeta meta1, ItemMeta meta2) { - return meta1.getPersistentDataContainer().equals(meta2.getPersistentDataContainer()); - } } diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkAdminDebugger.java b/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkAdminDebugger.java index 809361ff..0cca4460 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkAdminDebugger.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkAdminDebugger.java @@ -1,5 +1,6 @@ package io.github.sefiraat.networks.slimefun.tools; +import com.xzavier0722.mc.plugin.slimefun4.storage.util.StorageCacheUtils; import io.github.sefiraat.networks.slimefun.network.AdminDebuggable; import io.github.sefiraat.networks.utils.Theme; import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent; @@ -8,7 +9,6 @@ import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType; import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler; -import me.mrCookieSlime.Slimefun.api.BlockStorage; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -36,9 +36,9 @@ protected void onUse(PlayerRightClickEvent e) { if (optional.isPresent()) { final Block block = optional.get(); final Player player = e.getPlayer(); - final SlimefunItem slimefunItem = BlockStorage.check(block); + final SlimefunItem slimefunItem = StorageCacheUtils.getSfItem(block.getLocation()); if (!player.isOp()) { - player.sendMessage(Theme.ERROR + "该物品只能由OP玩家使用。"); + player.sendMessage(Theme.ERROR + "该物品只能由 OP 玩家使用。"); return; } if (slimefunItem instanceof AdminDebuggable debuggable) {