Magic

Magic

190k Downloads

[Question] Can i add class with the api?

Nobodyno-boop opened this issue · 5 comments

commented

I wanna use the MagicApi for create a custom class: CustomClass

Can i do this?

commented

Yes, simply call

public static void registerResolver(ActionResolver actionResolver) {
in your Plugin#onLoad

commented

Wiki is down (https://github.com/elBukkit/MagicPlugin/wiki/Actions).
Without the wiki is not very eady to understand, how i make own Action ^^

commented

The wiki is hosted on github... is that really down for you?

Truth be told it’ll be easier to make your own action if you depend on Magic and not the API, so you can inherit from the BaseAction class. If you can do that, just look at any of the actions int the source code, it’s pretty easy. Just implement prepare and process methods.

commented

In the wiki link like :

"All you need to do is to implement the SpellAction interface found in MagicAPI. Alternately, you can extend BaseSpellAction in MagicLib, which takes care of some of the boilerplate code for you." SpellAction link is broken :/

commented

Oh, yeah sadly the doxygen docs got broken. I'll replace with a link to the classes:

https://github.com/elBukkit/MagicPlugin/blob/master/MagicAPI/src/main/java/com/elmakers/mine/bukkit/api/action/SpellAction.java

https://github.com/elBukkit/MagicPlugin/blob/master/Magic/src/main/java/com/elmakers/mine/bukkit/action/BaseSpellAction.java

If using BaseSpellAction (which I would recommend), you will need to build against the Magic plugin itself, not the API. The plugin is not available in the Central Maven repo, so you will have to add the elMakers repo:

    <repositories>
        <repository>
            <id>elMakers</id>
            <url>http://maven.elmakers.com/repository/</url>
        </repository>
    </repositories>

Then you would add Magic as a dependency like this:

    <dependencies>
        <dependency>
            <groupId>com.elmakers.mine.bukkit.plugins</groupId>
            <artifactId>Magic</artifactId>
            <version>8.3</version>
            <scope>provided</scope>
        </dependency>
   </dependencies>