From 7395849d2c39167678b73f53923287af73c67d08 Mon Sep 17 00:00:00 2001 From: Husky <39809509+Huskydog9988@users.noreply.github.com> Date: Fri, 23 Feb 2024 18:19:31 -0500 Subject: [PATCH] add uuids to kira events --- .../listener/CivChatListener.java | 2 +- .../listener/SkynetListener.java | 7 ++++--- .../KiraBukkitGateway/rabbit/RabbitCommands.java | 15 +++++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/listener/CivChatListener.java b/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/listener/CivChatListener.java index c7c86eb87a..99ba0651ab 100644 --- a/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/listener/CivChatListener.java +++ b/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/listener/CivChatListener.java @@ -9,7 +9,7 @@ public class CivChatListener implements Listener { @EventHandler public void chat(GroupChatEvent e) { - KiraBukkitGatewayPlugin.getInstance().getRabbit().sendGroupChatMessage(e.getGroup(), e.getPlayer().getName(), + KiraBukkitGatewayPlugin.getInstance().getRabbit().sendGroupChatMessage(e.getGroup(), e.getPlayer(), e.getMessage()); } diff --git a/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/listener/SkynetListener.java b/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/listener/SkynetListener.java index d6a405b34c..65e4fdaca4 100644 --- a/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/listener/SkynetListener.java +++ b/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/listener/SkynetListener.java @@ -12,14 +12,15 @@ public class SkynetListener implements Listener { @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true) public void join(PlayerJoinEvent e) { if (!e.getPlayer().hasPlayedBefore()) { - KiraBukkitGatewayPlugin.getInstance().getRabbit().playerLoginFirstTime(e.getPlayer().getName()); + KiraBukkitGatewayPlugin.getInstance().getRabbit().playerLoginFirstTime(e.getPlayer()); } - KiraBukkitGatewayPlugin.getInstance().getRabbit().playerLoginOut(e.getPlayer().getName(), "LOGIN"); + + KiraBukkitGatewayPlugin.getInstance().getRabbit().playerLoginOut(e.getPlayer(), "LOGIN"); } @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true) public void leave(PlayerQuitEvent e) { - KiraBukkitGatewayPlugin.getInstance().getRabbit().playerLoginOut(e.getPlayer().getName(), "LOGOUT"); + KiraBukkitGatewayPlugin.getInstance().getRabbit().playerLoginOut(e.getPlayer(), "LOGOUT"); } } diff --git a/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/rabbit/RabbitCommands.java b/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/rabbit/RabbitCommands.java index ef989f8c1e..a4189f100f 100644 --- a/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/rabbit/RabbitCommands.java +++ b/plugins/kirabukkitgateway-paper/src/main/java/com/github/maxopoly/KiraBukkitGateway/rabbit/RabbitCommands.java @@ -27,13 +27,14 @@ public void sendAuthCode(String code, String playerName, UUID playerUUID) { sendInternal("addauth", json); } - public void sendGroupChatMessage(String group, String sender, String msg) { + public void sendGroupChatMessage(String group, Player sender, String msg) { if (group == null || sender == null || msg == null) { throw new IllegalArgumentException("Arguments cant be null"); } JsonObject json = new JsonObject(); json.addProperty("group", group); - json.addProperty("sender", sender); + json.addProperty("senderUUID", sender.getUniqueId().toString()); + json.addProperty("sender", sender.getName()); json.addProperty("msg", msg); sendInternal("groupchatmessage", json); } @@ -51,17 +52,19 @@ public void replyToRequestSession(JsonObject json) { sendInternal("requestsession", json); } - public void playerLoginFirstTime(String player) { + public void playerLoginFirstTime(Player player) { nonNullArgs(player); JsonObject json = new JsonObject(); - json.addProperty("player", player); + json.addProperty("player", player.getName()); + json.addProperty("playerUUID", player.getUniqueId().toString()); sendInternal("newplayer", json); } - public void playerLoginOut(String player, String action) { + public void playerLoginOut(Player player, String action) { nonNullArgs(player, action); JsonObject json = new JsonObject(); - json.addProperty("player", player); + json.addProperty("player", player.getName()); + json.addProperty("playerUUID", player.getUniqueId().toString()); json.addProperty("action", action); sendInternal("skynet", json); }