diff --git a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java index 7a00be2c..7fede5df 100644 --- a/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java +++ b/commons/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java @@ -47,34 +47,34 @@ public class Command_notes extends FreedomCommand switch (args[1]) { - case "list": + case "list" -> { msgNew("Player notes for :", Placeholder.unparsed("player", playerData.getName())); int id = 1; for (String note : playerData.getNotes()) { + String a = note.replace("\\u002C", ","); msgNew(". ", 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("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("Invalid number: ", Placeholder.unparsed("num", args[2])); return true; @@ -98,16 +97,14 @@ public class Command_notes extends FreedomCommand { plugin.pl.save(playerData); msgNew("Note removed."); - } - else + } else { msgNew("No note with the ID of 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("Cleared notes.", Placeholder.unparsed("count", String.valueOf(count))); return true; } - - default: + default -> { return false; }