mirror of
https://github.com/songoda/EpicEnchants.git
synced 2024-09-28 23:57:33 +02:00
Merge branch 'development'
This commit is contained in:
commit
72b5a69ca6
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>EpicEnchants</artifactId>
|
<artifactId>EpicEnchants</artifactId>
|
||||||
<version>1.2.3</version>
|
<version>1.2.4</version>
|
||||||
|
|
||||||
<name>EpicEnchants</name>
|
<name>EpicEnchants</name>
|
||||||
<description>Unlock the potential of your weapons, tools and armor by making your own custom enchants.</description>
|
<description>Unlock the potential of your weapons, tools and armor by making your own custom enchants.</description>
|
||||||
@ -116,7 +116,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.songoda</groupId>
|
<groupId>com.songoda</groupId>
|
||||||
<artifactId>SongodaCore</artifactId>
|
<artifactId>SongodaCore</artifactId>
|
||||||
<version>2.6.12</version>
|
<version>2.6.13</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -99,6 +99,20 @@ public class GeneralUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Object parseJS(String toParse, String type, Object def) {
|
public static Object parseJS(String toParse, String type, Object def) {
|
||||||
|
if (toParse.trim().matches("^\\d+\\s+(<|>)\\s*\\d+$")) { // e.g. "1 < 2"
|
||||||
|
toParse = toParse.trim();
|
||||||
|
|
||||||
|
double firstNumber = Double.parseDouble(toParse.substring(0, toParse.indexOf(" ")));
|
||||||
|
String symbol = toParse.substring(toParse.indexOf(" ") + 1, toParse.indexOf(" ") + 2);
|
||||||
|
double secondNumber = Double.parseDouble(toParse.substring(toParse.indexOf(" ") + 2));
|
||||||
|
|
||||||
|
if (symbol.equals(">")) {
|
||||||
|
return firstNumber > secondNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
return firstNumber < secondNumber;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: JavaScript != Math...
|
// FIXME: JavaScript != Math...
|
||||||
// Input "false ? (8 * 3) : (4 * 3)" fails for obvious reasons
|
// Input "false ? (8 * 3) : (4 * 3)" fails for obvious reasons
|
||||||
return MathUtils.eval(toParse, "[EpicEnchants] One of your " + type + " expressions is not properly formatted.");
|
return MathUtils.eval(toParse, "[EpicEnchants] One of your " + type + " expressions is not properly formatted.");
|
||||||
|
Loading…
Reference in New Issue
Block a user