13
0

Fix BlockTextCreator

Dieser Commit ist enthalten in:
yoyosource 2021-05-15 20:06:41 +02:00
Ursprung fba3a06b00
Commit 436addb0af

Datei anzeigen

@ -56,13 +56,13 @@ public class BlockTextCreator {
private static BlockArrayClipboard[] createText(String text){
List<BlockArrayClipboard> result = new ArrayList<>();
for(char c : text.toUpperCase().toCharArray()){
for(char c : text.toCharArray()){
try {
try{
result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/" + c + ".schem"))))).read());
try {
result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/" + nameConversion(c) + ".schem"))))).read());
} catch (FileNotFoundException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not display character " + c + " due to missing file!");
result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/?.schem"))))).read());
result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/.schem"))))).read());
}
}catch (IOException e) {
throw new SecurityException("Could not load text", e);
@ -71,6 +71,15 @@ public class BlockTextCreator {
return result.toArray(new BlockArrayClipboard[0]);
}
private static String nameConversion(char c) {
switch (Character.toUpperCase(c)) {
case '/':
return "slash";
default:
return c + "";
}
}
private static int[] characterSize(BlockArrayClipboard[] characters){
int[] lengthes = new int[characters.length];
for(int i = 0; i < lengthes.length; i++)