- Replace the splitter for channels saved in metadata with the ,

symbol.
This commit is contained in:
Llm Dl committed 2022-02-20 18:54:25 -06:00
1 parent 997458394f
commit 36875fd67d
3 files changed
+10 -12

No files matched your search

+1 -1
View File
@@ -402,4 +402,4 @@ v0.95:
- Regression: channels.yml not handling /townychat reload, bug began in 0.92.
v0.96:
- Display invalid subcommand message when /ch is used with an invalid subcommand.
- Replace the splitter for channels saved in metadata with the # symbol.
- Replace the splitter for channels saved in metadata with the , symbol.
@@ -317,7 +317,7 @@ public abstract class Channel {
CustomDataField<?> cdf = resident.getMetadata(icdf.getKey());
if (cdf instanceof StringDataField) {
StringDataField sdf = (StringDataField) cdf;
sdf.setValue(sdf.getValue().concat("#" + this.getName()));
sdf.setValue(sdf.getValue().concat(", " + this.getName()));
TownyUniverse.getInstance().getDataSource().saveResident(resident);
}
@@ -336,13 +336,13 @@ public abstract class Channel {
if (cdf instanceof StringDataField) {
StringDataField sdf = (StringDataField) cdf;
String newValues = "";
String[] values = sdf.getValue().split("#");
String[] values = sdf.getValue().split(", ");
for (String chanName : values)
if (!chanName.equalsIgnoreCase(this.getName()))
if (newValues.isEmpty())
newValues = chanName;
else
newValues += "#" + chanName;
newValues += ", " + chanName;
if (!newValues.isEmpty()) {
sdf.setValue(newValues);
@@ -361,7 +361,7 @@ public abstract class Channel {
CustomDataField<?> cdf = resident.getMetadata(idf.getKey());
if (cdf instanceof StringDataField) {
StringDataField sdf = (StringDataField) cdf;
String[] split = sdf.getValue().split("#");
String[] split = sdf.getValue().split(", ");
for (String string : split)
if (string.equalsIgnoreCase(this.getName()))
return true;
@@ -380,7 +380,7 @@ public abstract class Channel {
CustomDataField<?> cdf = resident.getMetadata(icdf.getKey());
if (cdf instanceof StringDataField) {
StringDataField sdf = (StringDataField) cdf;
sdf.setValue(sdf.getValue().concat("#" + this.getName()));
sdf.setValue(sdf.getValue().concat(", " + this.getName()));
TownyUniverse.getInstance().getDataSource().saveResident(resident);
}
} else {
@@ -398,13 +398,13 @@ public abstract class Channel {
if (cdf instanceof StringDataField) {
StringDataField sdf = (StringDataField) cdf;
String newValues = "";
String[] values = sdf.getValue().split("#");
String[] values = sdf.getValue().split(", ");
for (String chanName : values)
if (!chanName.equalsIgnoreCase(this.getName()))
if (newValues.isEmpty())
newValues = chanName;
else
newValues += "#" + chanName;
newValues += ", " + chanName;
if (!newValues.isEmpty()) {
sdf.setValue(newValues);
@@ -422,7 +422,7 @@ public abstract class Channel {
CustomDataField<?> cdf = resident.getMetadata(idf.getKey());
if (cdf instanceof StringDataField) {
StringDataField sdf = (StringDataField) cdf;
String[] split = sdf.getValue().split("#");
String[] split = sdf.getValue().split(", ");
for (String string : split)
if (string.equalsIgnoreCase(this.getName()))
return true;
@@ -245,7 +245,6 @@ public class TownyChatPlayerListener implements Listener {
String meta = MetaDataUtil.getString(resident, icsdf);
if (meta.contains("\uFF0c ")) {
meta = replaceSymbol(meta);
meta = meta.replaceAll(" ", "");
MetaDataUtil.setString(resident, icsdf, meta, true);
}
}
@@ -254,7 +253,6 @@ public class TownyChatPlayerListener implements Listener {
String meta = MetaDataUtil.getString(resident, socsdf);
if (meta.contains("\uFF0c ")) {
meta = replaceSymbol(meta);
meta = meta.replaceAll(" ", "");
MetaDataUtil.setString(resident, socsdf, meta, true);
}
}
@@ -265,7 +263,7 @@ public class TownyChatPlayerListener implements Listener {
for (int i = 0; i < meta.length(); i++) {
char n = meta.charAt(i);
if (n == '\uFF0c')
charray[i] = '#';
charray[i] = ',';
}
return new String(charray);
}