Update minimessage to 4.10.0

This commit is contained in:
destro174
2022-02-19 16:58:22 +01:00
parent 575c788d10
commit 448d9ac8aa
23 changed files with 219 additions and 252 deletions
@@ -8,7 +8,7 @@ import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.command.SimpleCommand;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.Arrays;
@@ -112,8 +112,8 @@ public class PartyCommand implements SimpleCommand {
if (stringBuilder.length() != 0)
stringBuilder.replace(stringBuilder.length() - 1, stringBuilder.length(), "");
return Utility.parseMiniMessage(Config.PARTY_HELP_WRAPPER, List.of(
Template.template("commands", Utility.parseMiniMessage(stringBuilder.toString()))
));
return Utility.parseMiniMessage(Config.PARTY_HELP_WRAPPER,
Placeholder.component("commands", Utility.parseMiniMessage(stringBuilder.toString()))
);
}
}
@@ -9,8 +9,7 @@ import com.alttd.chat.util.Utility;
import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.List;
@@ -38,9 +37,9 @@ public class Create implements SubCommand {
return;
}
if (PartyManager.getParty(args[1]) != null) {
source.sendMessage(Utility.parseMiniMessage(Config.PARTY_EXISTS, List.of(
Template.template("party", args[1])
)));
source.sendMessage(Utility.parseMiniMessage(Config.PARTY_EXISTS,
Placeholder.miniMessage("party", args[1])
));
return;
}
Party party = Queries.addParty(player.getUniqueId(), args[1], args[2]);
@@ -48,8 +47,8 @@ public class Create implements SubCommand {
party.addUser(ChatUserManager.getChatUser(player.getUniqueId()), player.getUsername());
PartyManager.addParty(party);
source.sendMessage(Utility.parseMiniMessage(Config.CREATED_PARTY,
List.of(Template.template("party_name", party.getPartyName()),
Template.template("party_password", party.getPartyPassword()))));
Placeholder.miniMessage("party_name", party.getPartyName()),
Placeholder.miniMessage("party_password", party.getPartyPassword())));
}
@Override
@@ -8,7 +8,7 @@ import com.alttd.velocitychat.VelocityChat;
import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.List;
@@ -39,9 +39,7 @@ public class Disband implements SubCommand {
return;
}
if (args.length == 1) {
source.sendMessage(Utility.parseMiniMessage(Config.DISBAND_PARTY_CONFIRM, List.of(
Template.template("party", party.getPartyName())
)));
source.sendMessage(Utility.parseMiniMessage(Config.DISBAND_PARTY_CONFIRM, Placeholder.miniMessage("party", party.getPartyName())));
return;
}
if (!args[1].equalsIgnoreCase("confirm") || !args[2].equals(party.getPartyName())) {
@@ -49,10 +47,10 @@ public class Disband implements SubCommand {
return;
}
VelocityChat.getPlugin().getChatHandler().sendPartyMessage(party,
Utility.parseMiniMessage(Config.DISBANDED_PARTY, List.of(
Template.template("owner", player.getUsername()),
Template.template("party", party.getPartyName())
)), null);
Utility.parseMiniMessage(Config.DISBANDED_PARTY,
Placeholder.miniMessage("owner", player.getUsername()),
Placeholder.miniMessage("party", party.getPartyName())
), null);
party.delete();
}
@@ -9,7 +9,7 @@ import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.List;
@@ -37,14 +37,12 @@ public class Info implements SubCommand {
displayNames.add(partyUser.getDisplayName());
}
List<Template> templates = new ArrayList<>(List.of(
Template.template("party", party.getPartyName()),
Template.template("password", party.getPartyPassword()),
Template.template("owner", party.getPartyUser(party.getOwnerUuid()).getDisplayName()),
Template.template("members", Component.join(Component.text(", "), displayNames))
source.sendMessage(Utility.parseMiniMessage(Config.PARTY_INFO,
Placeholder.miniMessage("party", party.getPartyName()),
Placeholder.miniMessage("password", party.getPartyPassword()),
Placeholder.component("owner", party.getPartyUser(party.getOwnerUuid()).getDisplayName()),
Placeholder.component("members", Component.join(Component.text(", "), displayNames))
));
source.sendMessage(Utility.parseMiniMessage(Config.PARTY_INFO, templates));
}
@Override
@@ -8,7 +8,7 @@ import com.alttd.velocitychat.VelocityChat;
import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.List;
@@ -49,19 +49,19 @@ public class Invite implements SubCommand {
Player target = optional.get();
if (!target.isActive()) {
source.sendMessage(Utility.parseMiniMessage(Config.NOT_ONLINE, List.of(
Template.template("player", target.getUsername())
)));
source.sendMessage(Utility.parseMiniMessage(Config.NOT_ONLINE,
Placeholder.miniMessage("player", target.getUsername())
));
return;
}
target.sendMessage(Utility.parseMiniMessage(Config.JOIN_PARTY_CLICK_MESSAGE, List.of(
Template.template("party", party.getPartyName()),
Template.template("party_password", party.getPartyPassword())
)));
source.sendMessage(Utility.parseMiniMessage(Config.SENT_PARTY_INV, List.of(
Template.template("player", target.getUsername())
)));
target.sendMessage(Utility.parseMiniMessage(Config.JOIN_PARTY_CLICK_MESSAGE,
Placeholder.miniMessage("party", party.getPartyName()),
Placeholder.miniMessage("party_password", party.getPartyPassword())
));
source.sendMessage(Utility.parseMiniMessage(Config.SENT_PARTY_INV,
Placeholder.miniMessage("player", target.getUsername())
));
}
@Override
@@ -8,7 +8,7 @@ import com.alttd.chat.util.Utility;
import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.List;
@@ -43,8 +43,7 @@ public class Join implements SubCommand {
// party.addUser(ChatUserManager.getChatUser(player.getUniqueId())); //Removed until we can get nicknames to translate to colors correctly
party.addUser(ChatUserManager.getChatUser(player.getUniqueId()), player.getUsername());
source.sendMessage(Utility.parseMiniMessage(Config.JOINED_PARTY, List.of(
Template.template("party_name", party.getPartyName()))));
source.sendMessage(Utility.parseMiniMessage(Config.JOINED_PARTY, Placeholder.miniMessage("party_name", party.getPartyName())));
}
@Override
@@ -9,7 +9,7 @@ import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ServerConnection;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.List;
@@ -44,10 +44,10 @@ public class Leave implements SubCommand {
UUID uuid = party.setNewOwner();
source.sendMessage(Utility.parseMiniMessage(Config.NOTIFY_FINDING_NEW_OWNER));
VelocityChat.getPlugin().getChatHandler().sendPartyMessage(party,
Utility.parseMiniMessage(Config.OWNER_LEFT_PARTY, List.of(
Template.template("old_owner", player.getUsername()),
Template.template("new_owner", party.getPartyUser(uuid).getPlayerName())
)), null);
Utility.parseMiniMessage(Config.OWNER_LEFT_PARTY,
Placeholder.miniMessage("old_owner", player.getUsername()),
Placeholder.miniMessage("new_owner", party.getPartyUser(uuid).getPlayerName())
), null);
} else {
party.delete();
}
@@ -8,8 +8,7 @@ import com.alttd.velocitychat.VelocityChat;
import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.units.qual.A;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.List;
@@ -44,9 +43,9 @@ public class Name implements SubCommand {
return;
}
if (PartyManager.getParty(args[1]) != null) {
source.sendMessage(Utility.parseMiniMessage(Config.PARTY_EXISTS, List.of(
Template.template("party", args[1])
)));
source.sendMessage(Utility.parseMiniMessage(Config.PARTY_EXISTS,
Placeholder.miniMessage("party", args[1])
));
return;
}
party.setPartyName(args[1]);
@@ -9,7 +9,7 @@ import com.alttd.velocitychat.VelocityChat;
import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.List;
@@ -43,17 +43,17 @@ public class Owner implements SubCommand {
}
PartyUser partyUser = party.getPartyUser(args[1]);
if (partyUser == null) {
source.sendMessage(Utility.parseMiniMessage(Config.NOT_A_PARTY_MEMBER, List.of(
Template.template("player", args[1])
)));
source.sendMessage(Utility.parseMiniMessage(Config.NOT_A_PARTY_MEMBER,
Placeholder.miniMessage("player", args[1])
));
return;
}
party.setNewOwner(partyUser.getUuid());
VelocityChat.getPlugin().getChatHandler().sendPartyMessage(party,
Utility.parseMiniMessage(Config.NEW_PARTY_OWNER, List.of(
Template.template("old_owner", player.getUsername()),
Template.template("new_owner", partyUser.getPlayerName())
)), null);
Utility.parseMiniMessage(Config.NEW_PARTY_OWNER,
Placeholder.miniMessage("old_owner", player.getUsername()),
Placeholder.miniMessage("new_owner", partyUser.getPlayerName())
), null);
}
@Override
@@ -10,7 +10,7 @@ import com.alttd.velocitychat.VelocityChat;
import com.alttd.velocitychat.commands.SubCommand;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.minimessage.placeholder.Placeholder;
import java.util.ArrayList;
import java.util.List;
@@ -49,18 +49,18 @@ public class Remove implements SubCommand {
if (optionalPlayer.isEmpty()) {
partyUser = party.getPartyUser(args[1]);
if (partyUser == null) {
source.sendMessage(Utility.parseMiniMessage(Config.NOT_A_PARTY_MEMBER, List.of(
Template.template("player", args[1])
)));
source.sendMessage(Utility.parseMiniMessage(Config.NOT_A_PARTY_MEMBER,
Placeholder.miniMessage("player", args[1])
));
return;
}
} else {
onlinePlayer = optionalPlayer.get();
partyUser = party.getPartyUser(onlinePlayer.getUniqueId());
if (partyUser == null) {
source.sendMessage(Utility.parseMiniMessage(Config.NOT_A_PARTY_MEMBER, List.of(
Template.template("player", onlinePlayer.getUsername())
)));
source.sendMessage(Utility.parseMiniMessage(Config.NOT_A_PARTY_MEMBER,
Placeholder.miniMessage("player", onlinePlayer.getUsername())
));
return;
}
}
@@ -72,14 +72,14 @@ public class Remove implements SubCommand {
}
if (onlinePlayer != null && onlinePlayer.isActive()) {
onlinePlayer.sendMessage(Utility.parseMiniMessage(Config.REMOVED_FROM_PARTY, List.of(
Template.template("party", party.getPartyName())
)));
onlinePlayer.sendMessage(Utility.parseMiniMessage(Config.REMOVED_FROM_PARTY,
Placeholder.miniMessage("party", party.getPartyName())
));
}
source.sendMessage(Utility.parseMiniMessage(Config.REMOVED_USER_FROM_PARTY, List.of(
Template.template("player", onlinePlayer == null ? partyUser.getPlayerName() : onlinePlayer.getUsername())
)));
source.sendMessage(Utility.parseMiniMessage(Config.REMOVED_USER_FROM_PARTY,
Placeholder.miniMessage("player", onlinePlayer == null ? partyUser.getPlayerName() : onlinePlayer.getUsername())
));
}
@Override