Solved Mods for a plugin ?

Discussion in 'Plugin Development' started by Betagear, Dec 10, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Betagear

    Hi.
    Just wanted to know if it is possible to make mods for a plugin :
    The mods would change the way some functions reacts, and if there is not the plugin would use the default functions.
    It could be used for creating translation pack or gameplay alternators in my plugin.
    Thanks, share your knowledge if you know it !
     
  2. Offline

    mcdorli

    you mean addons
     
  3. Offline

    Betagear

  4. Online

    timtower Administrator Administrator Moderator

    @Betagear Mod = modifications.
    Addon = addition.
    One replaces, other one adds.
    You need to have a plugin that is able to have extended functionality. Most plugins don't offer that.
     
  5. Offline

    Betagear

    @timtower Ok. Any idea of how I can do this ?
     
  6. Offline

    mcdorli

    Easiest would be to decompile the plugin and edit what you need. Or you can recreate it too.
     
  7. Offline

    Betagear

    @mcdorli Yep, but if the main engine gets modified, I would need to update all the modded versions.
     
  8. Offline

    mcdorli

    Yup
     
  9. Online

    timtower Administrator Administrator Moderator

    @Betagear Depends on the plugin and how it is made
     
  10. Offline

    Betagear

    @timtower Just allow the plugin to use a jar with whatever name, and if he founds it, it searches the var it stores to see what the mod can do. Then it calls the mod's functions instead of the native ones.
     
  11. Online

    timtower Administrator Administrator Moderator

    @Betagear That is only possible by overriding the plugin itself, pretty much comes to the point where you decompile and modify it.
     
  12. Offline

    Betagear

    @timtower Can't be using another jar in an API-like way ?
     
  13. Online

    timtower Administrator Administrator Moderator

    They can, but you will be using the other plugin, which will also be loaded due to Bukkits way of doing things.
    What you are asking requires a plugin that supports it from the start.
     
  14. Offline

    Betagear

    @timtower Of course, the dependencies would be coded for it.
     
  15. Offline

    mythbusterma

  16. Offline

    Betagear

  17. Offline

    mythbusterma

    @Betagear

    I still don't even know what you're trying to accomplish.
     
  18. Offline

    Betagear

    @mythbusterma Use an API-like integration to extends the behavior of a plugin to a certain event.
    By exemple when a player dies :
    - By default it would be he respawns normally using a function called Respawn();
    - If an extension is detected, then it runs the Respawn(); function of the extension instead of the default one.
     
  19. Offline

    mythbusterma

    @Betagear

    First of all, a function doesn't have an upper-camel-case name. Second, you can just detect if the plugin is present, and execute one of two paths based on that.
     
  20. Offline

    Betagear

    @mythbusterma Thanks. That's all I wanted.
    Do you know how I can do that with code ?
     
  21. Offline

    mcdorli

    If the plugin allows that (like when you override the onEnable method) then go ahead, and do it. If it doesn't, then you need to decompile it and manually edit it. Other than that, you could try @mythbusterma's solution
    That's PascalCase
     
  22. Offline

    Betagear

    @mcdorli It's my plugin so it would be ok for allowing it, but I don't know how to allow it.
     
  23. Offline

    mcdorli

    If it is your plugin, then you could also just edit it. Making it allow for modding is not the easiest. You could do like "if the xyz plugin is enabled, then do this and this, else do that" in it.
     
  24. Offline

    Betagear

    @mcdorli I was talking about the code. Javascript isn't that simple, sadly.
     
  25. Online

    timtower Administrator Administrator Moderator

    @Betagear It isn't Javascript, it is Java.
    And your plugin has to be rebuild for this purpose, or you just use Bukkit and install a different plugin that changes some stuff without looking at other plugins.
     
  26. Offline

    mcdorli

    Please, never say that again. If you don't knkw the difference between java and javascript, then please, learn more. And making the plugin moddable would be hard, yes.
     
  27. Offline

    Betagear

    @mcdorli I meant Java, sorry. I used to dev in Javascript for websites in the past, so please excuse my confusion. I think I will do the mod-thing using metadatas handled by multiple plugins.
     
  28. Offline

    MisterErwin

    @Betagear Instead of calling methods in such an "addon".
    How about using custom events (That way you do not have to implement the class loading, the "addons" would be "normal" plugins (extending JavaPlugin) and just listen to your custom events)
     
  29. Offline

    Betagear

    @MisterErwin Oh thanks a lot ! I'll do it, and if it works i'll tell you.
     
  30. Offline

    mcdorli

    You could also use reflection, I think.
     
    Zombie_Striker likes this.
Thread Status:
Not open for further replies.

Share This Page