From d34d774307d89e68e401bdb0f3531478bd3f1984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20B=C3=BCrklin?= Date: Wed, 6 Oct 2021 15:46:31 +0200 Subject: [PATCH 1/3] Fix NPE --- src/main/java/me/libraryaddict/disguise/DisguiseConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java b/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java index e354e47f..db4279be 100644 --- a/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java +++ b/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java @@ -687,7 +687,8 @@ public class DisguiseConfig { DisguiseUtilities.getLogger().warning("Cannot parse '" + config.getString("UpdatesBranch") + "' to a valid option for UpdatesBranch"); } - PermissionDefault commandVisibility = PermissionDefault.getByName(config.getString("Permissions.SeeCommands")); + String seeCommands = config.getString("Permissions.SeeCommands"); + PermissionDefault commandVisibility = seeCommands == null ? null : PermissionDefault.getByName(seeCommands); if (commandVisibility == null) { DisguiseUtilities.getLogger() From ffe78c8f376447b92db26f3bf2620a165af6348d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20B=C3=BCrklin?= Date: Wed, 6 Oct 2021 15:47:36 +0200 Subject: [PATCH 2/3] Fix invalid dependency version for ProtocolLib and Lombok version that produces a compiler error if not updated --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index fd35b8fe..ea688b8c 100644 --- a/pom.xml +++ b/pom.xml @@ -96,8 +96,8 @@ UTF-8 9.0 - 1.18.16 - 4.7.0-SNAPSHOT + 1.18.20 + 4.7.0 [1.17,] 4.13.1 [1.16,] From 3595f859fe1f6b427b0f9bfa6d636ad8e438c3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20B=C3=BCrklin?= Date: Wed, 6 Oct 2021 15:48:22 +0200 Subject: [PATCH 3/3] Fix not detecting classes when spigot is launch-wrapped. --- .../utilities/reflection/ClassGetter.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ClassGetter.java b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ClassGetter.java index 010d0893..f5930aa2 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/reflection/ClassGetter.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/reflection/ClassGetter.java @@ -51,19 +51,23 @@ public class ClassGetter { // Get a File object for the package CodeSource src = runFrom.getProtectionDomain().getCodeSource(); - if (src != null) { URL resource = src.getLocation(); - - if (resource.getPath().toLowerCase(Locale.ENGLISH).endsWith(".jar")) { + boolean isInsideJar = resource.getPath().toLowerCase(Locale.ENGLISH).contains(".jar!") && resource.getPath().toLowerCase(Locale.ENGLISH).endsWith(".class"); + if (resource.getPath().toLowerCase(Locale.ENGLISH).endsWith(".jar") || isInsideJar) { processJarfile(resource, pkgname, classes); } else { - for (File f : new File(resource.getPath() + "/" + pkgname.replace(".", "/")).listFiles()) { - if (f.getName().contains("$")) { - continue; - } + File[] baseFileList = new File(resource.getPath() + "/" + pkgname.replace(".", "/")).listFiles(); + if (baseFileList != null) { + for (File f : baseFileList){ + if (f.getName().contains("$")) { + continue; + } - classes.add(pkgname + "/" + f.getName()); + classes.add(pkgname + "/" + f.getName()); + } + } else { + System.out.println("File not found for: " + resource.getPath() + "/" + pkgname.replace(".", "/")); } } }