Small fixes

This commit is contained in:
Acrobot 2012-08-25 12:50:16 +02:00
parent ef91e8ccb5
commit 0a5707c4d8
3 changed files with 11 additions and 10 deletions

View File

@ -73,9 +73,10 @@ public class NumberUtil {
public static double roundUp(double number) {
return Math.ceil(number * 100) / 100;
}
/**
* Rounds the number down to two decimal points
*
*
* @param number Number to round
* @return Rounded number
*/
@ -101,16 +102,12 @@ public class NumberUtil {
}
/**
* Converts a number to roman
* Converts a number to roman (only 1-9, because of the enchantment decorations)
*
* @param number number to convert
* @return Converted number
*/
public static String toRoman(int number) {
if (number < 1 || number > 9) {
throw new IllegalArgumentException("The number must be in range 1-9 (This is only for enchantment level decoration)");
}
switch (number) {
case 1:
return "I";

View File

@ -5,6 +5,7 @@ import com.Acrobot.ChestShop.ChestShop;
import com.avaje.ebean.ExpressionList;
import org.bukkit.Material;
import javax.persistence.PersistenceException;
import java.io.*;
import java.util.List;
@ -162,7 +163,10 @@ public class Generator implements Runnable {
fileEnd(generationTime);
} catch (Exception e) {
ChestShop.getBukkitLogger().severe("Couldn't generate statistics page!");
e.printStackTrace();
if (!(e instanceof PersistenceException)) {
e.printStackTrace();
}
}
}
}

View File

@ -21,14 +21,14 @@ public class ChestShopSign {
public static final byte ITEM_LINE = 3;
public static final Pattern[] SHOP_SIGN_PATTERN = {
Pattern.compile("^$|^\\w.+$"),
Pattern.compile("^[\\w ]*$"),
Pattern.compile("[0-9]+"),
Pattern.compile(".+"),
Pattern.compile("^[\\dbs(free) :]+$"),
Pattern.compile("[\\w : -]+")
};
public static boolean isAdminShop(String owner) {
return owner.toLowerCase().replace(" ", "").equals(Config.getString(ADMIN_SHOP_NAME).toLowerCase().replace(" ", ""));
return owner.replace(" ", "").equalsIgnoreCase(Config.getString(ADMIN_SHOP_NAME).replace(" ", ""));
}
public static boolean isAdminShop(Sign sign) {