Solved Nether?

Discussion in 'Plugin Development' started by Ty Cleere, Oct 15, 2013.

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

    Ty Cleere

    Is there an event thing that lets you detect if a player is using a portal to go to the end or nether? Because on my server i made a serperate survival world for the players and they cant get tot he end or nether from that world. So i need to code something or find a plugin that enables this to be used. Thanks :D
     
  2. Offline

    sgavster

    Ty Cleere maybe PortalCreateEvent or PlayerChangedWorldEvent
     
  3. Offline

    viper_monster

    Last edited by a moderator: Jun 4, 2016
  4. Offline

    Ty Cleere

    spoljo666 sgavster Thanks guys!

    I tho this was gonna work but it isnt working? can you guys look at it?

    Code:java
    1. @EventHandler
    2. public void nether(PlayerTeleportEvent e) {
    3. Player p = e.getPlayer();
    4. World nether = Bukkit.getWorld("OneShotHub_nether");
    5. World end = Bukkit.getWorld("OneShotHub_the_end");
    6. if (e.getCause() == TeleportCause.NETHER_PORTAL) {
    7. p.teleport((Location) nether);
    8. }
    9. if (e.getCause() == TeleportCause.END_PORTAL) {
    10. p.teleport((Location) end);
    11. }
    12.  
    13. }


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  5. Offline

    viper_monster

    Ty Cleere use p.teleport(end.getSpawnLocation());
     
  6. Offline

    Ty Cleere

  7. Offline

    viper_monster

    Ty Cleere, maybe you forgot to register that event? Try e.setCancelled(true); before teleporting them ... If nothing of that worked, try to add some debug messages.
     
  8. Offline

    Ty Cleere

    spoljo666 The event is registered. Ill try debuging. Thanks!
     
  9. Offline

    viper_monster

    Ty Cleere, have you tried cancelling the event before teleporting them?
     
  10. Offline

    Ty Cleere

    spoljo666 Im about to test that now

    spoljo666 Ya that does nothing. And i put in a debuging message and it doesnt send. I can get to the nether form the main world but not the world im wanting. And the debuging message wont show up.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
Thread Status:
Not open for further replies.

Share This Page