Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uuids to kira events #325

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down