Locale.ENGLISH!!1!

This commit is contained in:
snowleo 2011-11-27 06:23:07 +01:00
parent 34edf34ba3
commit 3c71ae4cd9
10 changed files with 19 additions and 15 deletions

View File

@ -5,6 +5,7 @@ import java.io.*;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -234,7 +235,7 @@ public class EssentialsConf extends Configuration
List<String> enchants = getKeys(path + ".enchant"); List<String> enchants = getKeys(path + ".enchant");
for (String enchant : enchants) for (String enchant : enchants)
{ {
Enchantment enchantment = Enchantment.getByName(enchant); Enchantment enchantment = Enchantment.getByName(enchant.toUpperCase(Locale.ENGLISH));
if (enchantment == null) { if (enchantment == null) {
continue; continue;
} }
@ -260,7 +261,7 @@ public class EssentialsConf extends Configuration
Map<String, Integer> enchant = new HashMap<String, Integer>(); Map<String, Integer> enchant = new HashMap<String, Integer>();
for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet())
{ {
enchant.put(entry.getKey().getName(), entry.getValue()); enchant.put(entry.getKey().getName().toLowerCase(Locale.ENGLISH), entry.getValue());
} }
map.put("enchant", enchant); map.put("enchant", enchant);
} }

View File

@ -234,7 +234,7 @@ public class Settings implements ISettings
try try
{ {
return ChatColor.valueOf(colorName.toUpperCase()); return ChatColor.valueOf(colorName.toUpperCase(Locale.ENGLISH));
} }
catch (IllegalArgumentException ex) catch (IllegalArgumentException ex)
{ {

View File

@ -1,6 +1,7 @@
package com.earth2me.essentials.commands; package com.earth2me.essentials.commands;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import java.util.Locale;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -24,7 +25,7 @@ public class Commandeco extends EssentialsCommand
double amount; double amount;
try try
{ {
cmd = EcoCommands.valueOf(args[0].toUpperCase()); cmd = EcoCommands.valueOf(args[0].toUpperCase(Locale.ENGLISH));
amount = Double.parseDouble(args[2].replaceAll("[^0-9\\.]", "")); amount = Double.parseDouble(args[2].replaceAll("[^0-9\\.]", ""));
} }
catch (Exception ex) catch (Exception ex)

View File

@ -68,7 +68,7 @@ public class Commandenchant extends EssentialsCommand
final Set<String> enchantmentslist = new TreeSet<String>(); final Set<String> enchantmentslist = new TreeSet<String>();
for (Map.Entry<String, Enchantment> entry : ENCHANTMENTS.entrySet()) for (Map.Entry<String, Enchantment> entry : ENCHANTMENTS.entrySet())
{ {
final String enchantmentName = entry.getValue().getName().toLowerCase(); final String enchantmentName = entry.getValue().getName().toLowerCase(Locale.ENGLISH);
if (enchantmentslist.contains(enchantmentName) || user.isAuthorized("essentials.enchant." + enchantmentName)) if (enchantmentslist.contains(enchantmentName) || user.isAuthorized("essentials.enchant." + enchantmentName))
{ {
enchantmentslist.add(entry.getKey()); enchantmentslist.add(entry.getKey());
@ -98,7 +98,7 @@ public class Commandenchant extends EssentialsCommand
{ {
throw new Exception(_("enchantmentNotFound")); throw new Exception(_("enchantmentNotFound"));
} }
final String enchantmentName = enchantment.getName().toLowerCase(); final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH);
if (!user.isAuthorized("essentials.enchant." + enchantmentName)) if (!user.isAuthorized("essentials.enchant." + enchantmentName))
{ {
throw new Exception(_("enchantmentPerm", enchantmentName)); throw new Exception(_("enchantmentPerm", enchantmentName));

View File

@ -205,7 +205,7 @@ public class Commandspawnmob extends EssentialsCommand
} }
else else
{ {
((Sheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase())); ((Sheep)spawned).setColor(DyeColor.valueOf(data.toUpperCase(Locale.ENGLISH)));
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -219,12 +219,12 @@ public class YamlStorageWriter implements IStorageWriter
} }
else if (data instanceof Material) else if (data instanceof Material)
{ {
writer.println(data.toString().toLowerCase()); writer.println(data.toString().toLowerCase(Locale.ENGLISH));
} }
else if (data instanceof MaterialData) else if (data instanceof MaterialData)
{ {
final MaterialData matData = (MaterialData)data; final MaterialData matData = (MaterialData)data;
writer.println(matData.getItemType().toString().toLowerCase() writer.println(matData.getItemType().toString().toLowerCase(Locale.ENGLISH)
+ (matData.getData() > 0 ? ":" + matData.getData() : "")); + (matData.getData() > 0 ? ":" + matData.getData() : ""));
} }
else if (data instanceof ItemStack) else if (data instanceof ItemStack)
@ -271,12 +271,12 @@ public class YamlStorageWriter implements IStorageWriter
} }
else if (data instanceof Material) else if (data instanceof Material)
{ {
writer.print(data.toString().toLowerCase()); writer.print(data.toString().toLowerCase(Locale.ENGLISH));
} }
else if (data instanceof MaterialData) else if (data instanceof MaterialData)
{ {
final MaterialData matData = (MaterialData)data; final MaterialData matData = (MaterialData)data;
writer.print(matData.getItemType().toString().toLowerCase() writer.print(matData.getItemType().toString().toLowerCase(Locale.ENGLISH)
+ (matData.getData() > 0 ? ":" + matData.getData() : "")); + (matData.getData() > 0 ? ":" + matData.getData() : ""));
} }
else else

View File

@ -2,6 +2,7 @@ package com.earth2me.essentials.chat;
import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
@ -30,6 +31,6 @@ public class EssentialsChatPlayerListenerLowest extends EssentialsChatPlayer
{ {
event.setMessage(event.getMessage().replaceAll("&([0-9a-f])", "\u00a7$1")); event.setMessage(event.getMessage().replaceAll("&([0-9a-f])", "\u00a7$1"));
} }
event.setFormat(ess.getSettings().getChatFormat(user.getGroup()).replace('&', '\u00a7').replace("\u00a7\u00a7", "&").replace("{DISPLAYNAME}", "%1$s").replace("{GROUP}", user.getGroup()).replace("{MESSAGE}", "%2$s").replace("{WORLDNAME}", user.getWorld().getName()).replace("{SHORTWORLDNAME}", user.getWorld().getName().substring(0, 1).toUpperCase())); event.setFormat(ess.getSettings().getChatFormat(user.getGroup()).replace('&', '\u00a7').replace("\u00a7\u00a7", "&").replace("{DISPLAYNAME}", "%1$s").replace("{GROUP}", user.getGroup()).replace("{MESSAGE}", "%2$s").replace("{WORLDNAME}", user.getWorld().getName()).replace("{SHORTWORLDNAME}", user.getWorld().getName().substring(0, 1).toUpperCase(Locale.ENGLISH)));
} }
} }

