From e10239f6864e9633db0cc63425bc3749ad36b848 Mon Sep 17 00:00:00 2001 From: mrlolethan Date: Sun, 1 Mar 2015 13:14:10 -0330 Subject: [PATCH 1/2] Fix NoClassDefFoundError being thrown on enable when Vault isn't loaded. --- src/main/java/com/massivecraft/factions/P.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/P.java b/src/main/java/com/massivecraft/factions/P.java index 26281734..76c9d271 100644 --- a/src/main/java/com/massivecraft/factions/P.java +++ b/src/main/java/com/massivecraft/factions/P.java @@ -117,8 +117,12 @@ public class P extends MPlugin { } private boolean setupPermissions() { - RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Permission.class); - perms = rsp.getProvider(); + try { + RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Permission.class); + perms = rsp.getProvider(); + } catch (NoClassDefFoundError ex) { + return false; + } return perms != null; } From 74fb2c8b7dfa4ae6ef49a6e67d47bb111cffeaf6 Mon Sep 17 00:00:00 2001 From: mrlolethan Date: Mon, 2 Mar 2015 17:54:46 -0330 Subject: [PATCH 2/2] Check for null rsp when loading Vault perms. Also replace tabs with spaces. --- src/main/java/com/massivecraft/factions/P.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/P.java b/src/main/java/com/massivecraft/factions/P.java index 76c9d271..0c10cd64 100644 --- a/src/main/java/com/massivecraft/factions/P.java +++ b/src/main/java/com/massivecraft/factions/P.java @@ -118,10 +118,12 @@ public class P extends MPlugin { private boolean setupPermissions() { try { - RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Permission.class); - perms = rsp.getProvider(); + RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Permission.class); + if (rsp != null) { + perms = rsp.getProvider(); + } } catch (NoClassDefFoundError ex) { - return false; + return false; } return perms != null; }