From 6f66957b17bc981490bc78f74493d11987463ce8 Mon Sep 17 00:00:00 2001 From: abhiram Date: Sun, 28 Feb 2021 21:08:39 +0530 Subject: [PATCH 1/4] 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) From d6b74a76bbc139eeab255f192b7daaa085a1555d Mon Sep 17 00:00:00 2001 From: abhiram Date: Sun, 28 Feb 2021 21:28:20 +0530 Subject: [PATCH 2/4] [+] Fix of FS-33 --- .../java/me/totalfreedom/totalfreedommod/admin/AdminList.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java index fa4797e6..b7e81c14 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java @@ -241,7 +241,7 @@ public class AdminList extends FreedomService public boolean isVerifiedAdmin(Player player) { // Fix of issue: FS-33 - if(verifiedNoAdmin.contains(player.getName()) || verifiedNoAdminIps.get(player.getName()).contains(FUtil.getIp(player))) + if(verifiedNoAdmin.contains(player.getName()) || verifiedNoAdminIps.containsKey(player.getName()) && verifiedNoAdminIps.get(player.getName()).contains(FUtil.getIp(player))) { return false; } From c29b312101eda66e246a9c198d3e66387c44469c Mon Sep 17 00:00:00 2001 From: abhiram Date: Tue, 2 Mar 2021 23:11:17 +0530 Subject: [PATCH 3/4] [+] Remove .idea --- .gitignore | 1 + .idea/checkstyle-idea.xml | 16 ---- .idea/codeStyles/Project.xml | 28 ------ .idea/codeStyles/codeStyleConfig.xml | 5 -- .idea/compiler.xml | 17 ---- .idea/encodings.xml | 8 -- .idea/misc.xml | 20 ----- .idea/uiDesigner.xml | 124 --------------------------- .idea/vcs.xml | 6 -- 9 files changed, 1 insertion(+), 224 deletions(-) delete mode 100644 .idea/checkstyle-idea.xml delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/uiDesigner.xml delete mode 100644 .idea/vcs.xml diff --git a/.gitignore b/.gitignore index c0ab2daf..6f537952 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ manifest.mf /.idea/workspace.xml /.idea/uiDesigner.xml /.idea/libraries +/.idea *.iml # Maven excludes diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml deleted file mode 100644 index 658f1529..00000000 --- a/.idea/checkstyle-idea.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 9898a0e5..00000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 0f7bc519..00000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 58d3e434..00000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 0400b665..00000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 99aec2a9..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index e96534fb..00000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddf..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From 85c35f25a356c16328e35e849017234a66cf7cb8 Mon Sep 17 00:00:00 2001 From: abhiram Date: Wed, 3 Mar 2021 06:47:22 +0530 Subject: [PATCH 4/4] [+] Fix codacy issue --- .gitignore | 1 - .../me/totalfreedom/totalfreedommod/admin/AdminList.java | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 6f537952..c0ab2daf 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,6 @@ manifest.mf /.idea/workspace.xml /.idea/uiDesigner.xml /.idea/libraries -/.idea *.iml # Maven excludes diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java index b7e81c14..c2b1f458 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/AdminList.java @@ -240,13 +240,8 @@ public class AdminList extends FreedomService public boolean isVerifiedAdmin(Player player) { - // Fix of issue: FS-33 - if(verifiedNoAdmin.contains(player.getName()) || verifiedNoAdminIps.containsKey(player.getName()) && verifiedNoAdminIps.get(player.getName()).contains(FUtil.getIp(player))) - { - return false; - } - - return true; + // Fix of issue FS-33 + return !verifiedNoAdmin.contains(player.getName()) || verifiedNoAdminIps.containsKey(player.getName()) && !verifiedNoAdminIps.get(player.getName()).contains(FUtil.getIp(player)); } public boolean isIdentityMatched(Player player)