From eb9c7df29d59a2b23897e574272069ceaab3407e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 11 Oct 2020 13:37:40 +0200 Subject: [PATCH] Add First Join --- src/de/steamwar/bungeecore/commands/WhoisCommand.java | 1 + src/de/steamwar/bungeecore/sql/SteamwarUser.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index c3b6f8d4..5bd83d6a 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -64,6 +64,7 @@ public class WhoisCommand extends BasicCommand { BungeeCore.send(player, "§7Username§8: §e" + user.getUserName()); BungeeCore.send(player, "§7UUID§8: §e" + user.getUuid().toString(), "", new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, user.getUuid().toString())); BungeeCore.send(player, "§7ID§8: §e" + user.getId()); + BungeeCore.send(player, "§7Beigetreten am§8: §e" + user.getFirstjoin().toString()); BungeeCore.send(player, "§7Online Time§8: §e" + new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600) + "h"); Team team = Team.get(user.getTeam()); diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 86bc27c4..43d23981 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -244,4 +244,14 @@ public class SteamwarUser { } return 0; } + + public Timestamp getFirstjoin() { + ResultSet set = SQL.select("SELECT MIN(StartTime) AS FirstJoin FROM Session WHERE UserID = ?", id); + try { + set.next(); + return set.getTimestamp("FirstJoin"); + } catch (SQLException throwables) { + throw new SecurityException("Could not load First Join"); + } + } }