Posts: 5
Threads: 2
Joined: May 2012
Thanks: 0
Given 0 thank(s) in 0 post(s)
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.
Posts: 5
Threads: 2
Joined: May 2012
Thanks: 0
Given 0 thank(s) in 0 post(s)
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?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
07-09-2012, 03:53 AM
(This post was last modified: 07-09-2012, 03:56 AM by xoft.)
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)
Posts: 5
Threads: 2
Joined: May 2012
Thanks: 0
Given 0 thank(s) in 0 post(s)
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?
Posts: 4,629
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 post(s)
09-12-2012, 03:51 AM
(This post was last modified: 12-24-2015, 05:43 PM by NiLSPACE.)
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?
Posts: 1,450
Threads: 53
Joined: Feb 2011
Thanks: 15
Given 120 thank(s) in 91 post(s)
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