What is the best way to make plugin for both spigot and bungee?

Discussion in 'Spigot Plugin Development' started by Azim, Dec 19, 2019.

  1. What is the best way of creating a plugin, which will load on both bungeecord and spigot? Is it possible? Is it worth creating a duplicate of your plugin for a few of bungeecord users?
  2. You need two separate entry points, one for bungee and one for spigot.

    Use plugin.yml for your spigot entry point and bungee.yml for your bungee entry point.

    You just need to be careful to not use bukkit/spigot api while developing your bungee side of the plugin and vice versa.
    • Friendly Friendly x 1
  3. Bungee is NOT a minecraft server, why would you create a plugin that works on both softwares?
    • Funny Funny x 1
  4. That's an utility plugin, which allows remote command execution via telegramm bot. (you can look it up in my profile)
    Some users have been reasonably requesting me to add bungee support, so they can have just one bot instance per server group, instead of making one bot per one bukkit/spigot server

    Oh, as simple as that? Awesome. Thank you very much, i will give it a try.
  5. MiniDigger


    Why not? If you abstract away the apis, your plugin can do the same thing on the proxy as it can do on the backend server
  6. Should i create one wrapper class and just have all the stuff there, or should i instead create separate package with multiple wrappers? What is a better long-term solution?
  7. It depends on how big your plugin is, but I think best solution is a multi-module project. Common code is in one module and platform specific code is in their own modules. Maven and Gradle both support multi-module projects. - Main benefit is that you don't need to worry about using wrong platform's classes in the code.

    I've used an approach where the platform classes are abstracted behind some arbitrary interfaces (in my case they have Bukkit-like methods) - In addition you might want to separate the functionality of the plugin away from platform related classes (eg. don't create necessary objects inside JavaPlugin, but create a new class that can be used on by both platforms).

    Having the platform abstractions as a different artifact from the plugin code is a bit bothersome though (Some code I don't use is still there), so you might want to code them for what your plugin needs (eg. don't abstract away world code if you just need commands).
  8. I will look it up, thanks
    • Useful Useful x 2