BUILDTOOLS-251: Make much of Bukkit locale independent

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2016-06-26 19:31:59 +10:00
parent b54985de63
commit 7f7f1608e8
17 changed files with 41 additions and 41 deletions

View File

@@ -974,7 +974,7 @@ public final class PluginDescriptionFile {
if (map.get("load") != null) {
try {
order = PluginLoadOrder.valueOf(((String) map.get("load")).toUpperCase().replaceAll("\\W", ""));
order = PluginLoadOrder.valueOf(((String) map.get("load")).toUpperCase(java.util.Locale.ENGLISH).replaceAll("\\W", ""));
} catch (ClassCastException ex) {
throw new InvalidDescriptionException(ex, "load is of wrong type");
} catch (IllegalArgumentException ex) {

View File

@@ -588,11 +588,11 @@ public final class SimplePluginManager implements PluginManager {
}
public Permission getPermission(String name) {
return permissions.get(name.toLowerCase());
return permissions.get(name.toLowerCase(java.util.Locale.ENGLISH));
}
public void addPermission(Permission perm) {
String name = perm.getName().toLowerCase();
String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH);
if (permissions.containsKey(name)) {
throw new IllegalArgumentException("The permission " + name + " is already defined!");
@@ -611,11 +611,11 @@ public final class SimplePluginManager implements PluginManager {
}
public void removePermission(String name) {
permissions.remove(name.toLowerCase());
permissions.remove(name.toLowerCase(java.util.Locale.ENGLISH));
}
public void recalculatePermissionDefaults(Permission perm) {
if (perm != null && permissions.containsKey(perm.getName().toLowerCase())) {
if (perm != null && permissions.containsKey(perm.getName().toLowerCase(java.util.Locale.ENGLISH))) {
defaultPerms.get(true).remove(perm);
defaultPerms.get(false).remove(perm);
@@ -643,7 +643,7 @@ public final class SimplePluginManager implements PluginManager {
}
public void subscribeToPermission(String permission, Permissible permissible) {
String name = permission.toLowerCase();
String name = permission.toLowerCase(java.util.Locale.ENGLISH);
Map<Permissible, Boolean> map = permSubs.get(name);
if (map == null) {
@@ -655,7 +655,7 @@ public final class SimplePluginManager implements PluginManager {
}
public void unsubscribeFromPermission(String permission, Permissible permissible) {
String name = permission.toLowerCase();
String name = permission.toLowerCase(java.util.Locale.ENGLISH);
Map<Permissible, Boolean> map = permSubs.get(name);
if (map != null) {
@@ -668,7 +668,7 @@ public final class SimplePluginManager implements PluginManager {
}
public Set<Permissible> getPermissionSubscriptions(String permission) {
String name = permission.toLowerCase();
String name = permission.toLowerCase(java.util.Locale.ENGLISH);
Map<Permissible, Boolean> map = permSubs.get(name);
if (map == null) {

View File

@@ -398,11 +398,11 @@ public abstract class JavaPlugin extends PluginBase {
* @return the plugin command if found, otherwise null
*/
public PluginCommand getCommand(String name) {
String alias = name.toLowerCase();
String alias = name.toLowerCase(java.util.Locale.ENGLISH);
PluginCommand command = getServer().getPluginCommand(alias);
if (command == null || command.getPlugin() != this) {
command = getServer().getPluginCommand(description.getName().toLowerCase() + ":" + alias);
command = getServer().getPluginCommand(description.getName().toLowerCase(java.util.Locale.ENGLISH) + ":" + alias);
}
if (command != null && command.getPlugin() == this) {