Figure out which plugin called a teleport?

Discussion in 'Plugin Development' started by SaxSalute, May 28, 2014.

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

    SaxSalute

    With the number of plugins on the server I develop for, I need to be able to figure out where teleport calls are coming from. There are specific rules when players are at certain warps and the plugin needs to register when somebody leaves, i.e. they are teleported from within a 1v1 match and the plugin needs to know that this teleport was not caused by the plugin itself. Basically, I need to know if the teleport came from my plugin or somewhere else. How could I do that?
     
  2. Offline

    seemethere

    You could make a custom event then call it every time your plugin teleports a player. Then create an event handler to make it so they couldn't leave.
     
  3. Offline

    Gamecube762

    You can try the PlayerTeleportEvent, but I don't think it tells you what plugins did the teleporting.

    If you are coding the plugins, you can look into metadata. Its data you can store in blocks, items, entities, ext. that you can call from later with the same or different plugin. When being teleported, place a meta on the player and when you are catching a teleport with the event, check the metadata and find what plugin it was with that. Also, metadata isn't persistent, it only lasts till the server restarts.
     
    metalhedd likes this.
  4. Offline

    SaxSalute


    I like this idea a lot. Make it so that if the internal listener doesn't trip but the regular one does then remove the player from the plugin's tracking system. Thanks!
     
  5. Offline

    RawCode

Thread Status:
Not open for further replies.

Share This Page