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
997458394f
commit
36875fd67d
3 files changed
+10
-12
No files matched your search
@@ -402,4 +402,4 @@ 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.
|
- 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());
|
CustomDataField<?> cdf = resident.getMetadata(icdf.getKey());
|
||||||
if (cdf instanceof StringDataField) {
|
if (cdf instanceof StringDataField) {
|
||||||
StringDataField sdf = (StringDataField) cdf;
|
StringDataField sdf = (StringDataField) cdf;
|
||||||
sdf.setValue(sdf.getValue().concat("#" + this.getName()));
|
sdf.setValue(sdf.getValue().concat(", " + this.getName()));
|
||||||
TownyUniverse.getInstance().getDataSource().saveResident(resident);
|
TownyUniverse.getInstance().getDataSource().saveResident(resident);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,13 +336,13 @@ public abstract class Channel {
|
|||||||
if (cdf instanceof StringDataField) {
|
if (cdf instanceof StringDataField) {
|
||||||
StringDataField sdf = (StringDataField) cdf;
|
StringDataField sdf = (StringDataField) cdf;
|
||||||
String newValues = "";
|
String newValues = "";
|
||||||
String[] values = sdf.getValue().split("#");
|
String[] values = sdf.getValue().split(", ");
|
||||||
for (String chanName : values)
|
for (String chanName : values)
|
||||||
if (!chanName.equalsIgnoreCase(this.getName()))
|
if (!chanName.equalsIgnoreCase(this.getName()))
|
||||||
if (newValues.isEmpty())
|
if (newValues.isEmpty())
|
||||||
newValues = chanName;
|
newValues = chanName;
|
||||||
else
|
else
|
||||||
newValues += "#" + chanName;
|
newValues += ", " + chanName;
|
||||||
|
|
||||||
if (!newValues.isEmpty()) {
|
if (!newValues.isEmpty()) {
|
||||||
sdf.setValue(newValues);
|
sdf.setValue(newValues);
|
||||||
@@ -361,7 +361,7 @@ public abstract class Channel {
|
|||||||
CustomDataField<?> cdf = resident.getMetadata(idf.getKey());
|
CustomDataField<?> cdf = resident.getMetadata(idf.getKey());
|
||||||
if (cdf instanceof StringDataField) {
|
if (cdf instanceof StringDataField) {
|
||||||
StringDataField sdf = (StringDataField) cdf;
|
StringDataField sdf = (StringDataField) cdf;
|
||||||
String[] split = sdf.getValue().split("#");
|
String[] split = sdf.getValue().split(", ");
|
||||||
for (String string : split)
|
for (String string : split)
|
||||||
if (string.equalsIgnoreCase(this.getName()))
|
if (string.equalsIgnoreCase(this.getName()))
|
||||||
return true;
|
return true;
|
||||||
@@ -380,7 +380,7 @@ public abstract class Channel {
|
|||||||
CustomDataField<?> cdf = resident.getMetadata(icdf.getKey());
|
CustomDataField<?> cdf = resident.getMetadata(icdf.getKey());
|
||||||
if (cdf instanceof StringDataField) {
|
if (cdf instanceof StringDataField) {
|
||||||
StringDataField sdf = (StringDataField) cdf;
|
StringDataField sdf = (StringDataField) cdf;
|
||||||
sdf.setValue(sdf.getValue().concat("#" + this.getName()));
|
sdf.setValue(sdf.getValue().concat(", " + this.getName()));
|
||||||
TownyUniverse.getInstance().getDataSource().saveResident(resident);
|
TownyUniverse.getInstance().getDataSource().saveResident(resident);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -398,13 +398,13 @@ public abstract class Channel {
|
|||||||
if (cdf instanceof StringDataField) {
|
if (cdf instanceof StringDataField) {
|
||||||
StringDataField sdf = (StringDataField) cdf;
|
StringDataField sdf = (StringDataField) cdf;
|
||||||
String newValues = "";
|
String newValues = "";
|
||||||
String[] values = sdf.getValue().split("#");
|
String[] values = sdf.getValue().split(", ");
|
||||||
for (String chanName : values)
|
for (String chanName : values)
|
||||||
if (!chanName.equalsIgnoreCase(this.getName()))
|
if (!chanName.equalsIgnoreCase(this.getName()))
|
||||||
if (newValues.isEmpty())
|
if (newValues.isEmpty())
|
||||||
newValues = chanName;
|
newValues = chanName;
|
||||||
else
|
else
|
||||||
newValues += "#" + chanName;
|
newValues += ", " + chanName;
|
||||||
|
|
||||||
if (!newValues.isEmpty()) {
|
if (!newValues.isEmpty()) {
|
||||||
sdf.setValue(newValues);
|
sdf.setValue(newValues);
|
||||||
@@ -422,7 +422,7 @@ public abstract class Channel {
|
|||||||
CustomDataField<?> cdf = resident.getMetadata(idf.getKey());
|
CustomDataField<?> cdf = resident.getMetadata(idf.getKey());
|
||||||
if (cdf instanceof StringDataField) {
|
if (cdf instanceof StringDataField) {
|
||||||
StringDataField sdf = (StringDataField) cdf;
|
StringDataField sdf = (StringDataField) cdf;
|
||||||
String[] split = sdf.getValue().split("#");
|
String[] split = sdf.getValue().split(", ");
|
||||||
for (String string : split)
|
for (String string : split)
|
||||||
if (string.equalsIgnoreCase(this.getName()))
|
if (string.equalsIgnoreCase(this.getName()))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ public class TownyChatPlayerListener implements Listener {
|
|||||||
String meta = MetaDataUtil.getString(resident, icsdf);
|
String meta = MetaDataUtil.getString(resident, icsdf);
|
||||||
if (meta.contains("\uFF0c ")) {
|
if (meta.contains("\uFF0c ")) {
|
||||||
meta = replaceSymbol(meta);
|
meta = replaceSymbol(meta);
|
||||||
meta = meta.replaceAll(" ", "");
|
|
||||||
MetaDataUtil.setString(resident, icsdf, meta, true);
|
MetaDataUtil.setString(resident, icsdf, meta, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -254,7 +253,6 @@ public class TownyChatPlayerListener implements Listener {
|
|||||||
String meta = MetaDataUtil.getString(resident, socsdf);
|
String meta = MetaDataUtil.getString(resident, socsdf);
|
||||||
if (meta.contains("\uFF0c ")) {
|
if (meta.contains("\uFF0c ")) {
|
||||||
meta = replaceSymbol(meta);
|
meta = replaceSymbol(meta);
|
||||||
meta = meta.replaceAll(" ", "");
|
|
||||||
MetaDataUtil.setString(resident, socsdf, meta, true);
|
MetaDataUtil.setString(resident, socsdf, meta, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,7 +263,7 @@ public class TownyChatPlayerListener implements Listener {
|
|||||||
for (int i = 0; i < meta.length(); i++) {
|
for (int i = 0; i < meta.length(); i++) {
|
||||||
char n = meta.charAt(i);
|
char n = meta.charAt(i);
|
||||||
if (n == '\uFF0c')
|
if (n == '\uFF0c')
|
||||||
charray[i] = '#';
|
charray[i] = ',';
|
||||||
}
|
}
|
||||||
return new String(charray);
|
return new String(charray);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user