Skip to content

Commit

Permalink
Should not detect ominous banner
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Jul 25, 2024
1 parent 677c211 commit 7b9e0e6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/cn/dreeam/surf/util/ItemUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ public static boolean hasIllegalEnchants(ItemStack i) {

public static boolean hasIllegalItemFlag(ItemStack i) {
if (i.hasItemMeta()) {
final boolean isBanner = i.getType().toString().contains("BANNER");

for (String flag : Config.antiIllegalIllegalItemFlagList) {
if (isBanner && flag.equalsIgnoreCase("HIDE_ADDITIONAL_TOOLTIP")) {
continue;
}

if (i.getItemMeta().hasItemFlag(ItemFlag.valueOf(flag))) {
return true;
}
Expand Down Expand Up @@ -220,12 +226,17 @@ private static ItemStack cleanIllegals(ItemStack i) {

if (i.hasItemMeta()) {
ItemMeta meta = i.getItemMeta();
final boolean isBanner = i.getType().toString().contains("BANNER");

// Clear unbreakable flag
meta.setUnbreakable(false);

// Clean illegal itemFlag
for (String flag : Config.antiIllegalIllegalItemFlagList) {
if (isBanner && flag.equalsIgnoreCase("HIDE_ADDITIONAL_TOOLTIP")) {
continue;
}

if (meta.hasItemFlag(ItemFlag.valueOf(flag))) {
meta.removeItemFlags(ItemFlag.valueOf(flag));
}
Expand Down

0 comments on commit 7b9e0e6

Please sign in to comment.