1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-30 01:39:51 +02:00

Move format methods from Util to FormatUtil

This commit is contained in:
snowleo
2012-09-02 19:41:30 +02:00
parent 3676881efd
commit 10b161ce09
32 changed files with 241 additions and 250 deletions

View File

@@ -10,6 +10,7 @@ import net.ess3.api.IUser;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import net.ess3.utils.FormatUtil;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@@ -268,7 +269,7 @@ public class EssentialsSign
final Double money = trade.getMoney();
if (money != null)
{
sign.setLine(index, Util.shortCurrency(money, ess));
sign.setLine(index, FormatUtil.shortCurrency(money, ess));
}
}

View File

@@ -3,6 +3,7 @@ package net.ess3.signs;
import static net.ess3.I18n._;
import net.ess3.api.IEssentials;
import net.ess3.api.IUser;
import net.ess3.utils.FormatUtil;
import net.ess3.utils.Util;
@@ -16,7 +17,7 @@ public class SignBalance extends EssentialsSign
@Override
protected boolean onSignInteract(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException
{
player.sendMessage(_("balance", Util.displayCurrency(player.getMoney(), ess)));
player.sendMessage(_("balance", FormatUtil.displayCurrency(player.getMoney(), ess)));
return true;
}
}

View File

@@ -6,6 +6,7 @@ import net.ess3.api.IUser;
import net.ess3.utils.Util;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.ess3.utils.FormatUtil;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
@@ -91,7 +92,7 @@ public class SignBlockListener implements Listener
for (int i = 0; i < 4; i++)
{
event.setLine(i, Util.formatString(user, "essentials.signs", event.getLine(i)));
event.setLine(i, FormatUtil.formatString(user, "essentials.signs", event.getLine(i)));
}
for (Signs signs : Signs.values())

View File

@@ -7,6 +7,7 @@ import net.ess3.api.IUser;
import net.ess3.economy.Trade;
import net.ess3.utils.Util;
import java.util.*;
import net.ess3.utils.FormatUtil;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -147,7 +148,7 @@ public class SignProtection extends EssentialsSign
{
return SignProtectionState.OWNER;
}
if (Util.stripFormat(sign.getLine(3)).equalsIgnoreCase(username))
if (FormatUtil.stripFormat(sign.getLine(3)).equalsIgnoreCase(username))
{
return SignProtectionState.OWNER;
}

View File

@@ -6,6 +6,7 @@ import net.ess3.economy.Trade;
import net.ess3.utils.Util;
import net.ess3.api.IEssentials;
import net.ess3.api.IUser;
import net.ess3.utils.FormatUtil;
import org.bukkit.inventory.ItemStack;
//TODO: Sell Enchantment on Trade signs?
@@ -140,11 +141,11 @@ public class SignTrade extends EssentialsSign
final Double money = getMoney(split[0]);
if (money != null)
{
if (Util.shortCurrency(money, ess).length() * 2 > 15)
if (FormatUtil.shortCurrency(money, ess).length() * 2 > 15)
{
throw new SignException("Line can be too long!");
}
sign.setLine(index, Util.shortCurrency(money, ess) + ":0");
sign.setLine(index, FormatUtil.shortCurrency(money, ess) + ":0");
return;
}
}
@@ -160,7 +161,7 @@ public class SignTrade extends EssentialsSign
{
throw new SignException(_("moreThanZero"));
}
sign.setLine(index, Util.shortCurrency(money, ess) + ":" + Util.shortCurrency(amount, ess).substring(1));
sign.setLine(index, FormatUtil.shortCurrency(money, ess) + ":" + FormatUtil.shortCurrency(amount, ess).substring(1));
return;
}
}
@@ -318,7 +319,7 @@ public class SignTrade extends EssentialsSign
final Double amount = getDouble(split[1]);
if (money != null && amount != null)
{
final String newline = Util.shortCurrency(money, ess) + ":" + Util.shortCurrency(amount + value, ess).substring(1);
final String newline = FormatUtil.shortCurrency(money, ess) + ":" + FormatUtil.shortCurrency(amount + value, ess).substring(1);
if (newline.length() > 15)
{
throw new SignException("This sign is full: Line too long!");