mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-23 18:45:31 +01:00
Remove trailing zeroes from prices
This commit is contained in:
parent
1d550874fb
commit
3c949f0450
@ -1,5 +1,6 @@
|
||||
package com.Acrobot.ChestShop.Listeners.PreShopCreation;
|
||||
|
||||
import com.Acrobot.Breeze.Utils.NumberUtil;
|
||||
import com.Acrobot.Breeze.Utils.PriceUtil;
|
||||
import com.Acrobot.ChestShop.Events.PreShopCreationEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -18,6 +19,8 @@ public class PriceChecker implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public static void onPreShopCreation(PreShopCreationEvent event) {
|
||||
String line = event.getSignLine(PRICE_LINE).toUpperCase();
|
||||
line = line.replaceAll("(\\.\\d*?[1-9])0+", "$1"); //remove trailing zeroes
|
||||
|
||||
String[] part = line.split(":");
|
||||
|
||||
if (part.length > 1 && (isInvalid(part[0]) ^ isInvalid(part[1]))) {
|
||||
|
Loading…
Reference in New Issue
Block a user