Events, Spawns, Source Servers, and many more!

User Tools

Site Tools


Sidebar

home

issues

downloads


bukkit plugins

windows 8 apps

windows phone apps


Maintaining these plugins takes a lot of work, so if your server is enriched by them please consider sending some love my way!

If you're penniless I'm also partial to TF2 items. Send any you don't want my way! STEAM id: coldandtired

If you don't know what TF2 is, then start playing! It's free and fun!

events:actions

This page is an explanation of how actions work in Events. IF you want to see a list of all the available actions please go here.


Events gives you pretty much unlimited possibilities for your server. You can execute a group of actions, then check some conditions to decide whether to perform another group, and top it off with some actions that are performed randomly.

Internally, actions are placed into containers, even if there is only one action, and each type of container can hold any of the other types.

Basic container

The basic container holds a list of actions, which will be performed from top to bottom. Actions which are not valid (trying to kill a block, for example) will be silently ignored. (Note that there is an exit action which can stop all further actions from being performed but it makes no sense in the basic container.) Here's an example of a basic container

<mob-spawns>
    <log>A mob tried to spawn!</log>
    <cancel-event/>
</mob-spawns>

When Bukkit announces that a mob is spawning the plugin will log the message and then block the mob from spawning.


Conditional container

Next up is the conditional container. This container is defined using an element called if for the conditions, and an element called then for the actions

<mob-spawns>
    <if>
        <mob-type>pig</mob-type>
        <then>
            <log>A pig tried to spawn!</log>
            <cancel-event/>
        </then>
    </if>
</mob-spawns>

Now when there's a mob trying to spawn, if it's a pig the message will be logged and the pig will be blocked from spawning, but any other mob will be allowed. You can add an optional else element to define what will happen if the conditions fail

<mob-spawns>
    <if>
        <mob-type>pig</mob-type>
        <then>
            <log>A pig tried to spawn!</log>
            <cancel-event/>
        </then>
        <else>
            <log>Pass, non-pig!</log>
        </else>
    </if>
</mob-spawns>

Note that the then and else elements are inside the if one.

More details can be found on the conditional-actions page.


Random container

Next is the random container, which allows you to let fate decide which group of actions to perform

<mob-spawns>
    <one-of>
        <log>You shall not pass!</log>
        <cancel-event/>
        <or>
            <log>Okay, on you go</log>
        </or>
    </one-of>
</mob-spawns>

Some mobs will be blocked, and others will be allowed to spawn. You can have as many alternatives as you like and they will all have an equal chance of being used

<mob-spawns>
    <one-of>
        <log>You shall not pass!</log>
        <cancel-event/>
        <or>
            <log>Okay, on you go</log>
        </or>
        <or>
            <log>Actually, I changed my mind</log>
            <cancel-event/>
        </or>
    </one-of>
</mob-spawns>

Note that any or elements go inside the one-of element.

More details can be found on the random-actions page.

Targeting container

Lastly, we have the targeting container. Normally, any actions or conditions you define use the event's mob or location as the target. This means that in the examples above, any actions affecting a mob will use the mob trying to spawn, and any actions which require a location will use the one the mob is trying to spawn at.

Sometimes, however, you might want to perform actions on a different mob or you might be interested in an event that doesn't involve a mob so you'll need to specify one

<mob-spawns>
    <targeting>
        <target>coldandtired</target>
        <tell>Hey, a mob's spawning!</tell>
    </targeting>
</mob-spawns>

When a mob spawns I will get a message about it. As you can imagine, this would drive me crazy very quickly indeed so we can use this to show how containers can be combined

<mob-spawns>
    <if>
        <mob-type>pig</mob-type>
        <then>    
            <targeting>
                <target>coldandtired</target>
                <tell>Hey, a mob's spawning!</tell>
            </targeting>
        </then>
    </if>
</mob-spawns>

Now I will only get messages about pigs spawning, and my rage will be kept in check.

Targeting containers are potentially the most complicated so I'll leave the details to their page.

events/actions.txt · Last modified: 2014/08/20 11:22 by sylian