Sueta
PR

ProvidersLib

0.2.19

Abstract non-Bukkit API from many popular plugins

·Plugin

ProvidersLib
Are you tired of including different plugin API's to your plugin? Or maybe tired of installing many different plugins on your server which do same thing (Actionbar and Title sending)?
Or you just want to make your plugin working absolutely everywhere, like SportBukkit with ActionBarAPI and TitleAPI or PaperSpigot without them?

Then let me introduce you my library, ProvidersLib

It's pretty much like famous Vault plugin from Bukkit site, just provides different functions with bells and whistles

All you have to do is include my plugin's API and install this plugin on your server. No configuration required!

Plugins currently using this API:
- SHub
- BukkitGroovy
- ProvidersLibSpawn (pretty much demonstrates spawnpoint provider)
- (upcoming) Effectials
- All of my plugins (I use Guice library from this plugin)
- If you use this, let me know!

BIG FAT NOTE:

I will listen to your other plugin-related issues in https://git.mikroskeem.eu/mikroskeem/ProvidersLib/issues
Making 1 star reviews with non-constructive reasons will be ignored.

Need help with intregation? All you have to do is ask me nicely on Telegram: https://telegram.me/mikroskeem

WONTFIX things:
-
I won't add Java 7 support. Ever. It is EOL and deal with it.
- I won't add chat color translation. Do it on your own
- I will not add Placeholder plugin support. It is too clumsy to implement that.

Known issues:

Glowstone server

- Actionbar doesn't work at all on Glowstone 1.10.2 build (tested 20/11/2016)
- Title sends without colors using PaperSpigot API method and /glowstone:title command is broken on Glowstone 1.10.2 build (tested 20/11/2016)

- Newer plugin versions don't play good with Glowstone internals at all

Commands

As I am lazy and I use Levitate to register commands, it has one awful bug. It isn't compatible with Essentials items.csv (apparently it uses that to implement one ItemStack syntax or whatever), thus ProvidersLib's commands may not work at all. Either don't enable commands from config, clear Essentials' items.csv or don't use Essentials at all (yes, there are alternatives and I believe everybody can even cook their own).
I am looking into alternatives (looking at Aikar's commands library)

SportBukkit server

This plugin is totally broken on it. It is something related to Guice, but I don't have time to look why it breaks.

Upcoming features in next update:
- More provided APIs
- Way to add custom provider support programmatically (?)

Plugin compatibility chart: https://docs.google.com/spreadsheets/d/13fmBFYrd84otTk9sxRoAw_Z-qz11aVamrU6J5I_-5sk/edit?usp=sharing (OUT OF DATE)

Features:

Actionbar

Plugins which provide Actionbar functionality:

  • ActionBarAPI
  • BountifulAPI
  • TitleManager
  • Spigot's own API (not available under 1.8.8)
  • ProtocolLib
  • Mojang (as of 1.11)

Falls back to no-op method, if any of those couldn't be found

Chat

Plugins which provide Chat functionality:

  • Vault

Falls back to no-op method, if any of those couldn't be found

Permissions

Plugins which provide Permissions functionality:

  • Vault
  • Bukkit's own API

Bukkit's own API is fallback here. It only works with operator status (/op)

Spawnpoint

Plugins which provide Spawnpoint functionality:

  • Multiverse-Core
  • Bukkit's own API

Will fall back to Bukkit API if no other providers are found. Hint: /setworldspawn

Title

Plugins which provide Title functionality:

  • BountifulAPI
  • Mojang (universial, works everywhere)
  • PaperSpigot's own API
  • TitleAPI
  • TitleManager
  • ProtocolLib
  • ProtocolSupport

Falls back to Mojang method (aka /title command)

Vanish

Plugins which provide Vanish functionality:

  • Essentials
  • Super/PremiumVanish

Falls back to no-op provider, which returns always false

Stub plugins

Stub plugins (will replace some plugins completely, without needing to rewrite plugins to use my API)

  • TitleActionbarAPI (obsolete and broken on 1.10+ - but famous Parkour plugin's rewrite uses it)
  • ActionbarAPI (seems like popular plugin)
  • TitleAPI (same goes for here)
  • BountifulAPI (ActionbarAPI + TitleAPI)

Note: stub plugins will activate if original plugin is not installed

Usage:

Get instance in your plugin (and example code)

Get instance in your plugin and example code

@Inject Actionbar actionbar;
@Inject Chat chat;
@Inject Permissions permissions;
@Inject Spawnpoint spawnpoint;
@Inject Title title;
@Inject Vanish vanish;

@Override public void onEnable(){
        RegisteredServiceProvider<
eu.mikroskeem.providerslib.api.Providers> rsp = getServer().getServicesManager()
                .getRegistration(
eu.mikroskeem.providerslib.api.Providers.class);
        if(rsp == null){
            getLogger().severe("ProvidersLib wasn't initialized!");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        Injector injector = rsp.getProvider().getInjector();
        injector.injectMembers(this);
}

@EventHandler
public void on(PlayerJoinEvent event){
    Player player = event.getPlayer();
    actionbar.sendActionbar(player, "asuh dude");
    getLogger.info(chat.getPrefix(player));
    getLogger.info(permissions.playerGetPrimaryGroup(player));
    player.teleport(spawnpoint.getSpawnpoint(world));
}

This plugin is based on Google Guice, so you're not limited to using this example.
See classes in https://git.mikroskeem.eu/mikroskee.../src/main/java/eu/mikroskeem/providerslib/api
for more methods

Test commands

T hey're useful for debugging. It tells you what provider is used and invokes its method.

/testactionbar <player> <seconds> <text>
/testchat <player>
/testpermissions <player> <permission node>
/testspawnpoint <player>
/testtitle <player> <int> <int> <int> <string> <string>
/testvanish <player>
/showprovider (hit tab)


Maven:

Maven repo

Maven repo:

<repositories>
    <repository>
      <id>mikroskeem-repo</id>
      <name>mikroskeem Maven Repository</name>
      <url>https://repo.wut.ee/repository/mikroskeem-repo/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>
Maven include

Maven include:
NOTE: API dependency version won't update that often like plugin is updated. I will say when to update API version in your POM

<dependency>
          <groupId>eu.mikroskeem.providerslib</groupId>
          <artifactId>api</artifactId>
          <version>0.0.5-SNAPSHOT</version>
          <scope>provided</scope>
      </dependency>
Problems with Maven?

PROBLEM 1: People have reported me that my repository doesn't work
(only under Windows?)
SOLUTION: run mvn -U (your project goals)


Jenkins builds: https://ci.wut.ee/job/ProvidersLib/

Stats: https://bstats.org/plugin/bukkit/ProvidersLib

Similar projects

Plugin →