13
0

FixTeamColorReplaceText #23

Manuell gemergt
Lixfel hat 2 Commits von FixTeamColorReplaceText nach master 2021-05-15 21:08:11 +02:00 zusammengeführt

Datei anzeigen

@ -56,13 +56,13 @@ public class BlockTextCreator {
private static BlockArrayClipboard[] createText(String text){ private static BlockArrayClipboard[] createText(String text){
List<BlockArrayClipboard> result = new ArrayList<>(); List<BlockArrayClipboard> result = new ArrayList<>();
for(char c : text.toUpperCase().toCharArray()){ for(char c : text.toCharArray()){
try { try {
try{ try {
result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/" + c + ".schem"))))).read()); result.add((BlockArrayClipboard) new SpongeSchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(SpectateSystem.get().getDataFolder(), "text/" + nameConversion(c) + ".schem"))))).read());
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Bukkit.getLogger().log(Level.WARNING, "Could not display character " + c + " due to missing file!"); 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) { }catch (IOException e) {
throw new SecurityException("Could not load text", e); throw new SecurityException("Could not load text", e);
@ -71,6 +71,15 @@ public class BlockTextCreator {
return result.toArray(new BlockArrayClipboard[0]); 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){ private static int[] characterSize(BlockArrayClipboard[] characters){
int[] lengthes = new int[characters.length]; int[] lengthes = new int[characters.length];
for(int i = 0; i < lengthes.length; i++) for(int i = 0; i < lengthes.length; i++)
@ -130,7 +139,7 @@ public class BlockTextCreator {
}else }else
z -= Config.SchemsizeZ / 2; z -= Config.SchemsizeZ / 2;
DyeColor c = ColorConverter.chat2dye(ChatColor.getByChar(ChatColor.getLastColors(color).replace("§", ""))); DyeColor c = ColorConverter.chat2dye(ChatColor.getByChar(ChatColor.getLastColors(color).replace("§", "")));
pasteText(team.getTeamKuerzel(), x, Config.upperArenaBorder, z, aT, c); pasteText(team.getTeamKuerzel(), x, Config.upperArenaBorder + 10, z, aT, c);
} }
public static void pasteTeamNames(int teamBlueId, int teamRedId){ public static void pasteTeamNames(int teamBlueId, int teamRedId){