[WIP] [Testing] Injector

Discussion in 'WIP and Development Status' started by Goblom, Jun 11, 2014.

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

    Goblom

    Injector

    What is injector?
    Injector is the tool that can be used for almost any task. It can be used to load commands in your server, or load a plugin without having that pesky plugin.yml or jar file.

    Injector can inject literally any class file into bukkit, as long as said file extends "Injectable".

    What is so useful about Injector?
    Well, if you are like me, then sometimes plugins can be a hastle when all your plugin is doing is adding a command. Injector makes it so that no plugin is needed, just extends "InjectableCommand" fill in the abstract methods, compile then place the compiled file inside the Injectors datafolder.

    That is it... Extremely simple, Injector will load and register the command for you, no plugin.yml no yaml errors, plus its configurable.

    Injector can also inject plugins for those of you are lazy (like me)... You do not need a plugin.yml or a jar file. Just do the exact same thing you do for InjectableCommand except you want to extend InjectablePlugin. With the InjectablePlugin you can do anything a normal plugin can do, want a minigame, sure, want some fun events, injector can do that, want to make a utility plugin, go right ahead. The possibilities are endless!

    Those steps again to inject a command or a plugin...
    1. Extend InjectableCommand or InjectablePlugin
    2. Fill in the abstract methods
    3. Compile the file
    4. Place the newly compiled class file into plugins/Injector/
    Well, what else can it do?
    Injector can inject any file you want, may it be a small Utils class, or a large file, does not matter. In order to inject a file it needs to extend Injectable, then just go on right ahead, the Injectable file will do everything for you.
    Injector also has a Configurable class, to make a injectable configurable file, just extend Configurable instead of Injectable.

    All files that are extendable that are used with Injector...
    • Configable ---> Class can be configured with a yaml file, Injectable replacement
    • Informable ---> Class has specific information regarding website, author, version
    • Injectable ---> The main file that MUST be extended in order for injector to work
    • Unloadable ---> The injected file can be unloaded (like a plugins onDisable())
    • InjectableCommand ---> Injects a command into bukkit to be used as a normal command
    • InjectablePlugin ---> Injects a plugin into bukkit that acts like a normal plugin
    What is in store for the future?
    Well, that is really up to you guys. I plan to keep this updated with bugs fixes and improvements, but i have basically exhausted all my ideas for what Injector can do (those being commands and plugins). So, if you want stuff added, fixed, or improved then open your mouth and say something.

    Source: https://github.com/Goblom/Injector
    Release Date: TBA


    If you wish to test Injector before it is released please send me a private message with a description of what you would use it for. I will consider sending it you after that.
     
    DJSkepter, Vexil and KingFaris11 like this.
  2. Offline

    ObiCrowe

    Oh my goodness!!! That's amazing! :O :D :) I'm speechless. I...I..
    In all seriousness, well done!
     
    Goblom likes this.
  3. Offline

    Goblom

    I will be looking into being able to inject WorldGenerator... just need to research it a little
     
  4. Offline

    RawCode

  5. Offline

    Goblom


    That is not exactly how im looking to do it.. I need to be able to get where bukkit looks for the world generator that is specified and add Injectors list to the list that bukkit looks for, not just set the world generator
     
  6. Offline

    RawCode

    you can follow classes in work and get info you want Goblom
     
  7. Offline

    zombiekiller753

    Goblom
    Sounds interesting. Can I help out? You know I <3 this Reflection and NMS stuff
     
  8. Offline

    nmacholl

    Do injected plugins still show up in the /plugins list?
     
  9. Offline

    Goblom

    nmacholl Yes... They act and work just like a normal plugin.
     
  10. Offline

    Dunsuro

    Goblom

    I'm not sure if I understand the goal of this project. From what I can tell, this plugin merely takes class files that extend some form of "Injectable" and then loads them as if they were compiled into normal plugin form. While this does sound intriguing, I simply can't see the why injector is better than the normal bukkit method.

    For example, you mentioned a situation in which a developer might want to add a single command to the server. Your reasoning for choosing Injector over the typical bukkit plugin setup is that it requires none of the usual hassle of actually making the plugin. This led me to think, is it really a hassle
    to make a plugin that adds one command?​

    To this end, I started doing some math. I understand that you don't need the plugin.yml with injector, but that file is essentially seven lines long with just a single command. In addition, actually compiling the code into a jar file of one's own is as simple as two clicks. It is a fact that the main class will take up space, but the same is undoubtedly true about the​
    abstract methods that must be filled in with an injector command. Because of this, the onCommand method, which would most likely be situated in our main class for a simple single-command plugin like this, can be essentially ignored in the line count. To add in the onEnable and onDisable might raise our total line count to twenty if we throw in some logging or something of that sort.

    Is twenty lines really that much more of a hassle? Granted, I could be entirely wrong about the function of this plugin, but I fear that it simply lacks a definite advantage over the traditional plugin loading system. Perhaps you could explain some of the benefits of injector to the traditional jar format?

    [EDIT] I tried to fix the spacing in this post, but it wouldn't work.
     
  11. Offline

    Goblom


    I value your input and I feel you hit it right on the dot...

    There is no absolute definitive reason to use this over a normal jar file. All this really does is add the ability to enable plugins (without a jar or plugin.yml) from anywhere that bukkit can read, it can load and register complex or simple commands, it can load almost anything you want into bukkit...

    Although, there is a big upside to using this. (I will use commands as an example because its better explained)

    Sometimes i have found that writing commands can be a little tricky, like you mess up some words or you incorrectly use the arguments and you need a quick fix... Instead of recompiling the entire plugin and loading it back onto your server or test server you would only have to replace a single file. Then Injector will reload that single file, instead of your entire plugin, so its like a simpler way to test your stuff.

    Write the command on Injector, then when you have it just right add it to your own plugin... This is like a plugin to help you test your plugins, or just add a bunch of weird things to your plugin.


    I also forgot to mention in the main post because im not sure if i am going to do it or not...

    Injector will also be able to dynamically compile .java classes, so you wouldnt have to compile them yourself, you can edit your files on the go, etc.

    It might also support lua and python if i ever get around to it as well.
     
  12. Offline

    Dunsuro

    Goblom

    Ahh, I didn't think about the ability to edit a single file at a time. This would indeed be nice, as you pointed out, because the developer wouldn't have to spend extra time recompiling the entire jar for a single class. With this in mind, I would argue that the auto-compilation of .java classes that you mentioned as a potential future-function would be necessary for the true efficiency of the plugin. With that, one could simply use a text editor to work on the single class, press save, and then "inject" it into the game. The alternative of using .class files would require the compilation of each .java file before injection, which just seems to take away from the efficiency that the plugin is striving for.

    Supporting other languages would also be interesting to see.

    Thanks for the clarification mate, and I'm glad to see that injector does indeed have worth as a development utility. I'll be sure to give it a try when it is released.
     
    ZeusAllMighty11 and Goblom like this.
  13. Offline

    RawCode

    only reason to hotplug classes\code to server is development of something.

    you may develop some plugin and hotfix code without restarting\reloading.

    but...

    there is agent feature and reinstrumentation buildin into JDK for this, adding one more layer just to implement feature already available?
     
  14. Offline

    D4rkz

    I'm looking forward to this :)
     
Thread Status:
Not open for further replies.

Share This Page