WorldGuard API: Player Detection

Discussion in 'Plugin Development' started by DeamonZ, Dec 13, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    DeamonZ

    Hello,

    I'm working with the WorldGuard API at the moment and I'm trying to figure out when a player switches regions.
    E.g If i want to display a message when a player enters a region called "Desert" when he came from region called "SnowRegion".
    (P.S I know this already exists in WorldGuard but I'm only interested in the player detection.)
    That it displays something like this:
    "Welcome to the Desert! Sure a lot warmer compared to that SnowRegion"

    Does anyone know how to do this?

    Regards,
    Deamon
     
  2. Offline

    Avygeil

    @DeamonZ WorldGuard does all of this in its own movement check method but fires no event. I see two options:

    1. If you don't need to do this often, the easier way is doing it the same as WG does, i.e. optimized checks in PlayerMoveEvent. This is going to do twice the same checks in critical code though, so it likely won't be the best option.

    2. What I'd do : compile your own WorldGuard, have it depend on your plugin and write stuff around these lines to call a method in your plugin, ie myplugin.onRegionEnter(player, region). If you're not sure about compiling your own WG, keep in mind that it's your server and there is nothing wrong in doing non-breaking changes like this. It's also possibly the most efficient way to do it with lack of proper API. Also, it's not like WG is going to update a lot in a while.
     
Thread Status:
Not open for further replies.

Share This Page