Valid location Yeilds Invalid lovation
Bjohnson131 opened this issue ยท 2 comments
private Runnable MVSetup(Location l){
return new Runnable(){
Random r = new Random(System.nanoTime());
@Override
public void run() {
MultiversePortals plugin = null;
for(Plugin p : getServer().getPluginManager().getPlugins()){//check if MVCore Exists
Bukkit.getPlayer(playert).sendMessage(p.getClass().getName());
if(p instanceof MultiversePortals){
plugin = (MultiversePortals) p;
Bukkit.getPlayer(playert).sendMessage("found MVCore");;
}
}
MVPortal mvp = new MVPortal(plugin, "Lethamyr" +r.nextInt(2147483647) );//Lethamy is a portal and a world name
if(mvp.setExactDestination(new Location(getServer().getWorld("Lethamyr"), l.getX()/100, l.getY(), l.getZ()/100))){//check for sucessful destionation setting. returns true
getServer().getPlayer(playert).sendMessage("dest. set sucessfully");
}else{
getServer().getPlayer(playert).sendMessage("dest. set UNsucessfully");
}
PortalLocation loc;
Vector x,y;
x = new Vector(l.getBlockX()-2,l.getBlockY(),l.getBlockZ());
y = new Vector(l.getBlockX()+2,l.getBlockY()+5,l.getBlockZ());
MultiverseCore p = (MultiverseCore)getServer().getPluginManager().getPlugin("Multiverse-Core");
MultiversePortals port = (MultiversePortals)getServer().getPluginManager().getPlugin("Multiverse-Portals");
loc = new PortalLocation(x,y, p.getMVWorldManager().getMVWorld("world"));//main overworld
mvp.setPortalLocation(loc);
port.getPortalManager().addPortal(mvp);//Yields Invalid destination.
port.getPortalManager();
}
};
}