mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-10-31 21:47:10 +00:00
Fixed commas breaking notes.
This commit is contained in:
parent
922a2bcc76
commit
1e97273e01
@ -47,34 +47,34 @@ public class Command_notes extends FreedomCommand
|
||||
|
||||
switch (args[1])
|
||||
{
|
||||
case "list":
|
||||
case "list" ->
|
||||
{
|
||||
msgNew("<green>Player notes for <player>:", Placeholder.unparsed("player", playerData.getName()));
|
||||
int id = 1;
|
||||
for (String note : playerData.getNotes())
|
||||
{
|
||||
String a = note.replace("\\u002C", ",");
|
||||
msgNew("<num>. <note>",
|
||||
Placeholder.unparsed("num", String.valueOf(id)),
|
||||
Placeholder.unparsed("note", note));
|
||||
Placeholder.unparsed("note", a));
|
||||
id++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
case "add":
|
||||
case "add" ->
|
||||
{
|
||||
if (args.length < 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String note = sender.getName() + ": " + StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ");
|
||||
String note = sender.getName() + ": " + StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ")
|
||||
.replace(",", "\\u002C");
|
||||
playerData.addNote(note);
|
||||
plugin.pl.save(playerData);
|
||||
msgNew("<green>Note added.");
|
||||
return true;
|
||||
}
|
||||
|
||||
case "remove":
|
||||
case "remove" ->
|
||||
{
|
||||
if (args.length < 3)
|
||||
{
|
||||
@ -85,8 +85,7 @@ public class Command_notes extends FreedomCommand
|
||||
try
|
||||
{
|
||||
id = Integer.parseInt(args[2]);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
} catch (NumberFormatException e)
|
||||
{
|
||||
msgNew("<red>Invalid number: <num>", Placeholder.unparsed("num", args[2]));
|
||||
return true;
|
||||
@ -98,16 +97,14 @@ public class Command_notes extends FreedomCommand
|
||||
{
|
||||
plugin.pl.save(playerData);
|
||||
msgNew("<green>Note removed.");
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
msgNew("<red>No note with the ID of <id> exists.", Placeholder.unparsed("id", args[2]));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case "clear":
|
||||
case "clear" ->
|
||||
{
|
||||
int count = playerData.getNotes().size();
|
||||
playerData.clearNotes();
|
||||
@ -115,8 +112,7 @@ public class Command_notes extends FreedomCommand
|
||||
msgNew("<green>Cleared <count> notes.", Placeholder.unparsed("count", String.valueOf(count)));
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
default ->
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user