Skip to content

Commit

Permalink
fix #1
Browse files Browse the repository at this point in the history
Adding final to save pos state and so repairing the parenthesis
  • Loading branch information
Guillaume-Lebegue committed May 27, 2020
1 parent 51e23c6 commit 233fd60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/main/java/world/bentobox/upgrades/config/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,13 @@ Expression parseFactor() {

Expression x;
int startPos = this.pos;
// Parentheses do not work
/*if (eat('(')) { // parentheses
if (eat('(')) { // parentheses
x = parseExpression();
eat(')');
} else*/ if ((ch >= '0' && ch <= '9') || ch == '.') { // numbers
} else if ((ch >= '0' && ch <= '9') || ch == '.') { // numbers
while ((ch >= '0' && ch <= '9') || ch == '.') nextChar();
x = (() -> Double.parseDouble(str.substring(startPos, this.pos)));
final Integer innerPos = new Integer(this.pos);
x = (() -> Double.parseDouble(str.substring(startPos, innerPos)));
} else if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '[' || ch == ']') { // functions
while ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || ch == '[' || ch == ']') nextChar();
String func = str.substring(startPos, this.pos);
Expand Down
8 changes: 3 additions & 5 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ disabled-gamemodes: []
# island-min-level: Minimum level required to upgrade (if level addon is provided)
# vault-cost: Money cost of upgrade
# Note: for upgrade-range, island-min-level and vault-cost:
# Mathematical expression can be used (+,-,*,/,^)
# Mathematical expression can be used (+,-,*,/,^,(,))
# Mathematical function can be used (sqrt,sin,cost,tan)
# Special value can be used:
# [level] : Is the actual level for this upgrade
# [islandLevel] : Is the islandLevel from level addon
# [numberPlayer] : Is the number of players in team
#
# Note: ( and ) or not functional as of yet
#
# Caution: You should always check that at max level, your players won't attain max range for island
range-upgrade:
tier1:
Expand All @@ -44,7 +42,7 @@ block-limits-upgrade:
max-level: 5
upgrade: "1"
island-min-level: "4"
vault-cost: "[level]*[numberPlayer]*500"
vault-cost: "([level]-2)*[numberPlayer]*700"

entity-limits-upgrade:
CHICKEN:
Expand All @@ -57,7 +55,7 @@ entity-limits-upgrade:
max-level: 5
upgrade: "1"
island-min-level: "4"
vault-cost: "[level]*[numberPlayer]*500"
vault-cost: "([level]-2)*[numberPlayer]*700"

# GameMode differences
# List any tiers that you want to add
Expand Down

0 comments on commit 233fd60

Please sign in to comment.