Skip to content

Commit

Permalink
[2.1.7] Check command shown cache status
Browse files Browse the repository at this point in the history
  • Loading branch information
DevLeoko committed Mar 27, 2020
1 parent 396b2fb commit 7985241
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.leoko.advancedban</groupId>
<artifactId>AdvancedBan</artifactId>
<version>2.1.6</version>
<version>2.1.7</version>
<packaging>jar</packaging>
<properties>
<build>SNAPSHOT</build>
<build>RELEASE</build>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipTests>false</skipTests>
<trimStackTrace>true</trimStackTrace>
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/me/leoko/advancedban/utils/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,18 @@ public enum Command {
Punishment mute = PunishmentManager.get().getMute(uuid);
Punishment ban = PunishmentManager.get().getBan(uuid);

String cached = MessageManager.getMessage("Check.Cached", false);
String notCached = MessageManager.getMessage("Check.NotCached", false);

boolean nameCached = PunishmentManager.get().isCached(name);
boolean ipCached = PunishmentManager.get().isCached(ip);
boolean uuidCached = PunishmentManager.get().isCached(uuid);

Object sender = input.getSender();
MessageManager.sendMessage(sender, "Check.Header", true, "NAME", name);
MessageManager.sendMessage(sender, "Check.UUID", false, "UUID", uuid);
MessageManager.sendMessage(sender, "Check.Header", true, "NAME", name, "CACHED", nameCached ? cached : notCached);
MessageManager.sendMessage(sender, "Check.UUID", false, "UUID", uuid, "CACHED", uuidCached ? cached : notCached);
if (Universal.get().hasPerms(sender, "ab.check.ip")) {
MessageManager.sendMessage(sender, "Check.IP", false, "IP", ip);
MessageManager.sendMessage(sender, "Check.IP", false, "IP", ip, "CACHED", ipCached ? cached : notCached);
}
MessageManager.sendMessage(sender, "Check.Geo", false, "LOCATION", loc == null ? "failed!" : loc);
MessageManager.sendMessage(sender, "Check.Mute", false, "DURATION", mute == null ? "§anone" : mute.getType().isTemp() ? "§e" + mute.getDuration(false) : "§cperma");
Expand Down
10 changes: 6 additions & 4 deletions src/main/resources/Messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,15 @@ ChangeReason:

Check:
Usage: "&cUsage &8\xbb &7&o/check [Name]"
Header: "&7Checking &e&o%NAME%"
UUID: "&cUUID &8\xbb &7%UUID%"
IP: "&cIP &8\xbb &7%IP%"
Header: "&7Checking &e&o%NAME% &8(%CACHED%&8)"
UUID: "&cUUID &8\xbb &7%UUID% &8(%CACHED%&8)"
IP: "&cIP &8\xbb &7%IP% &8(%CACHED%&8)"
Geo: "&cCountry &8\xbb &7%LOCATION%"
Mute: "&cMuted &8\xbb &7%DURATION%"
MuteReason: " &cReason &8\xbb &7%REASON%"
Ban: "&cBanned &8\xbb &7%DURATION%"
BanReason: " &cReason &8\xbb &7%REASON%"
Warn: "&cWarns &8\xbb &7%COUNT%"
NotFound: "&cSorry we have not been able to find %NAME%"
NotFound: "&cSorry we have not been able to find %NAME%"
Cached: "&a&ocached"
NotCached: "&c&onot cached"

0 comments on commit 7985241

Please sign in to comment.