Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/bin/
/target/
/.settings/
/.settings/
.DS_Store
.vscode/
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<version>3.15.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand All @@ -21,7 +21,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.6.1</version>
<executions>
<execution>
<id>shade</id>
Expand All @@ -45,8 +45,8 @@
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>placeholderapi</id>
Expand All @@ -62,19 +62,19 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.5-R0.1-SNAPSHOT</version>
<version>1.21.11-R0.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.6</version>
<groupId>com.github.PlaceholderAPI</groupId>
<artifactId>PlaceholderAPI</artifactId>
<version>2.11.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api</artifactId>
<version>2.15.0</version>
<version>2.15.2</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -135,6 +136,8 @@ public String toString() {
+ checkNameEquals
+ ", checkLoreContains="
+ checkLoreContains
+ ", checkLoreDoesNotContain="
+ checkLoreDoesNotContain
+ ", checkLoreEquals="
+ checkLoreEquals
+ ", checkMaterialContains="
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down