mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-27 02:13:52 -07:00
BUILDTOOLS-251: Make much of Bukkit locale independent
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -50,7 +50,7 @@ public class PermissibleBase implements Permissible {
|
||||
throw new IllegalArgumentException("Permission name cannot be null");
|
||||
}
|
||||
|
||||
return permissions.containsKey(name.toLowerCase());
|
||||
return permissions.containsKey(name.toLowerCase(java.util.Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public boolean isPermissionSet(Permission perm) {
|
||||
@@ -66,7 +66,7 @@ public class PermissibleBase implements Permissible {
|
||||
throw new IllegalArgumentException("Permission name cannot be null");
|
||||
}
|
||||
|
||||
String name = inName.toLowerCase();
|
||||
String name = inName.toLowerCase(java.util.Locale.ENGLISH);
|
||||
|
||||
if (isPermissionSet(name)) {
|
||||
return permissions.get(name).getValue();
|
||||
@@ -86,7 +86,7 @@ public class PermissibleBase implements Permissible {
|
||||
throw new IllegalArgumentException("Permission cannot be null");
|
||||
}
|
||||
|
||||
String name = perm.getName().toLowerCase();
|
||||
String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH);
|
||||
|
||||
if (isPermissionSet(name)) {
|
||||
return permissions.get(name).getValue();
|
||||
@@ -151,7 +151,7 @@ public class PermissibleBase implements Permissible {
|
||||
Bukkit.getServer().getPluginManager().subscribeToDefaultPerms(isOp(), parent);
|
||||
|
||||
for (Permission perm : defaults) {
|
||||
String name = perm.getName().toLowerCase();
|
||||
String name = perm.getName().toLowerCase(java.util.Locale.ENGLISH);
|
||||
permissions.put(name, new PermissionAttachmentInfo(parent, name, null, true));
|
||||
Bukkit.getServer().getPluginManager().subscribeToPermission(name, parent);
|
||||
calculateChildPermissions(perm.getChildren(), false, null);
|
||||
@@ -181,7 +181,7 @@ public class PermissibleBase implements Permissible {
|
||||
for (String name : keys) {
|
||||
Permission perm = Bukkit.getServer().getPluginManager().getPermission(name);
|
||||
boolean value = children.get(name) ^ invert;
|
||||
String lname = name.toLowerCase();
|
||||
String lname = name.toLowerCase(java.util.Locale.ENGLISH);
|
||||
|
||||
permissions.put(lname, new PermissionAttachmentInfo(parent, lname, attachment, value));
|
||||
Bukkit.getServer().getPluginManager().subscribeToPermission(name, parent);
|
||||
|
@@ -181,7 +181,7 @@ public class Permission {
|
||||
*/
|
||||
public Permission addParent(String name, boolean value) {
|
||||
PluginManager pm = Bukkit.getServer().getPluginManager();
|
||||
String lname = name.toLowerCase();
|
||||
String lname = name.toLowerCase(java.util.Locale.ENGLISH);
|
||||
|
||||
Permission perm = pm.getPermission(lname);
|
||||
|
||||
|
@@ -83,7 +83,7 @@ public class PermissionAttachment {
|
||||
* @param value New value of the permission
|
||||
*/
|
||||
public void setPermission(String name, boolean value) {
|
||||
permissions.put(name.toLowerCase(), value);
|
||||
permissions.put(name.toLowerCase(java.util.Locale.ENGLISH), value);
|
||||
permissible.recalculatePermissions();
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class PermissionAttachment {
|
||||
* @param name Name of the permission to remove
|
||||
*/
|
||||
public void unsetPermission(String name) {
|
||||
permissions.remove(name.toLowerCase());
|
||||
permissions.remove(name.toLowerCase(java.util.Locale.ENGLISH));
|
||||
permissible.recalculatePermissions();
|
||||
}
|
||||
|
||||
|
@@ -48,7 +48,7 @@ public enum PermissionDefault {
|
||||
* @return Specified value, or null if not found
|
||||
*/
|
||||
public static PermissionDefault getByName(String name) {
|
||||
return lookup.get(name.toLowerCase().replaceAll("[^a-z!]", ""));
|
||||
return lookup.get(name.toLowerCase(java.util.Locale.ENGLISH).replaceAll("[^a-z!]", ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user