diff --git a/src/main/java/com/kamikazejam/kamicommon/command/type/sender/TypeOfflinePlayer.java b/src/main/java/com/kamikazejam/kamicommon/command/type/sender/TypeOfflinePlayer.java index fc1ffdb4..104c6fb4 100644 --- a/src/main/java/com/kamikazejam/kamicommon/command/type/sender/TypeOfflinePlayer.java +++ b/src/main/java/com/kamikazejam/kamicommon/command/type/sender/TypeOfflinePlayer.java @@ -30,7 +30,7 @@ public OfflinePlayer read(String str, CommandSender sender) throws KamiCommonExc @Override public Collection getTabList(CommandSender commandSender, String s) { - return IdUtilLocal.getNames(SenderPresence.LOCAL, SenderType.PLAYER).stream() + return IdUtilLocal.getNames(SenderPresence.ONLINE, SenderType.PLAYER).stream() .filter(key -> key.toLowerCase().startsWith(s.toLowerCase())).limit(20) .collect(Collectors.toList()); } diff --git a/src/main/java/com/kamikazejam/kamicommon/util/id/IdUtilLocal.java b/src/main/java/com/kamikazejam/kamicommon/util/id/IdUtilLocal.java index 7ba0427b..50accccd 100644 --- a/src/main/java/com/kamikazejam/kamicommon/util/id/IdUtilLocal.java +++ b/src/main/java/com/kamikazejam/kamicommon/util/id/IdUtilLocal.java @@ -171,7 +171,7 @@ public static void register(CommandSender sender) { registrySenderToId.put(sender, id); // Update data before the event is ran so that data is available. - update(id, id, SenderPresence.LOCAL); + update(id, id, SenderPresence.ONLINE); } @Contract("null -> fail") @@ -415,7 +415,7 @@ public void playerJoinLowest(@NotNull PlayerJoinEvent event) { String name = player.getName(); // Joining? The player must be local at this point. - update(id, name, SenderPresence.LOCAL); + update(id, name, SenderPresence.ONLINE); } // Can't be cancelled @@ -839,12 +839,12 @@ public static void loadDatas() { KamiCommon.get().getLogger().info(Txt.parse("Loading Onlineplayer datas...")); for (IdData data : getLocalPlayerDatas()) { - update(data.getId(), data.getName(), data.getMillis(), SenderPresence.LOCAL); + update(data.getId(), data.getName(), data.getMillis(), SenderPresence.ONLINE); } KamiCommon.get().getLogger().info(Txt.parse("Loading Registry datas...")); for (String id : registryIdToSender.keySet()) { - update(id, id, SenderPresence.LOCAL); + update(id, id, SenderPresence.ONLINE); } KamiCommon.get().getLogger().info(Txt.parse("Saving Cachefile...")); diff --git a/src/main/java/com/kamikazejam/kamicommon/util/id/SenderMap.java b/src/main/java/com/kamikazejam/kamicommon/util/id/SenderMap.java index ac538eef..31798cd0 100644 --- a/src/main/java/com/kamikazejam/kamicommon/util/id/SenderMap.java +++ b/src/main/java/com/kamikazejam/kamicommon/util/id/SenderMap.java @@ -149,7 +149,6 @@ public boolean removeValueCompletely(String value) { // UTIL // -------------------------------------------- // - public static final List LOCAL_PRESENCES = ImmutableList.of(SenderPresence.LOCAL, SenderPresence.ONLINE, SenderPresence.ANY); public static final List ONLINE_PRESENCES = ImmutableList.of(SenderPresence.ONLINE, SenderPresence.ANY); public static final List OFFLINE_PRESENCES = ImmutableList.of(SenderPresence.OFFLINE, SenderPresence.ANY); @@ -159,7 +158,6 @@ public boolean removeValueCompletely(String value) { public static @NotNull List<@NotNull SenderPresence> getPresences(SenderPresence presence) { if (presence == null) throw new NullPointerException("presence"); - if (presence == SenderPresence.LOCAL) return LOCAL_PRESENCES; else if (presence == SenderPresence.ONLINE) return ONLINE_PRESENCES; else if (presence == SenderPresence.OFFLINE) return OFFLINE_PRESENCES; else throw new IllegalArgumentException("SenderPresence.ANY is not supported. You must know if it is online or offline."); diff --git a/src/main/java/com/kamikazejam/kamicommon/util/id/SenderPresence.java b/src/main/java/com/kamikazejam/kamicommon/util/id/SenderPresence.java index 71c20952..c7c27672 100644 --- a/src/main/java/com/kamikazejam/kamicommon/util/id/SenderPresence.java +++ b/src/main/java/com/kamikazejam/kamicommon/util/id/SenderPresence.java @@ -2,11 +2,12 @@ import org.jetbrains.annotations.Contract; +@SuppressWarnings("unused") public enum SenderPresence { // IMP NOTE: These must be sorted, with the most strict first // and the most loose at the end. - LOCAL, // Online and logged in on this very server. - ONLINE, // Online somewhere on the cloud. May be this server may be another server. + + ONLINE, // Online and logged in on this very server. OFFLINE, // The opposite of online. ANY, // Any. Local, Online or Offline.