mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-29 12:17:36 +01:00
Specify Locale with String.toLowerCase()
This commit is contained in:
parent
41fb1bc347
commit
b3d8aae193
@ -13,6 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public abstract class HologramSubCommand implements SubCommand {
|
public abstract class HologramSubCommand implements SubCommand {
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ public abstract class HologramSubCommand implements SubCommand {
|
|||||||
protected HologramSubCommand(String name, String... aliases) {
|
protected HologramSubCommand(String name, String... aliases) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.aliases = aliases != null ? Arrays.asList(aliases) : Collections.emptyList();
|
this.aliases = aliases != null ? Arrays.asList(aliases) : Collections.emptyList();
|
||||||
this.permission = Permissions.COMMAND_BASE + name.toLowerCase();
|
this.permission = Permissions.COMMAND_BASE + name.toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
this.showInHelpCommand = true;
|
this.showInHelpCommand = true;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ public class InternalHologramEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isConfigFile(Path file) {
|
private static boolean isConfigFile(Path file) {
|
||||||
return Files.isRegularFile(file) && file.getFileName().toString().toLowerCase().endsWith(".yml");
|
return Files.isRegularFile(file) && FileUtils.hasFileExtension(file, "yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class HologramLineParser {
|
public class HologramLineParser {
|
||||||
|
|
||||||
private static final String ICON_PREFIX = "icon:";
|
private static final String ICON_PREFIX = "icon:";
|
||||||
@ -24,7 +26,7 @@ public class HologramLineParser {
|
|||||||
public static InternalHologramLine parseLine(InternalHologram hologram, String serializedLine) throws HologramLoadException {
|
public static InternalHologramLine parseLine(InternalHologram hologram, String serializedLine) throws HologramLoadException {
|
||||||
InternalHologramLine hologramLine;
|
InternalHologramLine hologramLine;
|
||||||
|
|
||||||
if (serializedLine.toLowerCase().startsWith(ICON_PREFIX)) {
|
if (serializedLine.toLowerCase(Locale.ROOT).startsWith(ICON_PREFIX)) {
|
||||||
String serializedIcon = serializedLine.substring(ICON_PREFIX.length());
|
String serializedIcon = serializedLine.substring(ICON_PREFIX.length());
|
||||||
ItemStack icon = parseItemStack(serializedIcon);
|
ItemStack icon = parseItemStack(serializedIcon);
|
||||||
hologramLine = hologram.createItemLine(icon, serializedLine);
|
hologramLine = hologram.createItemLine(icon, serializedLine);
|
||||||
|
@ -15,6 +15,7 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class AnimationsLegacyUpgrade extends LegacyUpgrade {
|
public class AnimationsLegacyUpgrade extends LegacyUpgrade {
|
||||||
@ -60,7 +61,7 @@ public class AnimationsLegacyUpgrade extends LegacyUpgrade {
|
|||||||
|
|
||||||
// Remove the first line that only contains the speed
|
// Remove the first line that only contains the speed
|
||||||
String firstLine = lines.remove(0).trim();
|
String firstLine = lines.remove(0).trim();
|
||||||
if (!firstLine.toLowerCase().startsWith(SPEED_PREFIX)) {
|
if (!firstLine.toLowerCase(Locale.ROOT).startsWith(SPEED_PREFIX)) {
|
||||||
return; // Not a valid animation
|
return; // Not a valid animation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user