1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-22 06:12:56 +02:00

fix some encoding issues for §

Don't attempt to close on null objects
This commit is contained in:
ementalo
2012-06-26 13:21:48 +01:00
parent d1dad4fca5
commit 845fa00856
2 changed files with 5 additions and 3 deletions

View File

@@ -180,7 +180,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE
acquireReadLock(); acquireReadLock();
try try
{ {
return getData().getNewPlayerAnnouncement().replace('&', '<EFBFBD>').replace("<EFBFBD><EFBFBD>", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", ess.getRanks().getMainGroup(user)).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString()); return getData().getNewPlayerAnnouncement().replace('&', '§').replace("§§", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", ess.getRanks().getMainGroup(user)).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
} }
finally finally
{ {

View File

@@ -85,9 +85,9 @@ public class TextInput implements IText
if (line.length() > 0 && line.charAt(0) == '#') if (line.length() > 0 && line.charAt(0) == '#')
{ {
bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-fk]", ""), lineNumber); bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-fk]", ""), lineNumber);
chapters.add(line.substring(1).replace('&', '<EFBFBD>').replace("<EFBFBD>", "&")); chapters.add(line.substring(1).replace('&', '§').replace("§", "&"));
} }
lines.add(line.replace('&', '<EFBFBD>').replace("<EFBFBD>", "&")); lines.add(line.replace('&', '§').replace("§", "&"));
lineNumber++; lineNumber++;
} }
} }
@@ -119,7 +119,9 @@ public class TextInput implements IText
} }
finally finally
{ {
if(output != null)
output.close(); output.close();
if(input != null)
input.close(); input.close();
} }
throw new FileNotFoundException("File " + filename + ".txt does not exist. Creating one for you."); throw new FileNotFoundException("File " + filename + ".txt does not exist. Creating one for you.");