Solved Custom portal teleporting

Discussion in 'Plugin Development' started by wesley27, Jun 9, 2015.

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

    wesley27

    Hello, I have been trying all day different methods to change the outcome of when someone enters a nether(and end) portal. Whether it happens via creating a location teleport, or running a command, I would like to have a player teleport to a direct spawnpoint in the nether every time they go through a overworld portal, rather than generating new portals each time in the nether.

    I have tried using the EntityPortalEnterEvent and the PlayerPortalEvent and the PlayerTeleportEvent and none of my attempts have been successful. Can anyone offer some advice, insight, or a place to start in accomplishing this? Thanks!
     
  2. Can be a bit tricky with the portal events but generally it works if you cancel the event and then run a scheduler a few ticks afterwards to teleport the player to said location.
     
  3. Offline

    Konato_K

    @wesley27 Use PlayerPortalEvent and use the setTo method to set where they will be sent, you may also have to enable the travel agent.
     
  4. Offline

    wesley27

    @Konato_K That's exactly what I tried first, that's what I thought would work. I tried this:
    Code:
    @EventHandler
        public void onPortal(PlayerPortalEvent event) {
            if(event.getCause() == TeleportCause.NETHER_PORTAL) {
                World w = Bukkit.getWorld("skymap_nether");
                double x = 1616.53;
                double y = 38.0;
                double z = -832.6;
                Location loc = new Location(w, x, y, z);
                event.setTo(loc);
            }
            if(event.getCause() == TeleportCause.END_PORTAL) {
                World w = Bukkit.getWorld("skymap_the_end");
                double x = 0.0;
                double y = 66.0;
                double z = 0.0;
                Location loc = new Location(w, x, y, z);
                event.setTo(loc);
            }
        }
    That didn't work. When I stepped in a nether portal, I didn't get any errors from my plugin, but nothing happened. My screen just started swirling purple and giving me a headache. The only thing that happens when I go in a portal with that code is, a multiverse error is thrown. This is below:
    PHP:
    Console    : [18:48:06 ERROR]: Could not pass event PlayerPortalEvent to Multiverse-Core v2.5-b678
    Console    
    org.bukkit.event.EventException
    Console    
    :     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.PlayerList.changeDimension(PlayerList.java:666) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.EntityPlayer.c(EntityPlayer.java:536) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.Entity.K(Entity.java:279) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.EntityLiving.K(EntityLiving.java:169) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.Entity.t_(Entity.java:246) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.EntityLiving.t_(EntityLiving.java:1447) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.EntityHuman.t_(EntityHuman.java:173) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.EntityPlayer.l(EntityPlayer.java:285) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:381) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.PacketPlayInFlying.a(SourceFile:126) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.PacketPlayInFlying.a(SourceFile:8) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.7.0_65]
    Console    :     at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_65]
    Console    :     at net.minecraft.server.v1_8_R3.SystemUtils.a(SystemUtils.java:19) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:718) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:367) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:657) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at java.lang.Thread.run(Unknown Source) [?:1.7.0_65]
    Console    Caused byjava.lang.IllegalArgumentExceptionCannot use location with null world!
    Console    :     at com.google.common.base.Preconditions.checkArgument(Preconditions.java:125) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at org.bukkit.event.player.PlayerMoveEvent.validateLocation(PlayerMoveEvent.java:91) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at org.bukkit.event.player.PlayerMoveEvent.setFrom(PlayerMoveEvent.java:67) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at com.onarandombox.MultiverseCore.listeners.MVPlayerListener.playerPortalCheck(MVPlayerListener.java:256) ~[?:?]
    Console    :     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_65]
    Console    :     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]
    Console    :     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]
    Console    :     at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_65]
    Console    :     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     ... 23 more
     
  5. Offline

    Konato_K

    @wesley27
     
  6. Offline

    wesley27

    @Konato_K Yes, I read it, lol. I'm just not really sure how to fix it. The world isn't null, it very much so exists with the name "skymap_nether"

    So, I'm not sure what's throwing that error. If I remove my code and try, that error still throws. It appears to just be a multiverse error when multiverse doesn't know where to send you from a portal. So it's not coming from my code; think about it, my code has nothing to do with multiverse or multiverse worlds so it couldn't throw a multiverse error - the error would be from my plugin.

    So whether I can get rid of that error or not, I'm still stuck on my code doesn't work.
     
  7. Chances are you are trying to teleport them to a world which has not been loaded.

    If the world already exists you can load it by using Bukkit's world creator class to create the world, and as it already exists it will just load it.
     
  8. Offline

    wesley27

    @Adamki11s It's definitely loaded, I can teleport to it in game. I don't know if there's an issue with my code, because if that was the case, wouldn't it throw an error in the console? Maybe there's just more I need to do?
     
  9. Offline

    Konato_K

    @wesley27 Then that means you spelled the name of the world wrong (case sensitive and other stuff)
     
  10. Teleporting to it in game, and then leaving it could cause the world to unload. Unless as Konato mentioned you have your spelling wrong, otherwise my guess is that it's a loading issue. You can always check debug by checking the loaded worlds and printing them out before executing your teleportation code.
     
  11. Offline

    wesley27

    @Konato_K It definitely isn't spelled wrong, I've checked both the world folder and the multiverse configs, in and out of game. The spelling is correct, it is "skymap_nether"

    @Adamki11s Okay so I tried this:
    Code:
    @EventHandler
        public void onPortal(PlayerPortalEvent event) {
            if(event.getCause() == TeleportCause.NETHER_PORTAL) {
                World w = Bukkit.getWorld("skymap_nether");
                double x = 1616.53;
                double y = 38.0;
                double z = -832.6;
                Location loc = new Location(w, x, y, z);
               
                WorldCreator wc = new WorldCreator("skymap_nether");
                Bukkit.createWorld(wc);
               
                event.setTo(loc);
            }
    And I also tried going into a portal with someone in the nether world already, to be sure it was loaded. Still doesn't work, and no errors or anything to go off of in the console. Any other ideas? :/
     
  12. Offline

    Konato_K

    @wesley27 The world creator needs to be done BEFORE getting the world, just null check that, if it's null, there is no such world.
     
  13. Offline

    wesley27

    @Konato_K Okay so I fixed that, and added a console log to check if it was null.
    Code:
    @EventHandler
        public void onPortal(PlayerPortalEvent event) {
            if(event.getCause() == TeleportCause.NETHER_PORTAL) {
                WorldCreator wc = new WorldCreator("skymap_nether");
                Bukkit.createWorld(wc);
              
                World w = Bukkit.getWorld("skymap_nether");
                double x = 1616.53;
                double y = 38.0;
                double z = -832.6;
                Location loc = new Location(w, x, y, z);
              
                if(w == null) {
                    MessageUtil.log(Level.SEVERE, "[ObsidianUtilities] world is null");
                }
                event.setTo(loc);
            }
    Still not working, still nothing in the console. I'm thinking that maybe the event isn't working or being carried out properly? I did notice that the multiverse error only seems to come up the first time I enter a portal after the server comes up. After that, it doesn't repeat itself. So maybe multiverse is cancelling the event?

    Or, isn't this event called when you're about to teleport from a portal? So, maybe it isn't being called because multiverse isn't trying to teleport me anywhere with the portal?
     
  14. Offline

    wesley27

    Bump, does anyone have any other ideas as to why this may not be working?
     
  15. Change it to
    Code:
    @EventHandler
        public void onPortal(PlayerPortalEvent event) {
            if(event.getCause() == TeleportCause.NETHER_PORTAL) {
               World w = Bukkit.getWorld("skymap_nether");
                if(w == null) {
                    MessageUtil.log(Level.SEVERE, "[ObsidianUtilities] world is null and will be created.");
                WorldCreator wc = new WorldCreator("skymap_nether");
                Bukkit.createWorld(wc);
      w = Bukkit.getWorld("skymap_nether");
                }
         
            
                double x = 1616.53;
                double y = 38.0;
                double z = -832.6;
                Location loc = new Location(w, x, y, z);
                    
                event.setTo(loc);
            }
     
  16. Offline

    wesley27

    @FisheyLP Thanks for trying to help, I'm sorry for the late reply.

    So I tried that, which makes sense, I apologize for my messy code. It still isn't working though. No errors or anything, aside from the same multiverse one.
    Code:
    Console    : [14:53:46 ERROR]: Could not pass event PlayerPortalEvent to Multiverse-Core v2.5-b678
    Console    : org.bukkit.event.EventException
    Console    :     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.PlayerList.changeDimension(PlayerList.java:666) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.EntityPlayer.c(EntityPlayer.java:536) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.Entity.K(Entity.java:279) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.EntityLiving.K(EntityLiving.java:169) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.Entity.t_(Entity.java:246) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.EntityLiving.t_(EntityLiving.java:1447) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.EntityHuman.t_(EntityHuman.java:173) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.EntityPlayer.l(EntityPlayer.java:285) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:381) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.PacketPlayInFlying.a(SourceFile:126) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.PacketPlayInFlying$PacketPlayInPositionLook.a(SourceFile:18) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.7.0_65]
    Console    :     at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_65]
    Console    :     at net.minecraft.server.v1_8_R3.SystemUtils.a(SystemUtils.java:19) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:718) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:367) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:657) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560) [spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at java.lang.Thread.run(Unknown Source) [?:1.7.0_65]
    Console    : Caused by: java.lang.IllegalArgumentException: Cannot use location with null world!
    Console    :     at com.google.common.base.Preconditions.checkArgument(Preconditions.java:125) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at org.bukkit.event.player.PlayerMoveEvent.validateLocation(PlayerMoveEvent.java:91) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at org.bukkit.event.player.PlayerMoveEvent.setFrom(PlayerMoveEvent.java:67) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     at com.onarandombox.MultiverseCore.listeners.MVPlayerListener.playerPortalCheck(MVPlayerListener.java:256) ~[?:?]
    Console    :     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_65]
    Console    :     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]
    Console    :     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_65]
    Console    :     at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_65]
    Console    :     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    Console    :     ... 23 more
    The world can't be null, so I'm not sure what this is. Maybe my code isn't even running because multiverse is stopping the event on this?
     
  17. Offline

    wesley27

    So I disabled multiverse to try it, and it still wouldn't work, and there were still no errors. When I went into my main world and into a netherportal, it teleported me to the main worlds nether counterpart as normal. However, in the skymap, nothing happened when I entered a portal. It's as if my event isn't even being called, which should be impossible. Maybe my checking for the portal type to be a netherportal is breaking it? Anyone?
     
  18. Offline

    caderape

    @wesley27 Loops the worlds with bukkit.getWorlds() and check if your world really exist.
     
  19. Offline

    wesley27

    @caderape Okay so I tried checking that within the event, and again the event didn't even seem to get called. I think that it isn't being called because it multiverse is calling it first, and multiverse is cancelling it. Then, my plugin can't run it. I tried changing the priority of the event in my plugin, but the same thing is happening. The event doesn't even seem to be called. This is why I thought in my OP that maybe I should try using EntityPortalEnter event? Thoughts on that?

    And, just to check the world being null or not, I added the same code to a command.
    Code:
    for(World w : Bukkit.getWorlds()) {
                                if(w.getName() == "skymap_nether") {
                                    MessageUtil.log(Level.SEVERE, "[ObsidianUtilities] the world exists!");
                                }
                                else {
                                    MessageUtil.log(Level.SEVERE, "[ObsidianUtilities] world does not exist!");
                                    MessageUtil.log(Level.SEVERE, "[ObsidianUtilities] this world's name is " + w.getName());
                                }
                            }
    This is what came up in my console:
    Code:
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] world does not exist!
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] this world's name is world
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] world does not exist!
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] this world's name is world_nether
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] world does not exist!
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] this world's name is world_the_end
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] world does not exist!
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] this world's name is skymap_nether
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] world does not exist!
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] this world's name is skymap
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] world does not exist!
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] this world's name is skymap_the_end
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] world does not exist!
    Console    : [14:22:44 ERROR]: [ObsidianUtilities] this world's name is skyworld
    If you notice lines 7 and 8, the world is clearly there and it has the same name that I'm trying to get it as... so I'm not sure why that part isn't working? But even if we figure that bit out, there's still the issue with the event being called?
     
  20. Offline

    Drkmaster83

    Never compare a String object using '==' in Java. Use .equals().

    When you changed you EventPriority, what did you set it to? Also, you should probably check if it is cancelled in your event, and if so, don't cancel it so that your plugin executes its code.
     
  21. Offline

    wesley27

    @Drkmaster83 Thanks, my bad. I corrected that, and now my console is telling me that the world exists. So, we know the world is not null and it isn't the issue. This was done using a command since the event isn't running.

    I set it to lowest priority first, so that it would run first. That didn't work, so I tried highest so that it should run no matter what, last (I think I have the priorities right?). Neither worked.

    I know I can check if the event is cancelled, but if it is, how do I "uncancel" it like you suggested?

    I tried this just to tell me if it was cancelled or not:
    Code:
    @EventHandler
    public void onPortal(PlayerPortalEvent event) {
        if(event.isCancelled()) {
            MessageUtil.log(Level.SEVERE, "[ObsidianUtilities] The event is being cancelled.");
        }
        if(event.getCause() == TeleportCause.NETHER_PORTAL) {
            World w = Bukkit.getWorld("skymap_nether");
            if(w == null) {
                MessageUtil.log(Level.SEVERE, "[ObsidianUtilities] world is null");
                WorldCreator wc = new WorldCreator("skymap_nether");
                Bukkit.createWorld(wc);
                w = Bukkit.getWorld("skymap_nether");
            }
            double x = 1616.53;
            double y = 38.0;
            double z = -832.6;
            Location loc = new Location(w, x, y, z);
            event.setTo(loc);
        }
    }
    And nothing came up in my console, except for the same multiverse error that has been occurring when I enter the portal. Not really sure what to think now...

    And thanks for trying to help, by the way I really appreciate it!
     
  22. Offline

    Konato_K

    @wesley27 Even if the event isn't cancelled, the portal won't work if there is no travel agent or no location. I used this code in a plugin to force a nether portal to work in non-main worlds, you can probably adapt it to your needs.
    Code:
    @EventHandler(priority = EventPriority.NORMAL)
    public void onPlayerPortal(PlayerPortalEvent e)
    { e.useTravelAgent(true);
      Location to = null;
      if(e.getFrom().getWorld().getUID().equals(nether.getUID()))
        to = e.getPortalTravelAgent().findOrCreate(e.getFrom().toVector().toLocation(map.getWorld()));
      else
        to = e.getPortalTravelAgent().findOrCreate(e.getFrom().toVector().toLocation(nether));
      e.setTo(to);
    }
    Notice how I set it first to use a travel agent.

    Also, change the priority if you need it, in my case I didn't need to have the final word in the event, so I used normal priority.
     
  23. Offline

    wesley27

    @Konato_K Well, I have a location... do I need to use the travel agent? I understand what you're saying, however this is what bukkit's javadocs say about useTravelAgent() :
    It says that if I set it to true like you did, it will try to create a portal at the location I'm teleporting to. I don't want this to happen, so should I still use it? I only want the players to be teleported to a certain location when they use portals.

    @Konato_K Well I tried the below code based on what you said, in any event that it may work, but it sadly did not. Although, I didn't think it would, because it doesn't make sense based on my last reply, lol.
    Code:
    World w = Bukkit.getWorld("skymap_nether");
                    double x = 1616.53;
                    double y = 38.0;
                    double z = -832.6;
                    Location loc = new Location(w, x, y, z);
                    event.getPortalTravelAgent().setCanCreatePortal(false);
                    event.setTo(loc);
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  24. Offline

    wesley27

    Bump :/ Still haven't gotten this working, the same multiverse error is all that shows in my console when I enter a portal.
     
  25. Offline

    Zombie_Striker

    @wesley27
    Can you try the following:
    • Add null checks to w
    • Add null checks for loc
    • Change "Skymap_nether" to "world" or the world you are currently in (this is to test if it even can go through)
    • Change the "world" to "world_nether" to try and actually change worlds (This is to test if it can change worlds)
    • CREATE BY HAND (or console) a new world. Don't let the plugin do it, and then change "world_nether" to the name of that world (see if it works with mutliworld)
    • finally: If all of those work, try looking through the MultiWorld docs to see if there is anything that needs to be updated/ changed.
     
  26. Offline

    wesley27

    @Zombie_Striker Will do -

    • I have, we did a lot of this in above replies if you want to reference them. w is not null
    • Tried this too, loc is not null
    • Okay, tried this, didn't work, same multiverse error
    • Tried this, can do it with Multiverse commands but my code isn't working and won't do it
    • Tried this, didn't work, same multiverse error
    • I have checked through the Multiverse configs multiple times and there is nothing wrong with them
    Okay so thanks for the suggestions! Though I'm not sure my results help much, as nothing with my code really worked/changed. However, I did add one thing and noticed this -

    I added a check right beneath the event, like this:
    Code:
    MessageUtil.log(Level.SEVERE, "[ObsidianUtilities] Tell me the event is even being called!");
    That was the first line that should run when the event occurs. I just tried adding this, and when I went into a portal nothing came up in my console but the multiverse error. That's a line of code that should run no matter what. So, I'm led to believe that the event isn't even being called/passed through my plugin? Maybe it's being cancelled through multiverse since its generating an error, and not getting to my plugin??
     
  27. Offline

    Zombie_Striker

    @wesley27
    If it does not work even for the world you are currently in, then it most likely is being canceled. Try instead of using sendTo, use Player#teleport(location) to see if that will work. Also, post this on the MultiWorlds plugin page, maybe the creator might be able to help.
     
  28. Offline

    wesley27

    @Zombie_Striker Well, I can't even use Player.teleport if it's within that event and the event is being cancelled before my code is run... so what should I do there? I'm trying to get players to teleport to a specific spot when they go in a nether portal. Should I try using the EntityPortalEnterEvent instead of the PlayerPortalEvent that's being cancelled?

    @TWSSYesterday You're an active manager for multiverse, maybe you can help? I don't think the multiverse page actually gets too much attention from the author(I could be wrong) so I'll try it here first.

    Thanks zombie for trying to help, by the way:)
     
  29. Offline

    Drkmaster83

    The code in the events is always run regardless of its cancelled state. It just depends on the priority with which code has the last/first say.
     
    Last edited: Jun 22, 2015
  30. Offline

    wesley27

    @Drkmaster83 Well, then, is there any explanation for why no code I put in the event runs at all?

    Silly me, got it working perfectly with code just from the first replies, I had some silly errors on my end and I apologize for those of you who spent your time trying to help. I appreciate it though, so much. Thanks :)

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

Share This Page