Skip to content

Commit

Permalink
Added placeholder parsing to js condition
Browse files Browse the repository at this point in the history
Closes #160
  • Loading branch information
Lorenzo0111 committed Mar 10, 2025
1 parent c9913ab commit ebc651e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Lorenzo0111
Copyright (c) 2025 Lorenzo0111

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
24 changes: 12 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java'
id 'maven-publish'
id "com.github.johnrengelman.shadow" version "8.1.1"
id "com.gradleup.shadow" version "8.3.6"
id "net.kyori.indra.license-header" version "3.1.3"
id "io.github.slimjar" version "1.3.0"
}

group = 'me.lorenzo0111'
version = '2.3.1'
version = '2.3.2'
description = 'RocketPlaceholders'

ext {
Expand All @@ -51,9 +51,9 @@ repositories {
}

dependencies {
compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.21.4-R0.1-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.11.6")
compileOnly('org.jetbrains:annotations:24.1.0')
compileOnly('org.jetbrains:annotations:26.0.2')
compileOnly("com.github.MilkBowl:VaultAPI:1.7.1")
compileOnly("be.maximvdw:MVdWPlaceholderAPI:3.0.1-SNAPSHOT") {
exclude module: 'spigot'
Expand All @@ -62,16 +62,16 @@ dependencies {
implementation("io.github.slimjar:slimjar:1.2.8")
implementation("com.github.glyart:mystral:1.4.6-SNAPSHOT")
implementation("dev.triumphteam:triumph-gui:3.2.2")
implementation("org.bstats:bstats-bukkit:3.0.2")
implementation('com.github.cryptomorin:XSeries:11.0.0')
implementation('net.kyori:adventure-api:4.17.0')
implementation('net.kyori:adventure-text-serializer-legacy:4.17.0')
implementation("org.bstats:bstats-bukkit:3.1.0")
implementation('com.github.cryptomorin:XSeries:13.0.0')
implementation('net.kyori:adventure-api:4.19.0')
implementation('net.kyori:adventure-text-serializer-legacy:4.19.0')
implementation("com.github.l1m0n3:HexiTextLib:b9e30055b7") {
exclude module: "annotations"
}

slim("com.mysql:mysql-connector-j:8.4.0")
slim("commons-io:commons-io:2.16.1")
slim("com.mysql:mysql-connector-j:9.2.0")
slim("commons-io:commons-io:2.18.0")
}

shadowJar {
Expand All @@ -94,9 +94,9 @@ slimJar {

javadoc {
options.links(
'https://javadoc.io/static/org.jetbrains/annotations/21.0.1/',
'https://javadoc.io/static/org.jetbrains/annotations/26.0.2/',
'https://docs.oracle.com/en/java/javase/16/docs/api/',
'https://jd.papermc.io/paper/1.19/'
'https://jd.papermc.io/paper/1.21.4/'
)
options.addStringOption('Xdoclint:none', '-quiet')
source = sourceSets.main.allJava
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import me.lorenzo0111.rocketplaceholders.creator.conditions.Requirement;
import me.lorenzo0111.rocketplaceholders.creator.conditions.RequirementType;
import me.lorenzo0111.rocketplaceholders.exceptions.InvalidConditionException;
import me.lorenzo0111.rocketplaceholders.providers.ProviderUtils;
import me.lorenzo0111.rocketplaceholders.utilities.JavaScriptParser;
import org.bukkit.entity.Player;

Expand All @@ -47,7 +48,7 @@ public JSCondition(String expression) {
public boolean apply(Player player) {
try {
engine.bind("Player", player);
Boolean result = engine.parse(expression);
Boolean result = engine.parse(ProviderUtils.setPlaceholders(plugin, expression, player));
if (result == null) {
plugin.getLogger().severe("Expression '" + expression + "' has to return a boolean. Returning as false..");
return false;
Expand Down

0 comments on commit ebc651e

Please sign in to comment.