1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Improved code

This commit is contained in:
Rothes 2021-04-20 12:47:48 +08:00 committed by GitHub
parent 2f7335e65b
commit 68dc6d560d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.enchanting;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -30,8 +31,6 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecip
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import java.util.Arrays;
/**
* The {@link AutoDisenchanter}, in contrast to the {@link AutoEnchanter}, removes
* {@link Enchantment Enchantments} from a given {@link ItemStack} and transfers them
@ -152,10 +151,13 @@ public class AutoDisenchanter extends AContainer {
private boolean isDisenchantable(@Nullable ItemStack item) {
if (item == null) {
return false;
} else if (item.hasItemMeta() && item.getItemMeta().hasLore()) {
for (String lore : cantDisenchantLores.getValue()) {
if (item.getItemMeta().getLore().contains(ChatColors.color(lore))) {
return false;
} else {
ItemMeta itemMeta = item.getItemMeta();
if (itemMeta != null && itemMeta.hasLore()) {
for (String lore : cantDisenchantLores.getValue()) {
if (itemMeta.getLore().contains(ChatColors.color(lore))) {
return false;
}
}
}
}