mirror of
https://github.com/darksaid98/TownyChat.git
synced 2026-12-04 14:38:58 +00:00
- Replace the splitter for channels saved in metadata with the #
symbol.
This commit is contained in:
1 parent
07c3a97437
commit
ce65d2a716
2 files changed
+18
-3
No files matched your search
@@ -401,4 +401,5 @@ v0.94:
|
|||||||
v0.95:
|
v0.95:
|
||||||
- Regression: channels.yml not handling /townychat reload, bug began in 0.92.
|
- Regression: channels.yml not handling /townychat reload, bug began in 0.92.
|
||||||
v0.96:
|
v0.96:
|
||||||
- Display invalid subcommand message when /ch is used with an invalid subcommand.
|
- Display invalid subcommand message when /ch is used with an invalid subcommand.
|
||||||
|
- Replace the splitter for channels saved in metadata with the # symbol.
|
||||||
@@ -225,6 +225,8 @@ public class TownyChatPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// From TownyChat 0.84-0.95 the symbol used to separate the channels in the meta
|
||||||
|
// was not good for non-unicode-using mysql servers.
|
||||||
private void checkPlayerForOldMeta(Player player) {
|
private void checkPlayerForOldMeta(Player player) {
|
||||||
Resident resident = TownyAPI.getInstance().getResident(player);
|
Resident resident = TownyAPI.getInstance().getResident(player);
|
||||||
if (resident != null && playerHasTCMeta(resident))
|
if (resident != null && playerHasTCMeta(resident))
|
||||||
@@ -242,7 +244,8 @@ public class TownyChatPlayerListener implements Listener {
|
|||||||
if (MetaDataUtil.hasMeta(resident, icsdf)) {
|
if (MetaDataUtil.hasMeta(resident, icsdf)) {
|
||||||
String meta = MetaDataUtil.getString(resident, icsdf);
|
String meta = MetaDataUtil.getString(resident, icsdf);
|
||||||
if (meta.contains("\uFF0c ")) {
|
if (meta.contains("\uFF0c ")) {
|
||||||
meta.replaceAll("\uFF0c ", "#");
|
meta = replaceSymbol(meta);
|
||||||
|
meta = meta.replaceAll(" ", "");
|
||||||
MetaDataUtil.setString(resident, icsdf, meta, true);
|
MetaDataUtil.setString(resident, icsdf, meta, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,9 +253,20 @@ public class TownyChatPlayerListener implements Listener {
|
|||||||
if (MetaDataUtil.hasMeta(resident, socsdf)) {
|
if (MetaDataUtil.hasMeta(resident, socsdf)) {
|
||||||
String meta = MetaDataUtil.getString(resident, socsdf);
|
String meta = MetaDataUtil.getString(resident, socsdf);
|
||||||
if (meta.contains("\uFF0c ")) {
|
if (meta.contains("\uFF0c ")) {
|
||||||
meta.replaceAll("\uFF0c ", "#");
|
meta = replaceSymbol(meta);
|
||||||
|
meta = meta.replaceAll(" ", "");
|
||||||
MetaDataUtil.setString(resident, socsdf, meta, true);
|
MetaDataUtil.setString(resident, socsdf, meta, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String replaceSymbol(String meta) {
|
||||||
|
char[] charray = meta.toCharArray();
|
||||||
|
for (int i = 0; i < meta.length(); i++) {
|
||||||
|
char n = meta.charAt(i);
|
||||||
|
if (n == '\uFF0c')
|
||||||
|
charray[i] = '#';
|
||||||
|
}
|
||||||
|
return new String(charray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user