mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-14 15:26:54 +01:00
Don't set default locale, instead use Locale.ENGLISH where possible
This commit is contained in:
parent
4ff00ee828
commit
c295011015
@ -692,14 +692,14 @@ public class DisguiseConfig {
|
||||
}
|
||||
|
||||
try {
|
||||
setPlayerNameType(PlayerNameType.valueOf(config.getString("PlayerNames").toUpperCase()));
|
||||
setPlayerNameType(PlayerNameType.valueOf(config.getString("PlayerNames").toUpperCase(Locale.ENGLISH)));
|
||||
} catch (Exception ex) {
|
||||
DisguiseUtilities.getLogger().warning(
|
||||
"Cannot parse '" + config.getString("PlayerNames") + "' to a valid option for PlayerNames");
|
||||
}
|
||||
|
||||
try {
|
||||
setNotifyBar(NotifyBar.valueOf(config.getString("NotifyBar").toUpperCase()));
|
||||
setNotifyBar(NotifyBar.valueOf(config.getString("NotifyBar").toUpperCase(Locale.ENGLISH)));
|
||||
|
||||
if (getNotifyBar() == NotifyBar.BOSS_BAR && !NmsVersion.v1_13.isSupported()) {
|
||||
DisguiseUtilities.getLogger().warning(
|
||||
@ -714,21 +714,21 @@ public class DisguiseConfig {
|
||||
}
|
||||
|
||||
try {
|
||||
setBossBarColor(BarColor.valueOf(config.getString("BossBarColor").toUpperCase()));
|
||||
setBossBarColor(BarColor.valueOf(config.getString("BossBarColor").toUpperCase(Locale.ENGLISH)));
|
||||
} catch (Exception ex) {
|
||||
DisguiseUtilities.getLogger().warning(
|
||||
"Cannot parse '" + config.getString("BossBarColor") + "' to a valid option for BossBarColor");
|
||||
}
|
||||
|
||||
try {
|
||||
setBossBarStyle(BarStyle.valueOf(config.getString("BossBarStyle").toUpperCase()));
|
||||
setBossBarStyle(BarStyle.valueOf(config.getString("BossBarStyle").toUpperCase(Locale.ENGLISH)));
|
||||
} catch (Exception ex) {
|
||||
DisguiseUtilities.getLogger().warning(
|
||||
"Cannot parse '" + config.getString("BossBarStyle") + "' to a valid option for BossBarStyle");
|
||||
}
|
||||
|
||||
try {
|
||||
setUpdatesBranch(UpdatesBranch.valueOf(config.getString("UpdatesBranch").toUpperCase()));
|
||||
setUpdatesBranch(UpdatesBranch.valueOf(config.getString("UpdatesBranch").toUpperCase(Locale.ENGLISH)));
|
||||
} catch (Exception ex) {
|
||||
DisguiseUtilities.getLogger().warning(
|
||||
"Cannot parse '" + config.getString("UpdatesBranch") + "' to a valid option for UpdatesBranch");
|
||||
@ -736,7 +736,7 @@ public class DisguiseConfig {
|
||||
|
||||
try {
|
||||
String option =
|
||||
config.getString("SelfDisguisesScoreboard", DisguisePushing.MODIFY_SCOREBOARD.name()).toUpperCase();
|
||||
config.getString("SelfDisguisesScoreboard", DisguisePushing.MODIFY_SCOREBOARD.name()).toUpperCase(Locale.ENGLISH);
|
||||
|
||||
if (!option.endsWith("_SCOREBOARD")) {
|
||||
option += "_SCOREBOARD";
|
||||
|
@ -194,12 +194,12 @@ public abstract class DisguiseBaseCommand implements CommandExecutor {
|
||||
return list;
|
||||
|
||||
Iterator<String> itel = list.iterator();
|
||||
String label = origArgs[origArgs.length - 1].toLowerCase();
|
||||
String label = origArgs[origArgs.length - 1].toLowerCase(Locale.ENGLISH);
|
||||
|
||||
while (itel.hasNext()) {
|
||||
String name = itel.next();
|
||||
|
||||
if (name.toLowerCase().startsWith(label))
|
||||
if (name.toLowerCase(Locale.ENGLISH).startsWith(label))
|
||||
continue;
|
||||
|
||||
itel.remove();
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.command.TabCompleter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
||||
@Getter
|
||||
@ -41,12 +42,12 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
||||
return list;
|
||||
|
||||
Iterator<String> itel = list.iterator();
|
||||
String label = origArgs[origArgs.length - 1].toLowerCase();
|
||||
String label = origArgs[origArgs.length - 1].toLowerCase(Locale.ENGLISH);
|
||||
|
||||
while (itel.hasNext()) {
|
||||
String name = itel.next();
|
||||
|
||||
if (name.toLowerCase().startsWith(label))
|
||||
if (name.toLowerCase(Locale.ENGLISH).startsWith(label))
|
||||
continue;
|
||||
|
||||
itel.remove();
|
||||
@ -104,7 +105,7 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
|
||||
LDCommand command = null;
|
||||
|
||||
for (LDCommand c : getCommands()) {
|
||||
if (!c.getTabComplete().contains(args[0].toLowerCase())) {
|
||||
if (!c.getTabComplete().contains(args[0].toLowerCase(Locale.ENGLISH))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ import org.bukkit.entity.Player;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||
private int maxRadius = 30;
|
||||
@ -98,7 +99,7 @@ public class DisguiseRadiusCommand extends DisguiseBaseCommand implements TabCom
|
||||
|
||||
if (starting == 0) {
|
||||
try {
|
||||
type = EntityType.valueOf(args[0].toUpperCase());
|
||||
type = EntityType.valueOf(args[0].toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
catch (Exception ignored) {
|
||||
}
|
||||
|
@ -13,10 +13,7 @@ import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
||||
protected ArrayList<String> filterTabs(ArrayList<String> list, String[] origArgs) {
|
||||
@ -24,12 +21,12 @@ public class UndisguisePlayerCommand implements CommandExecutor, TabCompleter {
|
||||
return list;
|
||||
|
||||
Iterator<String> itel = list.iterator();
|
||||
String label = origArgs[origArgs.length - 1].toLowerCase();
|
||||
String label = origArgs[origArgs.length - 1].toLowerCase(Locale.ENGLISH);
|
||||
|
||||
while (itel.hasNext()) {
|
||||
String name = itel.next();
|
||||
|
||||
if (name.toLowerCase().startsWith(label))
|
||||
if (name.toLowerCase(Locale.ENGLISH).startsWith(label))
|
||||
continue;
|
||||
|
||||
itel.remove();
|
||||
|
@ -18,6 +18,7 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompleter {
|
||||
|
||||
@ -80,7 +81,8 @@ public class DisguiseHelpCommand extends DisguiseBaseCommand implements TabCompl
|
||||
try {
|
||||
for (Method method : ParamInfoManager.getDisguiseWatcherMethods(watcher)) {
|
||||
if (args.length < 2 || !args[1].equalsIgnoreCase(LibsMsg.DHELP_SHOW.get())) {
|
||||
if (!perms.isAllowedDisguise(type, Collections.singleton(method.getName().toLowerCase()))) {
|
||||
if (!perms.isAllowedDisguise(type, Collections.singleton(method.getName().toLowerCase(
|
||||
Locale.ENGLISH)))) {
|
||||
ignored++;
|
||||
continue;
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum DisguiseType {
|
||||
AREA_EFFECT_CLOUD(3, 0),
|
||||
|
||||
@ -364,7 +366,7 @@ public enum DisguiseType {
|
||||
String[] split = name().split("_");
|
||||
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase();
|
||||
split[i] = split[i].charAt(0) + split[i].substring(1).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
return TranslateType.DISGUISES.get(StringUtils.join(split, " "));
|
||||
|
@ -855,7 +855,7 @@ public class MetaIndex<Y> {
|
||||
}
|
||||
|
||||
public static MetaIndex getMetaIndexByName(String name) {
|
||||
name = name.toUpperCase();
|
||||
name = name.toUpperCase(Locale.ENGLISH);
|
||||
|
||||
try {
|
||||
for (Field field : MetaIndex.class.getFields()) {
|
||||
|
@ -6,6 +6,8 @@ import me.libraryaddict.disguise.utilities.reflection.NmsAddedIn;
|
||||
import me.libraryaddict.disguise.utilities.reflection.NmsVersion;
|
||||
import org.bukkit.entity.MushroomCow;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 6/05/2019.
|
||||
*/
|
||||
@ -16,12 +18,12 @@ public class MushroomCowWatcher extends AgeableWatcher {
|
||||
|
||||
@NmsAddedIn(NmsVersion.v1_14)
|
||||
public MushroomCow.Variant getVariant() {
|
||||
return MushroomCow.Variant.valueOf(getData(MetaIndex.MUSHROOM_COW_TYPE).toUpperCase());
|
||||
return MushroomCow.Variant.valueOf(getData(MetaIndex.MUSHROOM_COW_TYPE).toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@NmsAddedIn(NmsVersion.v1_14)
|
||||
public void setVariant(MushroomCow.Variant variant) {
|
||||
setData(MetaIndex.MUSHROOM_COW_TYPE, variant.name().toLowerCase());
|
||||
setData(MetaIndex.MUSHROOM_COW_TYPE, variant.name().toLowerCase(Locale.ENGLISH));
|
||||
sendData(MetaIndex.MUSHROOM_COW_TYPE);
|
||||
}
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ public class DisguiseUtilities {
|
||||
}
|
||||
|
||||
public static boolean hasGameProfile(String playername) {
|
||||
return cachedNames.contains(playername.toLowerCase());
|
||||
return cachedNames.contains(playername.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static void createClonedDisguise(Player player, Entity toClone, Boolean[] options) {
|
||||
@ -674,12 +674,12 @@ public class DisguiseUtilities {
|
||||
profileCache.mkdirs();
|
||||
}
|
||||
|
||||
File file = new File(profileCache, string.toLowerCase());
|
||||
File file = new File(profileCache, string.toLowerCase(Locale.ENGLISH));
|
||||
PrintWriter writer = new PrintWriter(file);
|
||||
writer.write(gson.toJson(gameProfile));
|
||||
writer.close();
|
||||
|
||||
cachedNames.add(string.toLowerCase());
|
||||
cachedNames.add(string.toLowerCase(Locale.ENGLISH));
|
||||
} catch (StackOverflowError | Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -888,7 +888,7 @@ public class DisguiseUtilities {
|
||||
}
|
||||
|
||||
public static WrappedGameProfile getGameProfile(String playerName) {
|
||||
playerName = playerName.toLowerCase();
|
||||
playerName = playerName.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (!hasGameProfile(playerName)) {
|
||||
return null;
|
||||
@ -914,7 +914,7 @@ public class DisguiseUtilities {
|
||||
} catch (JsonSyntaxException ex) {
|
||||
DisguiseUtilities.getLogger()
|
||||
.warning("Gameprofile " + file.getName() + " had invalid gson and has been deleted");
|
||||
cachedNames.remove(playerName.toLowerCase());
|
||||
cachedNames.remove(playerName);
|
||||
file.delete();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -1019,7 +1019,7 @@ public class DisguiseUtilities {
|
||||
|
||||
private static WrappedGameProfile getProfileFromMojang(final String origName, final Object runnable,
|
||||
boolean contactMojang) {
|
||||
final String playerName = origName.toLowerCase();
|
||||
final String playerName = origName.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (DisguiseConfig.isSaveGameProfiles() && hasGameProfile(playerName)) {
|
||||
WrappedGameProfile profile = getGameProfile(playerName);
|
||||
@ -1153,7 +1153,7 @@ public class DisguiseUtilities {
|
||||
cachedNames.addAll(Arrays.asList(profileCache.list()));
|
||||
|
||||
invalidFile =
|
||||
LibsDisguises.getInstance().getFile().getName().toLowerCase().matches(".*((crack)|(null)|(leak)).*");
|
||||
LibsDisguises.getInstance().getFile().getName().toLowerCase(Locale.ENGLISH).matches(".*((crack)|(null)|(leak)).*");
|
||||
|
||||
for (String key : savedDisguises.list()) {
|
||||
try {
|
||||
@ -1457,13 +1457,13 @@ public class DisguiseUtilities {
|
||||
}
|
||||
|
||||
public static void removeGameProfile(String string) {
|
||||
cachedNames.remove(string.toLowerCase());
|
||||
cachedNames.remove(string.toLowerCase(Locale.ENGLISH));
|
||||
|
||||
if (!profileCache.exists()) {
|
||||
profileCache.mkdirs();
|
||||
}
|
||||
|
||||
File file = new File(profileCache, string.toLowerCase());
|
||||
File file = new File(profileCache, string.toLowerCase(Locale.ENGLISH));
|
||||
|
||||
file.delete();
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -165,7 +166,7 @@ public class SkinUtils {
|
||||
}
|
||||
|
||||
public static void grabSkin(String param, SkinCallback callback) {
|
||||
ModelType modelType = param.toLowerCase().endsWith(":slim") ? ModelType.SLIM : ModelType.NORMAL;
|
||||
ModelType modelType = param.toLowerCase(Locale.ENGLISH).endsWith(":slim") ? ModelType.SLIM : ModelType.NORMAL;
|
||||
|
||||
if (modelType == ModelType.SLIM) {
|
||||
param = param.substring(0, param.length() - ":slim".length());
|
||||
@ -184,12 +185,12 @@ public class SkinUtils {
|
||||
}
|
||||
|
||||
File file = new File(LibsDisguises.getInstance().getDataFolder(),
|
||||
"/Skins/" + param + (param.toLowerCase().endsWith(".png") ? "" : ".png"));
|
||||
"/Skins/" + param + (param.toLowerCase(Locale.ENGLISH).endsWith(".png") ? "" : ".png"));
|
||||
|
||||
if (!file.exists()) {
|
||||
file = null;
|
||||
|
||||
if (param.toLowerCase().endsWith(".png")) {
|
||||
if (param.toLowerCase(Locale.ENGLISH).endsWith(".png")) {
|
||||
callback.onError(LibsMsg.SKIN_API_BAD_FILE_NAME);
|
||||
return;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -185,7 +186,7 @@ public class ModdedManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mods.contains(e.getMod().toLowerCase())) {
|
||||
if (mods.contains(e.getMod().toLowerCase(Locale.ENGLISH))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ import javax.annotation.Nullable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ParamInfoManager {
|
||||
private static List<ParamInfo> paramList;
|
||||
@ -79,7 +80,7 @@ public class ParamInfoManager {
|
||||
|
||||
public static ParamInfo getParamInfo(DisguiseType disguiseType, String methodName) {
|
||||
for (Method method : getDisguiseWatcherMethods(disguiseType.getWatcherClass())) {
|
||||
if (!method.getName().toLowerCase().equals(methodName.toLowerCase()))
|
||||
if (!method.getName().toLowerCase(Locale.ENGLISH).equals(methodName.toLowerCase(Locale.ENGLISH)))
|
||||
continue;
|
||||
|
||||
return getParamInfo(method);
|
||||
|
@ -207,7 +207,7 @@ public class ParamInfoTypes {
|
||||
String[] split = string.split("_");
|
||||
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase();
|
||||
split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
return StringUtils.join(split, "_");
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@ -72,7 +73,7 @@ public class ParamInfoBlockData extends ParamInfo {
|
||||
|
||||
@Override
|
||||
public Set<String> getEnums(String tabComplete) {
|
||||
String s = tabComplete.toLowerCase();
|
||||
String s = tabComplete.toLowerCase(Locale.ENGLISH);
|
||||
HashSet<String> returns = new HashSet<>();
|
||||
|
||||
if (s.matches("[a-z_:]+\\[.*")) {
|
||||
@ -83,11 +84,11 @@ public class ParamInfoBlockData extends ParamInfo {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!m.name().toLowerCase().startsWith(s) && !m.getKey().toString().startsWith(s)) {
|
||||
if (!m.name().toLowerCase(Locale.ENGLISH).startsWith(s) && !m.getKey().toString().startsWith(s)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.name().toLowerCase().startsWith(s)) {
|
||||
if (m.name().toLowerCase(Locale.ENGLISH).startsWith(s)) {
|
||||
returns.add(m.name());
|
||||
} else {
|
||||
returns.add(m.getKey().toString());
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 16/02/2020.
|
||||
@ -48,10 +49,10 @@ public class ParamInfoItemBlock extends ParamInfoItemStack {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
Material material = ReflectionManager.getMaterial(split[0].toLowerCase());
|
||||
Material material = ReflectionManager.getMaterial(split[0].toLowerCase(Locale.ENGLISH));
|
||||
|
||||
if (material == null || material == Material.AIR) {
|
||||
material = Material.getMaterial(split[0].toUpperCase());
|
||||
material = Material.getMaterial(split[0].toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
if (material == null || (material == Material.AIR && !split[0].equalsIgnoreCase("air"))) {
|
||||
|
@ -15,6 +15,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 7/09/2018.
|
||||
@ -130,10 +131,10 @@ public class ParamInfoItemStack extends ParamInfoEnum {
|
||||
split = string.split("[ -]");
|
||||
}
|
||||
|
||||
Material material = ReflectionManager.getMaterial(split[0].toLowerCase());
|
||||
Material material = ReflectionManager.getMaterial(split[0].toLowerCase(Locale.ENGLISH));
|
||||
|
||||
if (material == null) {
|
||||
material = Material.getMaterial(split[0].toUpperCase());
|
||||
material = Material.getMaterial(split[0].toUpperCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
if (material == null || (material == Material.AIR && !split[0].equalsIgnoreCase("air"))) {
|
||||
@ -164,7 +165,7 @@ public class ParamInfoItemStack extends ParamInfoEnum {
|
||||
return null;
|
||||
}
|
||||
|
||||
Material material = Material.getMaterial(split[0].toUpperCase());
|
||||
Material material = Material.getMaterial(split[0].toUpperCase(Locale.ENGLISH));
|
||||
|
||||
if (material == null || (material == Material.AIR && !split[0].equalsIgnoreCase("air"))) {
|
||||
throw new IllegalArgumentException();
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@ -37,7 +38,7 @@ public class ParamInfoItemStackArray extends ParamInfoItemStack {
|
||||
String lastEntry = split.remove(split.size() - 1);
|
||||
|
||||
for (String material : super.getEnums(null)) {
|
||||
if (!split.isEmpty() && !material.toLowerCase().startsWith(lastEntry.toLowerCase()))
|
||||
if (!split.isEmpty() && !material.toLowerCase(Locale.ENGLISH).startsWith(lastEntry.toLowerCase(Locale.ENGLISH)))
|
||||
continue;
|
||||
|
||||
toReturn.add(StringUtils.join(split, ",") + (split.isEmpty() ? "" : ",") + material);
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@ -38,7 +39,7 @@ public class ParamInfoParticle extends ParamInfoEnum {
|
||||
|
||||
enums = new HashSet<>(enums);
|
||||
|
||||
tabComplete = tabComplete.toUpperCase();
|
||||
tabComplete = tabComplete.toUpperCase(Locale.ENGLISH);
|
||||
|
||||
for (Particle particle : new Particle[]{Particle.BLOCK_CRACK, Particle.BLOCK_DUST, Particle.ITEM_CRACK}) {
|
||||
for (Material mat : materials) {
|
||||
|
@ -264,7 +264,7 @@ public class DisguiseParser {
|
||||
|
||||
// libsdisguises.options.<command>.<disguise>.<method>.<options>
|
||||
for (PermissionAttachmentInfo permission : sender.getEffectivePermissions()) {
|
||||
String lowerPerm = permission.getPermission().toLowerCase();
|
||||
String lowerPerm = permission.getPermission().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (!lowerPerm.startsWith("libsdisguises.options.")) {
|
||||
continue;
|
||||
@ -382,7 +382,7 @@ public class DisguiseParser {
|
||||
*/
|
||||
private static boolean hasPermissionOption(HashMap<String, HashMap<String, Boolean>> disguiseOptions, String method,
|
||||
String value) {
|
||||
method = method.toLowerCase();
|
||||
method = method.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
// If no permissions were defined, return true
|
||||
if (!disguiseOptions.containsKey(method)) {
|
||||
@ -391,7 +391,7 @@ public class DisguiseParser {
|
||||
|
||||
HashMap<String, Boolean> map = disguiseOptions.get(method);
|
||||
|
||||
value = value.toLowerCase();
|
||||
value = value.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
// If they were explictly defined, can just return the value
|
||||
if (map.containsKey(value)) {
|
||||
@ -529,7 +529,7 @@ public class DisguiseParser {
|
||||
}
|
||||
|
||||
public static long parseStringToTime(String string) throws DisguiseParseException {
|
||||
string = string.toLowerCase();
|
||||
string = string.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (!string.matches("([0-9]+[a-z]+)+")) {
|
||||
throw new DisguiseParseException(LibsMsg.PARSE_INVALID_TIME_SEQUENCE, string);
|
||||
@ -666,7 +666,7 @@ public class DisguiseParser {
|
||||
|
||||
if (args[0].startsWith("@")) {
|
||||
if (sender.hasPermission("libsdisguises.disguise.disguiseclone")) {
|
||||
disguise = DisguiseUtilities.getClonedDisguise(args[0].toLowerCase());
|
||||
disguise = DisguiseUtilities.getClonedDisguise(args[0].toLowerCase(Locale.ENGLISH));
|
||||
|
||||
if (disguise == null) {
|
||||
throw new DisguiseParseException(LibsMsg.PARSE_NO_REF, args[0]);
|
||||
@ -743,7 +743,7 @@ public class DisguiseParser {
|
||||
throw new DisguiseParseException(LibsMsg.PARSE_SUPPLY_PLAYER);
|
||||
} else {
|
||||
// If they can't use this name, throw error
|
||||
if (!hasPermissionOption(disguiseOptions, "setname", args[1].toLowerCase())) {
|
||||
if (!hasPermissionOption(disguiseOptions, "setname", args[1].toLowerCase(Locale.ENGLISH))) {
|
||||
if (!args[1].equalsIgnoreCase(sender.getName()) ||
|
||||
!hasPermissionOption(disguiseOptions, "setname", "themselves")) {
|
||||
throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_NAME);
|
||||
@ -829,7 +829,7 @@ public class DisguiseParser {
|
||||
|
||||
usedOptions.add(optionName);
|
||||
doCheck(sender, permissions, disguisePerm, usedOptions);
|
||||
String itemName = itemStack == null ? "null" : itemStack.getType().name().toLowerCase();
|
||||
String itemName = itemStack == null ? "null" : itemStack.getType().name().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (!hasPermissionOption(disguiseOptions, optionName, itemName)) {
|
||||
throw new DisguiseParseException(LibsMsg.PARSE_NO_PERM_PARAM, itemName,
|
||||
@ -964,8 +964,8 @@ public class DisguiseParser {
|
||||
throw new DisguiseParseException(LibsMsg.PARSE_OPTION_NA, methodNameProvided);
|
||||
}
|
||||
|
||||
if (!usedOptions.contains(methodToUse.getName().toLowerCase())) {
|
||||
usedOptions.add(methodToUse.getName().toLowerCase());
|
||||
if (!usedOptions.contains(methodToUse.getName().toLowerCase(Locale.ENGLISH))) {
|
||||
usedOptions.add(methodToUse.getName().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
doCheck(sender, disguisePermission, disguisePerm, usedOptions);
|
||||
|
@ -106,7 +106,7 @@ public class DisguisePermissions {
|
||||
* @param commandName A lowercase string consisting of the name of one of Lib's Disguises commands
|
||||
*/
|
||||
public DisguisePermissions(Permissible permissionHolder, String commandName) {
|
||||
loadPermissions(permissionHolder, commandName.toLowerCase());
|
||||
loadPermissions(permissionHolder, commandName.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,7 +197,7 @@ public class DisguisePermissions {
|
||||
}
|
||||
|
||||
for (PermissionAttachmentInfo permission : sender.getEffectivePermissions()) {
|
||||
String perm = permission.getPermission().toLowerCase();
|
||||
String perm = permission.getPermission().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
String[] split = perm.split("\\.");
|
||||
|
||||
@ -467,14 +467,14 @@ public class DisguisePermissions {
|
||||
if (!storage.permittedOptions.isEmpty() || storage.negatedOptions.isEmpty()) {
|
||||
// Check if they're trying to use anything they shouldn't
|
||||
if (!disguiseOptions.stream()
|
||||
.allMatch(option -> storage.permittedOptions.contains(option.toLowerCase()))) {
|
||||
.allMatch(option -> storage.permittedOptions.contains(option.toLowerCase(Locale.ENGLISH)))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the user is using a forbidden option, return false. Otherwise true
|
||||
return disguiseOptions.stream().noneMatch(option -> storage.negatedOptions.contains(option.toLowerCase()));
|
||||
return disguiseOptions.stream().noneMatch(option -> storage.negatedOptions.contains(option.toLowerCase(Locale.ENGLISH)));
|
||||
}
|
||||
|
||||
public boolean isAllowedDisguise(DisguisePerm disguisePerm) {
|
||||
|
@ -8,6 +8,7 @@ import java.net.URLDecoder;
|
||||
import java.security.CodeSource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Locale;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
@ -31,7 +32,7 @@ public class ClassGetter {
|
||||
if (src != null) {
|
||||
URL resource = src.getLocation();
|
||||
|
||||
if (resource.getPath().toLowerCase().endsWith(".jar")) {
|
||||
if (resource.getPath().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
|
||||
processJarfile(resource, pkgname, classes);
|
||||
} else {
|
||||
for (File f : new File(resource.getPath() + "/" + pkgname.replace(".", "/")).listFiles()) {
|
||||
|
@ -106,10 +106,6 @@ public class ReflectionManager {
|
||||
private static Object genericDamage;
|
||||
|
||||
public static void init() {
|
||||
// Sometimes it doesn't like me if I don't set this :\
|
||||
// Weird characters in toLowerCase() for example
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
|
||||
try {
|
||||
boundingBoxConstructor =
|
||||
getNmsConstructor("AxisAlignedBB", double.class, double.class, double.class, double.class,
|
||||
@ -1373,7 +1369,7 @@ public class ReflectionManager {
|
||||
public static Object getEntityType(EntityType entityType) {
|
||||
try {
|
||||
Object val = entityTypesAMethod.invoke(null,
|
||||
entityType.getName() == null ? entityType.name().toLowerCase() : entityType.getName());
|
||||
entityType.getName() == null ? entityType.name().toLowerCase(Locale.ENGLISH) : entityType.getName());
|
||||
|
||||
if (NmsVersion.v1_14.isSupported()) {
|
||||
return ((Optional<Object>) val).orElse(null);
|
||||
@ -1958,7 +1954,7 @@ public class ReflectionManager {
|
||||
String[] split = string.split("_");
|
||||
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
split[i] = split[i].charAt(0) + split[i].substring(1).toLowerCase();
|
||||
split[i] = split[i].charAt(0) + split[i].substring(1).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
return split;
|
||||
|
@ -10,6 +10,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -53,7 +54,7 @@ public class SoundManager {
|
||||
}
|
||||
|
||||
List<String> list = section
|
||||
.getStringList(type.name().charAt(0) + type.name().substring(1).toLowerCase());
|
||||
.getStringList(type.name().charAt(0) + type.name().substring(1).toLowerCase(Locale.ENGLISH));
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
continue;
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 10/06/2017.
|
||||
@ -48,7 +49,7 @@ public class TranslateFiller {
|
||||
String[] split = type.name().split("_");
|
||||
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
split[i] = split[i].substring(0, 1) + split[i].substring(1).toLowerCase();
|
||||
split[i] = split[i].charAt(0) + split[i].substring(1).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
TranslateType.DISGUISES.save(StringUtils.join(split, " "), "Name for the " + type.name() + " disguise");
|
||||
|
@ -10,10 +10,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created by libraryaddict on 10/06/2017.
|
||||
@ -198,10 +195,10 @@ public enum TranslateType {
|
||||
if (translated == null || !LibsPremium.isPremium() || !DisguiseConfig.isUseTranslations())
|
||||
return translated;
|
||||
|
||||
String lowerCase = translated.toLowerCase();
|
||||
String lowerCase = translated.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
for (Map.Entry<String, String> entry : this.translated.entrySet()) {
|
||||
if (!Objects.equals(entry.getValue().toLowerCase(), lowerCase))
|
||||
if (!Objects.equals(entry.getValue().toLowerCase(Locale.ENGLISH), lowerCase))
|
||||
continue;
|
||||
|
||||
return entry.getKey();
|
||||
|
@ -157,7 +157,7 @@ public class LDJenkins {
|
||||
|
||||
changelog.add("#" + map.get("id") + ": " + ChatColor.YELLOW + msg);
|
||||
|
||||
release = release || msg.toLowerCase().matches("(re)?.?release.? .*");
|
||||
release = release || msg.toLowerCase(Locale.ENGLISH).matches("(re)?.?release.? .*");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user