Skip to content

Commit

Permalink
fix: try-catch ProtectionLib#init
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed May 8, 2024
1 parent 3096b54 commit 4d25e84
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pluginVersion=1.5.4
pluginVersion=1.5.7
54 changes: 45 additions & 9 deletions src/main/java/io/th0rgal/protectionlib/ProtectionLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,51 @@ public class ProtectionLib {

@SuppressWarnings("Convert2MethodRef")
public static void init(JavaPlugin plugin) {
handleCompatibility("WorldGuard", plugin, (m, p) -> new WorldGuardCompat(m, p));
handleCompatibility("Towny", plugin, (m, p) -> new TownyCompat(m, p));
handleCompatibility("Factions", plugin, (m, p) -> new FactionsUuidCompat(m, p));
handleCompatibility("Lands", plugin, (m, p) -> new LandsCompat(m, p));
handleCompatibility("PlotSquared", plugin, (m, p) -> new PlotSquaredCompat(m, p));
handleCompatibility("CrashClaim", plugin, (m, p) -> new CrashClaimCompat(m, p));
handleCompatibility("GriefPrevention", plugin, (m, p) -> new GriefPreventionCompat(m, p));
handleCompatibility("HuskClaims", plugin, (m, p) -> new HuskClaimCompat(m, p));
handleCompatibility("BentoBox", plugin, (m, p) -> new BentoBoxCompat(m, p));
try {
handleCompatibility("WorldGuard", plugin, (m, p) -> new WorldGuardCompat(m, p));
} catch (Exception | NoClassDefFoundError e) {
if (debug) e.printStackTrace();
}
try {
handleCompatibility("Towny", plugin, (m, p) -> new TownyCompat(m, p));
} catch (Exception | NoClassDefFoundError e) {
if (debug) e.printStackTrace();
}
try {
handleCompatibility("Factions", plugin, (m, p) -> new FactionsUuidCompat(m, p));
} catch (Exception | NoClassDefFoundError e) {
if (debug) e.printStackTrace();
}
try {
handleCompatibility("Lands", plugin, (m, p) -> new LandsCompat(m, p));
} catch (Exception | NoClassDefFoundError e) {
if (debug) e.printStackTrace();
}
try {
handleCompatibility("PlotSquared", plugin, (m, p) -> new PlotSquaredCompat(m, p));
} catch (Exception | NoClassDefFoundError e) {
if (debug) e.printStackTrace();
}
try {
handleCompatibility("CrashClaim", plugin, (m, p) -> new CrashClaimCompat(m, p));
} catch (Exception | NoClassDefFoundError e) {
if (debug) e.printStackTrace();
}
try {
handleCompatibility("GriefPrevention", plugin, (m, p) -> new GriefPreventionCompat(m, p));
} catch (Exception | NoClassDefFoundError e) {
if (debug) e.printStackTrace();
}
try {
handleCompatibility("HuskClaims", plugin, (m, p) -> new HuskClaimCompat(m, p));
} catch (Exception | NoClassDefFoundError e) {
if (debug) e.printStackTrace();
}
try {
handleCompatibility("BentoBox", plugin, (m, p) -> new BentoBoxCompat(m, p));
} catch (Exception | NoClassDefFoundError e) {
if (debug) e.printStackTrace();
}
}

public static void setDebug(boolean debug) {
Expand Down

0 comments on commit 4d25e84

Please sign in to comment.