Join message for new world

Discussion in 'Plugin Development' started by Funsize888, Jun 6, 2016.

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

    Funsize888

    Hello!

    So, I have a PVP arena that is in a whole new world and I was wondering how i would set a join and leave message for that world. I have the players teleport to the PVP arena when they click a sign.
    Thanks!
     
  2. Use PlayerTeleportEvent
     
  3. Offline

    Funsize888

    Would PlayerChangedWorldEvent work?
     
  4. Offline

    DoggyCode™

    I would say that would be better yes.

    EDIT: no it wouldn't
     
  5. Offline

    Xerox262

    @DoggyCode™ Why would it not? Using PlayerChangeWorldEvent is the exact thing he needs. He can get the world the player is in with

    Player#getWorld(); (I'm going to assume that's the case since they didn't add a getTo() and since it's not a Cancellable event)

    and get the world the player used to be in with

    PlayerChangeWorldEvent#getFrom();

    Then he can create join/leave messages based on that

    @Funsize888 Use PlayerChangeWorldEvent, get the from world, check it's name, if it is equal to your pvp world then the player is leaving the PVP world so you should send the leave message.

    Then get the player's location/world, check the world name, if it's the same as your PVP world then they went to the PVP world so you should send the join message.
     
  6. Offline

    DoggyCode™

    Ah I didn't know there were a getFrom method in the world change event, my bad.
     
    Xerox262 likes this.
  7. Offline

    Funsize888

    Ya i used that method and it worked thanks guys!
     
Thread Status:
Not open for further replies.

Share This Page