Skip to content

Commit

Permalink
Update ChargeUtils.java
Browse files Browse the repository at this point in the history
  • Loading branch information
mcchampions committed Nov 16, 2024
1 parent d157883 commit 080e06f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class ChargeUtils {
private static final String LORE_PREFIX = "§8\u21E8 §e\u26A1 §7";
private static final String NUMBER_PREFIX = "([+-]?\\d+([.]\\d+)?([Ee][+-]?\\d+)?)";
private static final Pattern REGEX =
Pattern.compile(LORE_PREFIX + NUMBER_PREFIX + " / " + NUMBER_PREFIX + " J", Pattern.CASE_INSENSITIVE);
Pattern.compile("(§c§o)?" + LORE_PREFIX + NUMBER_PREFIX + " / " + NUMBER_PREFIX + " J", Pattern.CASE_INSENSITIVE);


private static final Pattern REGEX_NEW =
Expand Down Expand Up @@ -111,6 +111,10 @@ public static float getCharge(ItemMeta meta) {
if (matcher.matches()) {
String data = matcher.group(2);

if (data == null) {
return 0;
}

float loreValue = Float.parseFloat(data);
container.set(key, PersistentDataType.FLOAT, loreValue);
return loreValue;
Expand Down

0 comments on commit 080e06f

Please sign in to comment.