ArcanePlugins / ArcaneFramework

Shaded plugin development library for ArcanePlugins software.
GNU General Public License v3.0
3 stars 1 forks source link

Add a 'Support Checker' system notifying the console if the plugin is supported on the server #6

Closed lokka30 closed 2 years ago

lokka30 commented 2 years ago

Allow a plugin to declare a list of supported MC versions, unsupported plugins, etc.

new SupportCheckerBuilder(Plugin)
    // plugin works from 1.7 - 1.19. auto generates varargs via fromRange
    .withCompatibleVersions(CraftVersion.fromRange(CraftVerison.1_7, CraftVersion.1_19))

    // only 1.18 and 1.19 are supported
    .withSupportedVersions(CraftVersion.1_18, CraftVersion.1_19) 

    // any unsuppored classpaths
    // if reflection detects these exist then the plugin will not be happy
    // e.g. classpaths of unsupported plugins
    .withUnsupportedClasspaths(
        new String[]{
            // title of the issue
            "LevelledMobs", 

            // description of issue
            "Plugin is too awesome",

            // classpaths
            "me.lokka30.levelledmobs.LevelledMobs", // LM1, LM2, LM3
            "me.lokka30.levelledmobs.plugin.bukkit.LevelledMobs" // LM4
        },
        new String[]{
            "SleepFixer",
            "Plugin is too lightweight",
            "me.lokka30.sleepfixer.SleepFixer"
        },
        new String[]{
            "Bukkit",
            "no idea",
            "org.bukkit.Bukkit"
        }
    )
    .checkAll();
lokka30 commented 2 years ago

allow 'minimum java version' checking through:

Float.parseFloat(System.getProperty("java.specification.version"))

// java 8: 1.8
// java 18: 18
// etc
lokka30 commented 2 years ago

done