Skip to content

Commit

Permalink
fix: item payments being parsed incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
Thatsmusic99 committed Jul 25, 2023
1 parent 75d96b8 commit 0956d5f
Showing 1 changed file with 6 additions and 6 deletions.
Expand Up @@ -67,10 +67,10 @@ private void addCommand(String command, Object value) {

private Payment parsePayment(String rawPayment) {
if (rawPayment.length() - 3 <= 0) {
Matcher matcher = Pattern.compile("^(.+:)?([0-9]+(\\.[0-9]+)?)").matcher(rawPayment);
Matcher matcher = Pattern.compile("^((.+):)?([0-9]+(\\.[0-9]+)?)").matcher(rawPayment);
if (matcher.matches()) {
String plugin = matcher.group(1);
double payment = Double.parseDouble(matcher.group(2));
String plugin = matcher.group(2);
double payment = Double.parseDouble(matcher.group(3));

CoreClass.debug("Split payment into two, part 1: " + plugin + ", part two: " + payment);
CoreClass.debug("Material: " + Material.getMaterial(plugin == null ? "" : plugin));
Expand All @@ -90,10 +90,10 @@ private Payment parsePayment(String rawPayment) {
} else if (rawPayment.endsWith("EXP")) {
return new PointsPayment(Integer.parseInt(points));
} else {
Matcher matcher = Pattern.compile("^(.+:)?([0-9]+(\\.[0-9]+)?)").matcher(rawPayment);
Matcher matcher = Pattern.compile("^((.+):)?([0-9]+(\\.[0-9]+)?)").matcher(rawPayment);
if (matcher.matches()) {
String plugin = matcher.group(1);
double payment = Double.parseDouble(matcher.group(2));
String plugin = matcher.group(2);
double payment = Double.parseDouble(matcher.group(3));

CoreClass.debug("Split payment into two, part 1: " + plugin + ", part two: " + payment);
CoreClass.debug("Material: " + Material.getMaterial(plugin == null ? "" : plugin));
Expand Down

0 comments on commit 0956d5f

Please sign in to comment.