Remove trailing zeroes from prices

This commit is contained in:
Andrzej Pomirski 2015-07-12 19:18:31 +02:00
parent 1d550874fb
commit 3c949f0450

View File

@ -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]))) {