@Override and other plugins

Discussion in 'Plugin Development' started by 4am, May 16, 2011.

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

    4am

    Is it possible for my code to @Override a function in another plugin if I detect that it is loaded? I want to be able to add extra processing to something and then call super() and let the original behavior (from the other plugin) continue, kind of like an add-on plugin, if you will. Is this possible if the function in question is public? Or would I need to fork and recompile the original plugin in its entirety?
     
  2. Offline

    Jayjay110

    Interesting, that would be very good indeed
     
  3. Offline

    Shamebot

    The only way I know of is inheriting from that class, overriding the method and copy the variables of the old class to the new one.
    I'm not a java pro, and when I googled for something like "hotswap" a while ago I found only some weird stuff.
     
  4. Offline

    4am

    Well that's simple enough, that's exactly what @Override does; I'd make a subclass of the original in the plugin and then @Override the public functions with my own; I've realized though that when the plugin i mean to override it hits onEnable() it will load it's own classes, not my own subclass versions. The pluigin would need to be designed with the Bukkit event model in mind and post custom events which I can cancel if I choose, then take my own action by calling public functions the original plugin makes avalible. HeroChat, actually, is just like this.

    Forcing someone else's code to load my subclass instead of their own class doesn't seem like a realistic possibility unless I fork and compile my changes into a whole new plugin. The more I think about it, the easier it would be for one program in Java to just take over another one; it'd be ripe with malware.

    Let's convince @DThielke to write a tutorial so everyone can design their plugins with extensibility in mind:)

    Then we'll really start to stretch the flexibility of Bukkit! Or create a sea of horrible plugin spaghetti. Either one, really;)
     
Thread Status:
Not open for further replies.

Share This Page