File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
src/main/java/eu/decentsoftware/holograms/plugin Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 15
15
import org .bukkit .command .CommandSender ;
16
16
import org .bukkit .entity .Player ;
17
17
import org .bukkit .inventory .ItemStack ;
18
+ import org .jetbrains .annotations .NotNull ;
18
19
19
20
import java .util .Arrays ;
20
21
@@ -292,14 +293,18 @@ public static double getDouble(String string) {
292
293
return 0 ;
293
294
}
294
295
295
- public static double getLocationValue (String string , double initialValue ) {
296
- if (isDouble (string )) {
297
- return getDouble (string );
298
- } else if (string .matches ("~-?[0-9]+" )) {
299
- double diff = getDouble (string .substring (1 ));
300
- return initialValue + diff ;
296
+ public static double getLocationValue (@ NotNull String string , double initialValue ) {
297
+ boolean isDiff = false ;
298
+ if (string .startsWith ("~" )) {
299
+ isDiff = true ;
300
+ string = string .substring (1 );
301
301
}
302
- return initialValue ;
302
+
303
+ double number = getDouble (string );
304
+ if (isDiff ) {
305
+ return initialValue + number ;
306
+ }
307
+ return number ;
303
308
}
304
309
305
310
}
You can’t perform that action at this time.
0 commit comments