Skip to content

Commit

Permalink
fix: GuizhanLib2 适配
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 committed Oct 31, 2024
1 parent 8a81689 commit 0310710
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
<dependency>
<groupId>net.guizhanss</groupId>
<artifactId>GuizhanLibPlugin</artifactId>
<version>1.7.6</version>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
import net.guizhanss.guizhanlib.minecraft.helper.enchantments.EnchantmentHelper;
import net.guizhanss.minecraft.guizhanlib.gugu.minecraft.helpers.enchantments.EnchantmentHelper;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
Expand Down Expand Up @@ -323,7 +323,7 @@ private void buildAndSetSelectionItem(Map<Enchantment, Integer> disenchants, Blo

String ench = textColor +
"- " +
EnchantmentHelper.getEnchantmentName(disenchantKeys[i], false) +
EnchantmentHelper.getName(disenchantKeys[i]) +
" " +
Utils.toRoman(disenchants.get(disenchantKeys[i]));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
import net.guizhanss.guizhanlib.slimefun.items.Metals;
import net.guizhanss.fluffymachines.utils.MetalUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
Expand Down Expand Up @@ -351,7 +351,7 @@ private void addDust(Block b, int amount) {
private void updateIndicator(Block b) {
BlockMenu inv = StorageCacheUtils.getMenu(b.getLocation());
String stored = getBlockInfo(b.getLocation(), "stored");
String type = Metals.getType(getBlockInfo(b.getLocation(), "type"));
String type = MetalUtils.getMetalName(getBlockInfo(b.getLocation(), "type"));

if (stored.equals("0")) {
setBlockInfo(b, "type", null);
Expand Down
35 changes: 35 additions & 0 deletions src/main/java/net/guizhanss/fluffymachines/utils/MetalUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package net.guizhanss.fluffymachines.utils;

import lombok.experimental.UtilityClass;
import net.guizhanss.guizhanlib.common.utils.StringUtil;

import java.util.Locale;

@UtilityClass
public final class MetalUtils {

public static String getMetalName(String type) {
return switch (type.toUpperCase(Locale.ROOT)) {
case "IRON":
yield "铁";
case "GOLD":
yield "金";
case "COPPER":
yield "铜";
case "TIN":
yield "锡";
case "SILVER":
yield "银";
case "LEAD":
yield "铅";
case "ALUMINUM":
yield "铝";
case "ZINC":
yield "锌";
case "MAGNESIUM":
yield "镁";
default:
yield StringUtil.humanize(type);
};
}
}

0 comments on commit 0310710

Please sign in to comment.