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 fabefcb..1ee35c1 100755 --- a/api/src/main/java/com/alttd/chat/config/Config.java +++ b/api/src/main/java/com/alttd/chat/config/Config.java @@ -271,7 +271,8 @@ public final class Config { 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_MEMBER_ONLINE = "[ChatParty] joined Altitude!"; + public static String PARTY_MEMBER_LOGGED_ON = "[ChatParty] joined Altitude..."; + public static String PARTY_MEMBER_LOGGED_OFF = "[ChatParty] left Altitude..."; public static String PARTY_INFO = """ Chat party info: Name: @@ -299,7 +300,8 @@ public final class Config { 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_MEMBER_ONLINE = getString("party.messages.party-member-online", PARTY_MEMBER_ONLINE); + PARTY_MEMBER_LOGGED_ON = getString("party.messages.party-member-logged-on", PARTY_MEMBER_LOGGED_ON); + PARTY_MEMBER_LOGGED_OFF = getString("party.messages.party-member-logged-off", PARTY_MEMBER_LOGGED_OFF); PARTY_INFO = getString("party.messages.party-info", PARTY_INFO); } diff --git a/velocity/src/main/java/com/alttd/velocitychat/listeners/ProxyPlayerListener.java b/velocity/src/main/java/com/alttd/velocitychat/listeners/ProxyPlayerListener.java index 2ea6bdc..fcce853 100755 --- a/velocity/src/main/java/com/alttd/velocitychat/listeners/ProxyPlayerListener.java +++ b/velocity/src/main/java/com/alttd/velocitychat/listeners/ProxyPlayerListener.java @@ -9,8 +9,6 @@ import com.alttd.velocitychat.data.ServerWrapper; import com.alttd.velocitychat.handlers.ServerHandler; import com.alttd.chat.managers.PartyManager; import com.alttd.chat.objects.Party; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; import com.velocitypowered.api.event.PostOrder; import com.velocitypowered.api.event.Subscribe; import com.velocitypowered.api.event.connection.DisconnectEvent; @@ -18,8 +16,6 @@ import com.velocitypowered.api.event.connection.LoginEvent; import com.velocitypowered.api.event.player.ServerConnectedEvent; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.server.RegisteredServer; -import litebans.api.Events; -import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.Template; import java.util.ArrayList; @@ -38,7 +34,7 @@ public class ProxyPlayerListener { if (chatUser == null) return; VelocityChat.getPlugin().getChatHandler().sendPartyMessage(party, - Utility.parseMiniMessage(Config.PARTY_MEMBER_ONLINE, List.of( + Utility.parseMiniMessage(Config.PARTY_MEMBER_LOGGED_ON, List.of( Template.template("player", chatUser.getDisplayName()) )), chatUser.getIgnoredPlayers()); @@ -53,11 +49,14 @@ public class ProxyPlayerListener { UUID uuid = event.getPlayer().getUniqueId(); Party party = PartyManager.getParty(event.getPlayer().getUniqueId()); if (party == null) return; - ByteArrayDataOutput out = ByteStreams.newDataOutput(); - out.writeUTF("partylogout"); - out.writeUTF(String.valueOf(party.getPartyId())); - out.writeUTF(uuid.toString()); - VelocityChat.getPlugin().getProxy().getAllServers().forEach(registeredServer -> registeredServer.sendPluginMessage(VelocityChat.getPlugin().getChannelIdentifier(), out.toByteArray())); + ChatUser chatUser = ChatUserManager.getChatUser(uuid); + if (chatUser == null) + return; + VelocityChat.getPlugin().getChatHandler().sendPartyMessage(party, + Utility.parseMiniMessage(Config.PARTY_MEMBER_LOGGED_OFF, List.of( + Template.template("player", chatUser.getDisplayName()) + )), + chatUser.getIgnoredPlayers()); // TODO setup ChatUser on Proxy //VelocityChat.getPlugin().getChatHandler().removePlayer(event.getPlayer().getUniqueId()); }