From f2aeb2c3002f67d515372a09cd8913addb611a8b Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Sun, 30 Jan 2022 19:49:53 +0100 Subject: [PATCH 01/50] Parse commands before putting them in template --- .../main/java/com/alttd/velocitychat/commands/PartyCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/velocity/src/main/java/com/alttd/velocitychat/commands/PartyCommand.java b/velocity/src/main/java/com/alttd/velocitychat/commands/PartyCommand.java index 45e2beb..93fc179 100644 --- a/velocity/src/main/java/com/alttd/velocitychat/commands/PartyCommand.java +++ b/velocity/src/main/java/com/alttd/velocitychat/commands/PartyCommand.java @@ -108,7 +108,7 @@ public class PartyCommand implements SimpleCommand { stringBuilder.replace(stringBuilder.length() - 1, stringBuilder.length(), ""); return Utility.parseMiniMessage(Config.PARTY_HELP_WRAPPER, List.of( - Template.template("commands", stringBuilder.toString()) + Template.template("commands", Utility.parseMiniMessage(stringBuilder.toString())) )); } From 304d82562214b4c0fc734e4be6a3d6085db2a240 Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Sun, 30 Jan 2022 19:50:06 +0100 Subject: [PATCH 02/50] Configure party invite messages --- .../velocitychat/commands/partysubcommands/Invite.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/velocity/src/main/java/com/alttd/velocitychat/commands/partysubcommands/Invite.java b/velocity/src/main/java/com/alttd/velocitychat/commands/partysubcommands/Invite.java index 125c136..b0adff0 100644 --- a/velocity/src/main/java/com/alttd/velocitychat/commands/partysubcommands/Invite.java +++ b/velocity/src/main/java/com/alttd/velocitychat/commands/partysubcommands/Invite.java @@ -3,7 +3,6 @@ package com.alttd.velocitychat.commands.partysubcommands; import com.alttd.chat.config.Config; import com.alttd.chat.managers.PartyManager; import com.alttd.chat.objects.Party; -import com.alttd.chat.objects.PartyUser; import com.alttd.chat.util.Utility; import com.alttd.velocitychat.VelocityChat; import com.alttd.velocitychat.commands.SubCommand; @@ -11,7 +10,6 @@ import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.proxy.Player; import net.kyori.adventure.text.minimessage.Template; -import javax.xml.transform.Source; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -57,9 +55,11 @@ public class Invite implements SubCommand { return; } - target.sendMessage(Utility.parseMiniMessage("You received an invite to join " + party.getPartyName() + " click this message to accept.")); - source.sendMessage(Utility.parseMiniMessage("You send a chat party invite to !", List.of( + 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()) ))); } From 8a89b08420be09e328fc6d4d0da9b4ee8019e001 Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Sun, 30 Jan 2022 19:50:22 +0100 Subject: [PATCH 03/50] Check if a user is already in a party before letting them make another party --- .../alttd/velocitychat/commands/partysubcommands/Create.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/velocity/src/main/java/com/alttd/velocitychat/commands/partysubcommands/Create.java b/velocity/src/main/java/com/alttd/velocitychat/commands/partysubcommands/Create.java index fa011e8..785b7cc 100644 --- a/velocity/src/main/java/com/alttd/velocitychat/commands/partysubcommands/Create.java +++ b/velocity/src/main/java/com/alttd/velocitychat/commands/partysubcommands/Create.java @@ -32,6 +32,11 @@ public class Create implements SubCommand { source.sendMessage(Utility.parseMiniMessage(getHelpMessage())); return; } + if (PartyManager.getParty(player.getUniqueId()) != null) + { + source.sendMessage(Utility.parseMiniMessage(Config.ALREADY_IN_PARTY)); + return; + } if (PartyManager.getParty(args[1]) != null) { source.sendMessage(Utility.parseMiniMessage(Config.PARTY_EXISTS, List.of( Template.template("party", args[1]) From 3cb858ba3dcfc9539e89040d0eafe4c720b11c53 Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Sun, 30 Jan 2022 19:50:33 +0100 Subject: [PATCH 04/50] Added more config messages --- api/src/main/java/com/alttd/chat/config/Config.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/com/alttd/chat/config/Config.java b/api/src/main/java/com/alttd/chat/config/Config.java index 0c99ff2..893f89a 100755 --- a/api/src/main/java/com/alttd/chat/config/Config.java +++ b/api/src/main/java/com/alttd/chat/config/Config.java @@ -245,7 +245,7 @@ public final class Config { } - public static String PARTY_FORMAT = "( > → Party) "; + public static String PARTY_FORMAT = "(\"> → Party) "; public static String PARTY_SPY = "PC: : "; public static String NO_PERMISSION = "You don't have permission to use this command."; public static String NO_CONSOLE = "This command can not be used by console"; @@ -266,7 +266,11 @@ public final class Config { public static String CANT_REMOVE_PARTY_OWNER = "You can't remove yourself, please leave instead."; public static String REMOVED_FROM_PARTY = "You were removed from the '' chat party."; public static String REMOVED_USER_FROM_PARTY = "You removed from the chat party!"; - public static String NOT_A_PARTY_MEMBER = " is not a member of your party!"; + public static String NOT_A_PARTY_MEMBER = " is not a member of your party!"; + public static String ALREADY_IN_PARTY = "You're already in a party!"; + public static String SENT_PARTY_INV = "You send a chat party invite to !"; + public static String JOIN_PARTY_CLICK_MESSAGE = " '>" + + "You received an invite to join click this message to accept."; public static String PARTY_INFO = """ Chat party info: Name: @@ -292,6 +296,8 @@ public final class Config { CANT_REMOVE_PARTY_OWNER = getString("party.messages.cant-remove-owner", CANT_REMOVE_PARTY_OWNER); REMOVED_FROM_PARTY = getString("party.messages.removed-from-party", REMOVED_FROM_PARTY); NOT_A_PARTY_MEMBER = getString("party.messages.not-a-party-member", NOT_A_PARTY_MEMBER); + JOIN_PARTY_CLICK_MESSAGE = getString("party.messages.join-party-click-message", JOIN_PARTY_CLICK_MESSAGE); + SENT_PARTY_INV = getString("party.messages.sent-party-invite", SENT_PARTY_INV); PARTY_INFO = getString("party.messages.party-info", PARTY_INFO); } From 4c1da52c9b5ac606a7f7c4127becacaaded06e31 Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Sun, 30 Jan 2022 19:52:53 +0100 Subject: [PATCH 05/50] Edited templates for spy/party format --- api/src/main/java/com/alttd/chat/config/Config.java | 4 ++-- .../java/com/alttd/velocitychat/handlers/ChatHandler.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/com/alttd/chat/config/Config.java b/api/src/main/java/com/alttd/chat/config/Config.java index 893f89a..b1aeef6 100755 --- a/api/src/main/java/com/alttd/chat/config/Config.java +++ b/api/src/main/java/com/alttd/chat/config/Config.java @@ -245,8 +245,8 @@ public final class Config { } - public static String PARTY_FORMAT = "(\"> → Party) "; - public static String PARTY_SPY = "PC: : "; + public static String PARTY_FORMAT = "(\"> → ) "; + public static String PARTY_SPY = "PC: : "; public static String NO_PERMISSION = "You don't have permission to use this command."; public static String NO_CONSOLE = "This command can not be used by console"; public static String CREATED_PARTY = "You created a chat party called: " + diff --git a/velocity/src/main/java/com/alttd/velocitychat/handlers/ChatHandler.java b/velocity/src/main/java/com/alttd/velocitychat/handlers/ChatHandler.java index 7c56abe..ff261d9 100755 --- a/velocity/src/main/java/com/alttd/velocitychat/handlers/ChatHandler.java +++ b/velocity/src/main/java/com/alttd/velocitychat/handlers/ChatHandler.java @@ -144,8 +144,7 @@ public class ChatHandler { List