Package org.bukkit.craftbukkit

Examples of org.bukkit.craftbukkit.CraftTravelAgent


   * @return suitable spawn location, or the input startLocation if this failed
   */
  public static Location findSpawnLocation(Location startLocation, boolean createPortals) {
    WorldServer ws = CommonNMS.getNative(startLocation.getWorld());
    // Use a new travel agent to designate a proper position
    CraftTravelAgent travelAgent = new CraftTravelAgent(ws);
    travelAgent.setCanCreatePortal(createPortals);
    Location exit = travelAgent.findOrCreate(startLocation);
    // Adjust the exit to make it suitable for players
    // Note: this will raise an NPE while trying to fire the PortalExit event
    // This is expected behavior
    try {
      travelAgent.adjustExit((Entity) findSpawnDummyEntity, exit, new Vector(0, 0, 0));
    } catch (NullPointerException ex) {
    }
    // Done!
    return exit;
  }
View Full Code Here

TOP

Related Classes of org.bukkit.craftbukkit.CraftTravelAgent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.