Please read the commit description for a full changelog

- Reimplements the clownfish toggle in a much better way
- Completely rewrites the plugin's chat formatting system
- Tags now use MiniMessage instead of color codes. New tags are automatically converted.
- /adminchat now uses MiniMessage for its messages
- /autoclear and /autotp now use MiniMessage for their messages
- /banip now uses MiniMessage for its messages
- /bird now uses MiniMessage for its messages (and also now shows a rainbow message)
- /blockcmd now uses MiniMessage for its messages
- /clownfish now uses MiniMessage for its messages
- /notes now uses MiniMessage for its messages
- /op now uses MiniMessage for its messages
- /plc now uses MiniMessage for its messages
- Fixes bug in /stop where the stop message was not showing properly
- Condenses /tagrainbow into /tag and integrates /tag gradient into /tag set using MiniMessage
- /toggle now uses MiniMessage for its messages
- /tossmob now uses MiniMessage for its messages
- /unban, /unbanip, and /unbanname now use MiniMessage for its messages
- /unblockcmd now uses MiniMessage for its messages
- /uncage now uses MiniMessage for its messages
- /undisguiseall now uses MiniMessage for its messages
- /unlinkdiscord now uses MiniMessage for its messages
- /unmute now uses MiniMessage for its messages
- /vanish now uses MiniMessage for its messages
- /vote now partially uses MiniMessage for its messages
- /warn now uses MiniMessage for its messages
- Deprecates FreedomCommand.msg(String) for now
This commit is contained in:
Video
2023-03-27 18:42:43 -06:00
parent 922fa4a34f
commit 34269bde09
36 changed files with 320 additions and 433 deletions

View File

@ -6,9 +6,9 @@ import java.util.List;
import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -17,7 +17,6 @@ import org.bukkit.entity.Player;
@CommandParameters(description = "Manage notes for a player", usage = "/<command> <name> <list | add <note> | remove <id> | clear>")
public class Command_notes extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
@ -35,7 +34,7 @@ public class Command_notes extends FreedomCommand
if (entry == null)
{
msg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
msg(PLAYER_NOT_FOUND);
return true;
}
@ -50,16 +49,15 @@ public class Command_notes extends FreedomCommand
{
case "list":
{
final StringBuilder noteList = new StringBuilder();
noteList.append(ChatColor.GREEN).append("Player notes for ").append(playerData.getName()).append(":");
msgNew("<green>Player notes for <player>:", Placeholder.unparsed("player", playerData.getName()));
int id = 1;
for (String note : playerData.getNotes())
{
String noteLine = id + ". " + note;
noteList.append("\n").append(ChatColor.GOLD).append(noteLine);
msgNew("<num>. <note>",
Placeholder.unparsed("num", String.valueOf(id)),
Placeholder.unparsed("note", note));
id++;
}
msg(noteList.toString());
return true;
}
@ -72,7 +70,7 @@ public class Command_notes extends FreedomCommand
String note = sender.getName() + ": " + StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ");
playerData.addNote(note);
plugin.pl.save(playerData);
msg("Note added.", ChatColor.GREEN);
msgNew("<green>Note added.");
return true;
}
@ -90,7 +88,7 @@ public class Command_notes extends FreedomCommand
}
catch (NumberFormatException e)
{
msg("Invalid number: " + args[2], ChatColor.RED);
msgNew("<red>Invalid number: <num>", Placeholder.unparsed("num", args[2]));
return true;
}
@ -99,12 +97,13 @@ public class Command_notes extends FreedomCommand
if (playerData.removeNote(id))
{
plugin.pl.save(playerData);
msg("Note removed.");
msgNew("<green>Note removed.");
}
else
{
msg("No note with the ID of " + args[2] + " exists.", ChatColor.RED);
msgNew("<red>No note with the ID of <id> exists.", Placeholder.unparsed("id", args[2]));
}
return true;
}
@ -113,7 +112,7 @@ public class Command_notes extends FreedomCommand
int count = playerData.getNotes().size();
playerData.clearNotes();
plugin.pl.save(playerData);
msg("Cleared " + count + " notes.", ChatColor.GREEN);
msgNew("<green>Cleared <count> notes.", Placeholder.unparsed("count", String.valueOf(count)));
return true;
}