-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Simple Plugin System #972
base: master
Are you sure you want to change the base?
Conversation
I think plugin.yml is essential for a plugin. It allows you to quickly identify whether a Jar is a plugin, and you can browse it to get some basic information about a plugin. |
Well, you're right. But I'm trying to provide another way that can be accepted by people. Also, for those who doesn't know PluginAnnotations, it's convenient, isn't it? |
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
//simple load Plugin | ||
@Override | ||
public Plugin simpleLoadPlugin(File file) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the core part of loading the simple plugin, initializing the plugin information.
Useless... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless...
Um.... This is an unusual design... It’s normal to not be accepted, why not try it? You may have different ideas, thank you very much!
return simpleLoadPlugin(new File(fileName)); | ||
} | ||
|
||
private Class getSimplePlugin(File file){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get and complete the auto-enrollment section
I think an annotation plugin system could be cool, but as mentioned earlier with the way you've set it up, I personally do not believe this is the right approach. Imo, this kind of stuff should be done by an annotation processor instead. |
In my opinion,it is significant of plugin design mode improve.Admittedly,Someone feels it break up what they framework or custom of plugin.Notheless annotation are still decline green hand's difficultly of introduction and provide a way to avoid some wrong. |
Hello? I don't know why you guys don't believe it, but it's providing a brand new way that efficient and convenient, and it has NO EFFECT on plugin.yml. |
I’m not saying this is a bad idea (I actually like the idea believe it or not), it’s more or less the way it’s being executed. Using an annotation processor allows for this system to still be in place, but also allows for the plugin.yml to be created. The project wode mentioned earlier does this well, and I believe that’s the better way for this annotation system to work. |
Thank you,I respect your opinion.But... You can just use it as a tool to simplify development, it is not intended to replace this system In terms of instructions, I use redirection so that I don't need to judge the command through "if", and maintenance in the later period makes the code more conditioning. On the listener, the automatic registration method can more easily add and cancel the listener. The benefits are: And I Add SomethingOf course, if you still use plugin.yml (that is, without the @main annotation), you can also use any of them (except @main) OthersYou can use the AutoPlugin annotation to inject objects of the main class, which was recently added based on a simple plugin system package net.noyark.www;
import cn.nukkit.command.Command;
import cn.nukkit.command.CommandSender;
import cn.nukkit.plugin.Plugin;
import cn.nukkit.plugin.simple.AutoPlugin;
public class MyCommand extends Command {
@AutoPlugin
private Plugin plugin;
public MyCommand() {
super("hello01","test");
}
@Override
public boolean execute(CommandSender commandSender, String label, String[] strings) {
plugin.getLogger().info("233");
return true;
}
} Of course, this is just my personal opinion. |
…rough this annotation
I like the ideea and how it is looking, but i think will be a perfect way to just rewrite all plugin section and make another PR. I like your addons, but now code is too much and it's not cleaned up. My recommandation, as 5 years player of minecraft (or maybe much more) and 3 years of programming minecraft, i suggest you to clean up all and remake plugin system. Thank you for all. I think @SupremeMortal and @Creeperface01 is agree with me. If you can do that, you are a really good man and implicated, what i like on people. |
OK,I will do it when I have time |
Please read the full description
No cancellation of the original plugin system, still compatible with all previous plugins
Has been tested and is working fine, the command can also run normally
You can develop the nukkit plugin without using plugin.yml and it is compatible with the original plugin system.
This system will trigger without plugin.yml
the log:
The simple plug-in system is made to simplify plug-in development and reduce plug-in development coupling and reduce plug-in maintenance costs. It will make the plug-in more organized and easier to migrate and modify.
Simple plugin system is composed of 7 annotations and can be used with plugin.yml at the same time
All features here have been tested and working properly, no matter for other plugins
How to use SimplePlugin
SimplePlugin is created to simplify the development of plug-ins and coexist with the original plug-in system. When the plug-in does not have plugin.yml, it will launch the plug-in format of SimplePlugin.
Of course, if you still use plugin.yml (that is, without the @main annotation), you can also use any of them (except @main)
SimplePlugin relies on reflection to implement automatic scanning of the main class, which is determined by @main annotation
@main has a lot of options
Simplified instructions provide multiple ways
Multiple parameters
Realize automatic listener registration, of course, you can choose which auto and which need, the listener will automatically register after onEnable, use @EnableRegister method
You can directly get the main class object through this annotation
such as
Thanks for adoption