Solved TravelAgent is being not so friendly

Discussion in 'Plugin Help/Development/Requests' started by teej107, Jan 26, 2015.

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


    I have done quite a bit of research to find out how to prevent a nether portal from being generated (like when entering the nether and it creates a new portal for you). I found out the best way is to use this event:

    The event supplies a TravelAgent.
    What I intended to do is to find a portal that is already in the nether within the search radius and if one is not found, then cancel the event.

    However the TravelAgent supplied in the event cannot seem to find a portal using TravelAgent#findPortal(org.bukkit.Location). The two portals in testing are within distance of one another. I get transported successfully between the two. Here is the debug code that I use.

        public void onPlayerPortal(PlayerPortalEvent event)
            Location loc = event.getPortalTravelAgent().findPortal(event.getTo());
            if(loc == null)
                Bukkit.broadcastMessage("Using TravelAgent: " + event.useTravelAgent());
                Bukkit.broadcastMessage("No Portal Found");
                Bukkit.broadcastMessage("Search Radius: " + event.getPortalTravelAgent().getSearchRadius());
                Bukkit.broadcastMessage("Creation Radius: " + event.getPortalTravelAgent().getCreationRadius());
                Bukkit.broadcastMessage("Can Create Portal: " + event.getPortalTravelAgent().getCanCreatePortal());
    The search radius is at a default of 128 and the creation radius is at the default of 16. However, if I go to the nether a couple times, it then starts to find the portal and from the code, it broadcasts the Location in String form. It has never done this when going back to the overworld though.
    To make a long story short, the server seems to know where to find the portal but when using the TravelAgent, it does not and it is inconsistent. I am not using a custom Travel Agent.
    The weird thing is that when I first made the plugin, it was working fine but then it stopped behaving like it should after one day.

    So right now, I am a little frustrated. I don't feel like creating my own TravelAgent, the one supplied with CB should be fine, right? If anyone else has a way to find portals, let me know!

    Answer: Had to create my own portal finder:
    Last edited: Feb 6, 2015
Thread Status:
Not open for further replies.

Share This Page