From 8b9112c2da494b7e072809ecae6b9a8857c95ea4 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Tue, 8 Aug 2017 17:03:23 +0200 Subject: [PATCH] Factions integration bugfix. Verify that the Factions plugin is the official MassiveCraft Factions plugin and not the outdated FactionsUUID. --- .../PredicateIntegrationFactions.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/com/massivecraft/massivecore/predicate/PredicateIntegrationFactions.java diff --git a/src/com/massivecraft/massivecore/predicate/PredicateIntegrationFactions.java b/src/com/massivecraft/massivecore/predicate/PredicateIntegrationFactions.java new file mode 100644 index 00000000..35000a55 --- /dev/null +++ b/src/com/massivecraft/massivecore/predicate/PredicateIntegrationFactions.java @@ -0,0 +1,32 @@ +package com.massivecraft.massivecore.predicate; + +import com.massivecraft.massivecore.Integration; + +/** + * This class is supposed to be used together with the class {@link Integration}. + * This is a predicate that simply checks whether the MassiveCraft Factions plugin is installed. + * + * Why not just check for the plugin name "Factions"? + * Because FactionsUUID and other forks exists and use our name. + * So with that in mind we must check it's actually the real Factions that we support. + */ +public class PredicateIntegrationFactions extends PredicateIntegration +{ + // -------------------------------------------- // + // INSTANCE & CONSTRUCT + // -------------------------------------------- // + + private static PredicateIntegrationFactions i = new PredicateIntegrationFactions(); + public static PredicateIntegrationFactions get() { return i; } + + // -------------------------------------------- // + // OVERRIDE > PREDICATE + // -------------------------------------------- // + + @Override + public boolean apply(Integration type) + { + return isPluginNamePresent("Factions") && isClassNamePresent("com.massivecraft.factions.engine.EnginePower"); + } + +}