View File

@ -4,6 +4,7 @@ import com.earth2me.essentials.ChargeException;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.User; import com.earth2me.essentials.User;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
@ -50,7 +51,7 @@ public class EssentialsChatPlayerListenerNormal extends EssentialsChatPlayer
format.append(chatType).append("Format"); format.append(chatType).append("Format");
StringBuilder errorMsg = new StringBuilder(); StringBuilder errorMsg = new StringBuilder();
errorMsg.append("notAllowedTo").append(chatType.substring(0, 1).toUpperCase()).append(chatType.substring(1)); errorMsg.append("notAllowedTo").append(chatType.substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatType.substring(1));
if (user.isAuthorized(permission.toString())) if (user.isAuthorized(permission.toString()))
{ {

View File

@ -774,7 +774,7 @@ public abstract class PircBot implements ReplyConstants {
} }
} }
command = command.toUpperCase(); command = command.toUpperCase(Locale.ENGLISH);
if (sourceNick.startsWith(":")) { if (sourceNick.startsWith(":")) {
sourceNick = sourceNick.substring(1); sourceNick = sourceNick.substring(1);
} }

View File

@ -187,7 +187,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
final String level = config.getString("log-level", "info"); final String level = config.getString("log-level", "info");
try try
{ {
logLevel = Level.parse(level.toUpperCase()); logLevel = Level.parse(level.toUpperCase(Locale.ENGLISH));
} }
catch (IllegalArgumentException e) catch (IllegalArgumentException e)
{ {