Cross Plugin Compatability
#1
I write a plugin for Bukkit, http://dev.bukkit.org/server-mods/waypoints/

After experiencing just how slow the Java server has been running lately, I've been looking around at alternatives. This one seems like it is my best bet, even with not knowing much about C++.

However, I am slightly concerned about the way plugins are being handled. In LUA is it possible to call another plugin's methods like it is from Java jars? I have a few plugins I'm developing that are modular and would like to keep them that way for organizational and installation purposes.

Also - is there any plans to add alternative language support? LUA is by far not my favorite.

Reply
Thanks given by:
#2
I have not yet thought of a way to call another plugin's method in a safe matter, so no that's not possible yet Sad

There are no plans to add other plugins languages, but do you have a suggestion?
Reply
Thanks given by:
#3
Well I don't know much about C++, however I do very much enjoy programming in C#. I don't know if it'd be possible to do any plugins in this, but it would be nice. Also, Perl would be nice too, I have a dislike for languages that are whitespace dependent after working with Python for so long. I haven't done much work in Lua but it reminds me strongly of Python.

I understand that adding in a new language would be a lot of work, and I certainly don't expect it. I was just curious about the standing of the Lua plugin.
Reply
Thanks given by:
#4
AFAIK Lua is nothing like Python, so don't worryTongue
Reply
Thanks given by:
#5
is the wiki page up to date with all hooks or is there a source file somewhere that contains all the hooks?

Also is there a documentation for all methods we have access too through the plugin interface?
Reply
Thanks given by:
#6
The wiki is slightly outdated, Taugeshtu was working on updating it, but I guess we overwhelmed him with too many changes.

All the hooks are in the cPluginManager class, note that the are only declared there, some may not be called (handshake?)
The entire API is in the Bindings and ManualBindings sourcefiles, at the very end of those files (tolua_AllToLua_open(), ManualBindings::Bind() ) Note that the Bindings sources are automatically generated and may (and do) change quite often.

That said, if you feel that an API is missing something (which it definitely is) and you believe it would be very useful, feel free to ask for it. Usually FakeTruth or I add API calls on request because we might not consider it useful at first, but need a use-case scenario from a third party to convince us.
A side note on cross plugin: You can do strict code-sharing (think "code library" - same LUA file used by several plugins, each one imports the file and can use its functions), but you cannot do data-sharing (think generic "money" plugin talking to "mob carcass selling" plugin)
Reply
Thanks given by:
#7
Didn't get a chance to look to closely, but is database storage implemented for plugins?

If we had databases cross plugin communication could be simplified quite a bit.

Also. Is there some way to stop a script from "cancelling" the event by returning a value? I read somewhere returning a true (or false maybe?) from the hook cancels the rest of the plugins.

All plugins should be given a chance to break your server, in my opinion at least.

Say we breed two cows.

We have 2 plugins that work off a breeding event hook.
1. Cancels the spawn if to many npcs exist in 2 chunks. (Just an example)
2. Has a chance to spawn a mooshroom from breeding 2 cows. (Mutations)

Scenario 1
Say plugin 1 detects you have to many animals and cancels the event. However plugin 2 will not attempt to spawn it.
This is fine, maybe not quite desirable, but it works.

Scenario 2
Say plugin 2 runs first and spawns a mooshroom. It would then proceed to cancel the event. Plugin 1 will not limit this spawn because it would not run.
This is a no-go, it should still be able to prevent spawning.

Now these are just examples and may not be 100% realistic, but there is certainly more opportunities for modular plugins where things like this could break.

Speaking of which, do we even get a breed event hook yet?
Reply
Thanks given by:
#8
Quote:is database storage implemented for plugins?
Yes and no. You may use cIniFile (I believe it's up to r600) for configuration stuff and Lua's io class.

Quote:Is there some way to stop a script from "cancelling" the event by returning a value?
Yes. Just return false - you plugin's code will proceed, but you won't break default server behaviour.
You may also think about plugins' order - the order they are declared in .ini is the order they are loaded and order they are executed. And the order they handle hooks' callbacks and cancel execution. Simple and powerful.
Reply
Thanks given by:
#9
My brother is learning php on school so i was thinking, is it possible to make php plugins for mc-server if php was implemented, and would they only be able to make a website or would they also be able to make the gameplay different? does anyone know?
Reply
Thanks given by:
#10
Anything is possible of course, but I don't really feel like adding PHP to the list of supported scripting languages. Lua (or Squirrel even) is good enough and probably better suited for MCServer
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)