From 2ade0d87403082c7ab79f58cf9c217aa7a295d54 Mon Sep 17 00:00:00 2001 From: yangzhie Date: Sat, 7 Mar 2026 13:04:21 +1100 Subject: [PATCH 1/2] PlaceholderAPI repo changed to jitpack and updated misc. deps. --- .gitignore | 4 +++- pom.xml | 18 +++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index aec0be4..caa09f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /bin/ /target/ -/.settings/ \ No newline at end of file +/.settings/ +.DS_Store +.vscode/ \ No newline at end of file diff --git a/pom.xml b/pom.xml index eb62438..876ff76 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ maven-compiler-plugin - 3.8.0 + 3.15.0 1.8 1.8 @@ -21,7 +21,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.4.1 + 3.6.1 shade @@ -45,8 +45,8 @@ - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + jitpack.io + https://jitpack.io placeholderapi @@ -62,19 +62,19 @@ org.spigotmc spigot-api - 1.21.5-R0.1-SNAPSHOT + 1.21.11-R0.2-SNAPSHOT provided - me.clip - placeholderapi - 2.11.6 + com.github.PlaceholderAPI + PlaceholderAPI + 2.11.4 provided de.tr7zw item-nbt-api - 2.15.0 + 2.15.2 From d902fb7c9bf1a6932d825f8c253c5d92e7066448 Mon Sep 17 00:00:00 2001 From: yangzhie Date: Sun, 8 Mar 2026 02:50:32 +1100 Subject: [PATCH 2/2] Add new feature loredoesnotcontain, returns true if item's lore does not have query. --- .../checkitem/CheckItemExpansion.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/com/extendedclip/papi/expansion/checkitem/CheckItemExpansion.java b/src/com/extendedclip/papi/expansion/checkitem/CheckItemExpansion.java index 8326415..1ae7c46 100644 --- a/src/com/extendedclip/papi/expansion/checkitem/CheckItemExpansion.java +++ b/src/com/extendedclip/papi/expansion/checkitem/CheckItemExpansion.java @@ -80,6 +80,7 @@ public class ItemWrapper { private boolean checkNameStartsWith; private boolean checkNameEquals; private boolean checkLoreContains; + private boolean checkLoreDoesNotContain; private boolean checkLoreEquals; private boolean checkMaterialContains; private boolean checkDurability; @@ -135,6 +136,8 @@ public String toString() { + checkNameEquals + ", checkLoreContains=" + checkLoreContains + + ", checkLoreDoesNotContain=" + + checkLoreDoesNotContain + ", checkLoreEquals=" + checkLoreEquals + ", checkMaterialContains=" @@ -369,6 +372,14 @@ protected void setCheckLoreContains(boolean checkLoreContains) { public boolean shouldCheckLoreContains() { return this.checkLoreContains; } + + protected void setCheckLoreDoesNotContain(boolean checkLoreDoesNotContain) { + this.checkLoreDoesNotContain = checkLoreDoesNotContain; + } + + public boolean shouldCheckLoreDoesNotContain() { + return this.checkLoreDoesNotContain; + } protected void setCheckLoreEquals(boolean checkLoreEquals) { this.checkLoreEquals = checkLoreEquals; @@ -545,6 +556,7 @@ public String onPlaceholderRequest(Player p, String args) { } catch (Exception e) { } wrapper.setCheckLoreContains(true); + wrapper.setCheckLoreDoesNotContain(true); wrapper.setCheckEnchantments(true); wrapper.setCheckEnchanted(true); wrapper.setCheckPotionType(true); @@ -598,6 +610,24 @@ public String onPlaceholderRequest(Player p, String args) { } data = data + " &r"; } + if ((wrapper.shouldCheckLoreDoesNotContain() || wrapper.shouldCheckLoreEquals()) + && (item.hasItemMeta() && item.getItemMeta().hasLore())) { + data = multiMod ? data += "lore:" : ""; + int line = -1; + try { + line = Integer.parseInt(wrapper.getLore()); + } catch (Exception e) { + } + if (line != -1) { + data += item.getItemMeta().getLore().get(line); + } else { + for (String s : item.getItemMeta().getLore()) { + data += s + "|"; + } + data = data.substring(0, data.length() - 1); + } + data = data + " &r"; + } if (wrapper.shouldCheckEnchantments()) { if (!multiMod && wrapper.getEnchantments().size() == 1) { data = "0"; @@ -930,6 +960,20 @@ private int getItemAmount(ItemWrapper wrapper, Player p, ItemStack... items) { continue; } } + if (wrapper.shouldCheckLoreDoesNotContain()) { + if (toCheckMeta.hasLore()) { + boolean contains = false; + for (String line : toCheckMeta.getLore()) { + if (line.contains(wrapper.getLore())) { + contains = true; + break; + } + } + if (contains) { + continue; + } + } + } if (wrapper.shouldCheckLoreEquals()) { if (!toCheckMeta.hasLore()) continue; @@ -1236,6 +1280,12 @@ private ItemWrapper getWrapper(ItemWrapper wrapper, String input, Player p) { wrapper.setCheckLoreContains(true); continue; } + if (part.startsWith("loredoesnotcontain:")) { + part = part.replace("loredoesnotcontain:", ""); + wrapper.setLore(PlaceholderAPI.setBracketPlaceholders(p, part)); + wrapper.setCheckLoreDoesNotContain(true); + continue; + } if (part.startsWith("loreequals:")) { part = part.replace("loreequals:", ""); wrapper.setLore(PlaceholderAPI.setBracketPlaceholders(p, part));