From 6f66957b17bc981490bc78f74493d11987463ce8 Mon Sep 17 00:00:00 2001 From: abhiram Date: Sun, 28 Feb 2021 21:08:39 +0530 Subject: [PATCH] Few fixes for JIRA issues.... --- .idea/checkstyle-idea.xml | 16 ++++++++++++++++ .idea/misc.xml | 6 +++++- .../totalfreedommod/admin/ActivityLogEntry.java | 10 +++++++++- .../totalfreedommod/admin/AdminList.java | 8 +++++++- 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 .idea/checkstyle-idea.xml diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml new file mode 100644 index 00000000..658f1529 --- /dev/null +++ b/.idea/checkstyle-idea.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index be85aa37..99aec2a9 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,9 @@ + + + + @@ -12,5 +16,5 @@ - + \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java index d384d221..eb056fcb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/ActivityLogEntry.java @@ -72,7 +72,15 @@ public class ActivityLogEntry implements IConfig public void addLogout() { - String lastLoginString = timestamps.get(timestamps.size() - 1); // there's a bug with subtracting the -1 here + // Fix of Array index out of bonds issue: FS-131 + String lastLoginString; + if(timestamps.size() > 1) + { + lastLoginString = timestamps.get(timestamps.size() - 1); + }else + { + lastLoginString = timestamps.get(0); + } Date currentTime = Date.from(Instant.now()); timestamps.add("Logout: " + FUtil.dateToString(currentTime)); lastLoginString = lastLoginString.replace("Login: ", ""); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java index 7ed0b9fa..fa4797e6 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java @@ -240,7 +240,13 @@ public class AdminList extends FreedomService public boolean isVerifiedAdmin(Player player) { - return verifiedNoAdmin.contains(player.getName()) && verifiedNoAdminIps.get(player.getName()).contains(FUtil.getIp(player)); + // Fix of issue: FS-33 + if(verifiedNoAdmin.contains(player.getName()) || verifiedNoAdminIps.get(player.getName()).contains(FUtil.getIp(player))) + { + return false; + } + + return true; } public boolean isIdentityMatched(Player player)