Commits
DerFrZocker authored e89706db96f
1 1 | package org.bukkit.attribute; |
2 2 | |
3 3 | import com.google.common.base.Preconditions; |
4 4 | import com.google.common.collect.Lists; |
5 + | import java.util.Locale; |
5 6 | import org.bukkit.Keyed; |
6 7 | import org.bukkit.NamespacedKey; |
7 8 | import org.bukkit.Registry; |
8 9 | import org.bukkit.Translatable; |
9 10 | import org.bukkit.util.OldEnum; |
10 11 | import org.jetbrains.annotations.NotNull; |
11 12 | |
12 13 | /** |
13 14 | * Types of attributes which may be present on an {@link Attributable}. |
14 15 | */ |
112 113 | } |
113 114 | |
114 115 | /** |
115 116 | * @param name of the attribute. |
116 117 | * @return the attribute with the given name. |
117 118 | * @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead. |
118 119 | */ |
119 120 | |
120 121 | |
121 122 | public static Attribute valueOf( String name) { |
122 - | Attribute attribute = Registry.ATTRIBUTE.get(NamespacedKey.fromString(name.toLowerCase())); |
123 + | Attribute attribute = Registry.ATTRIBUTE.get(NamespacedKey.fromString(name.toLowerCase(Locale.ROOT))); |
123 124 | if (attribute != null) { |
124 125 | return attribute; |
125 126 | } |
126 127 | |
127 128 | // Attribute keys can have dots in them which where converted to _. Since converting |
128 129 | // the _ back to a dot would be to complex (since not all _ need to be converted back) we use the field name. |
129 130 | try { |
130 131 | attribute = (Attribute) Attribute.class.getField(name).get(null); |
131 132 | } catch (NoSuchFieldException | IllegalAccessException e) { |
132 133 | attribute = null; |