From a598ad75fc953e16848c33b272af6be20306dc07 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Thu, 7 Dec 2017 14:06:29 +0200 Subject: [PATCH] Removed qinspect from Bungee due to large refactor requirement --- .../com/djrapitops/plan/command/ConditionUtils.java | 13 ++++++++++++- .../djrapitops/plan/command/PlanBungeeCommand.java | 1 - .../plan/command/commands/QInspectCommand.java | 12 ++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/command/ConditionUtils.java b/Plan/src/main/java/com/djrapitops/plan/command/ConditionUtils.java index 6d0b6d75c..c94447f67 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/ConditionUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/ConditionUtils.java @@ -1,7 +1,9 @@ package main.java.com.djrapitops.plan.command; +import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.utilities.Verify; import main.java.com.djrapitops.plan.Plan; +import main.java.com.djrapitops.plan.PlanBungee; import java.util.UUID; @@ -27,6 +29,15 @@ public class ConditionUtils { * @return has the player played before, false if uuid is null. */ public static boolean playerHasPlayed(UUID uuid) { - return Verify.notNull(uuid) && Plan.getInstance().getServer().getOfflinePlayer(uuid).hasPlayedBefore(); + if ( Verify.containsNull(uuid)) { + return false; + } + boolean hasPlayed; + if (Check.isBukkitAvailable()) { + hasPlayed = Plan.getInstance().getServer().getOfflinePlayer(uuid).hasPlayedBefore(); + } else { + hasPlayed = PlanBungee.getInstance().getDB().wasSeenBefore(uuid); + } + return hasPlayed; } } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java index 518e6b4f1..8bea54ad7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java @@ -40,7 +40,6 @@ public class PlanBungeeCommand extends TreeCommand { @Override public void addCommands() { add( - new QInspectCommand(plugin), new ReloadCommand(plugin), new StatusCommand<>(plugin, Permissions.MANAGE.getPermission(), plugin.getColorScheme()), new ListCommand() diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java index 8d08bc646..3cb1bc638 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/QInspectCommand.java @@ -10,7 +10,6 @@ import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.RunnableFactory; import com.djrapitops.plugin.utilities.Verify; import main.java.com.djrapitops.plan.api.IPlan; -import main.java.com.djrapitops.plan.command.ConditionUtils; import main.java.com.djrapitops.plan.data.PlayerProfile; import main.java.com.djrapitops.plan.settings.Permissions; import main.java.com.djrapitops.plan.settings.locale.Locale; @@ -71,9 +70,6 @@ public class QInspectCommand extends SubCommand { if (!Condition.isTrue(Verify.notNull(uuid), Locale.get(Msg.CMD_FAIL_USERNAME_NOT_VALID).toString(), sender)) { return; } - if (!Condition.isTrue(ConditionUtils.playerHasPlayed(uuid), Locale.get(Msg.CMD_FAIL_USERNAME_NOT_SEEN).toString(), sender)) { - return; - } if (!Condition.isTrue(plugin.getDB().wasSeenBefore(uuid), Locale.get(Msg.CMD_FAIL_USERNAME_NOT_KNOWN).toString(), sender)) { return; } @@ -107,11 +103,11 @@ public class QInspectCommand extends SubCommand { double activityIndex = profile.getActivityIndex(now); sender.sendMessage(colT + ball + " " + colM + " Activity Index: " + colS + FormatUtils.cutDecimals(activityIndex) + " | " + FormatUtils.readableActivityIndex(activityIndex)[1]); - sender.sendMessage(colT + ball + " " + colM + " Registered: " + colS + profile.getRegistered()); - sender.sendMessage(colT + ball + " " + colM + " Last Seen: " + colS + profile.getLastSeen()); + sender.sendMessage(colT + ball + " " + colM + " Registered: " + colS + FormatUtils.formatTimeStampYear(profile.getRegistered())); + sender.sendMessage(colT + ball + " " + colM + " Last Seen: " + colS + FormatUtils.formatTimeStampYear(profile.getLastSeen())); sender.sendMessage(colT + ball + " " + colM + " Logged in from: " + colS + profile.getMostRecentGeoInfo().getGeolocation()); - sender.sendMessage(colT + ball + " " + colM + " Playtime: " + colS + profile.getTotalPlaytime()); - sender.sendMessage(colT + ball + " " + colM + " Longest Session: " + colS + profile.getLongestSession(0, now)); + sender.sendMessage(colT + ball + " " + colM + " Playtime: " + colS + FormatUtils.formatTimeAmount(profile.getTotalPlaytime())); + sender.sendMessage(colT + ball + " " + colM + " Longest Session: " + colS + FormatUtils.formatTimeAmount(profile.getLongestSession(0, now))); sender.sendMessage(colT + ball + " " + colM + " Times Kicked: " + colS + profile.getTimesKicked()); sender.sendMessage(""); sender.sendMessage(colT + ball + " " + colM + " Player Kills : " + colS + profile.getPlayerKills().count());