Program: 178707
Project: 178707
Buggy source:
public void teleport(Entity entity,V10Location locTo,Vector vector){
  if (entity == null || entity.isDead() || blockedEntities.contains(entity))   return;
  Region regionTo=plugin.regionManager.getRegion(locTo);
  Portal portal=plugin.portalManager.insideBlocks.get(locTo);
  if (portal == null && ((Math.abs(vector.getX()) > 0.5 || (Math.abs(vector.getY()) > 1 || (Math.abs(vector.getZ()) > 0.5))) || entity instanceof Boat)) {
    portal=plugin.portalManager.awayBlocksGeneral.get(locTo);
    if (portal == null && (Math.abs(vector.getX()) > 0.5))     portal=plugin.portalManager.awayBlocksX.get(locTo);
    if (portal == null && (Math.abs(vector.getY()) > 1))     portal=plugin.portalManager.awayBlocksY.get(locTo);
    if (portal == null && (Math.abs(vector.getZ()) > 0.5))     portal=plugin.portalManager.awayBlocksZ.get(locTo);
  }
  if (portal == null && (entity instanceof FallingBlock || entity instanceof TNTPrimed))   portal=plugin.portalManager.awayBlocksY.get(locTo);
  if (portal == null || !portal.open || portal.disabled || (Math.abs(vector.getY()) > 1 && !portal.vertical))   return;
  double x, y, z;
  for (  V10Location b : portal.inside) {
    x=b.x;
    y=b.y;
    z=b.z;
    if (!portal.vertical) {
      if (x + 0.5 < entity.getLocation().getX() && vector.getX() > 0)       return;
 else       if (x - 0.5 > entity.getLocation().getX() && vector.getX() < 0)       return;
 else       if (y + 0.5 < entity.getLocation().getZ() && vector.getZ() > 0)       return;
 else       if (z - 0.5 > entity.getLocation().getZ() && vector.getZ() < 0)       return;
    }
 else {
      if (y + 0.5 < entity.getLocation().getY() && vector.getY() > 0)       return;
      if (y - 0.5 > entity.getLocation().getY() && vector.getY() < -0.1)       return;
    }
  }
  Portal destination=portal.getDestination();
  Location teleport=destination.teleport.getHandle();
  teleport.setX(teleport.getX() + 0.5D);
  teleport.setZ(teleport.getZ() + 0.5D);
  float yaw=entity.getLocation().getYaw();
  float pitch=entity.getLocation().getPitch();
  float startyaw=yaw;
switch (portal.teleportFace) {
case EAST:
    yaw-=90;
  break;
case SOUTH:
yaw-=180;
break;
case WEST:
yaw-=270;
break;
case DOWN:
teleport.add(0,1,0);
case UP:
yaw=pitch;
pitch=0;
break;
}
double momentum=0.0;
switch (portal.teleportFace) {
case NORTH:
case SOUTH:
momentum=vector.getX();
break;
case EAST:
case WEST:
momentum=vector.getZ();
break;
case UP:
case DOWN:
momentum=vector.getY();
break;
}
momentum=Math.abs(momentum);
momentum*=regionTo.getDouble(RegionSetting.VELOCITY_MULTIPLIER);
Vector outvector=entity.getVelocity().zero();
switch (destination.teleportFace) {
case NORTH:
yaw+=180;
outvector=outvector.setX(momentum);
break;
case EAST:
yaw+=270;
outvector=outvector.setZ(momentum);
break;
case SOUTH:
yaw+=360;
outvector=outvector.setX(-momentum);
break;
case WEST:
yaw+=430;
outvector=outvector.setZ(-momentum);
break;
case DOWN:
if (portal.teleportFace != BlockFace.UP && portal.teleportFace != BlockFace.DOWN) {
pitch=startyaw;
yaw=0;
}
 else {
pitch=yaw;
yaw=startyaw;
}
outvector=outvector.setY(momentum);
break;
case UP:
if (portal.teleportFace != BlockFace.UP && portal.teleportFace != BlockFace.DOWN) {
pitch=startyaw + 180;
yaw=0;
}
 else {
pitch=yaw;
yaw=startyaw;
}
outvector=outvector.setY(-momentum);
break;
}
if (!(entity instanceof Player) && !(entity instanceof Chicken) && momentum < 0.5 && (portal.teleportFace == BlockFace.UP || portal.teleportFace == BlockFace.DOWN) && (destination.teleportFace == BlockFace.UP || destination.teleportFace == BlockFace.DOWN)) teleport.setX(teleport.getX() + 0.5D);
entity.setFallDistance(0);
entity.setVelocity(entity.getVelocity().zero());
teleport.setPitch(pitch);
teleport.setYaw(yaw);
if (entity instanceof Arrow) teleport.setY(teleport.getY() + 0.5);
entity.teleport(teleport);
entity.setVelocity(outvector);
destination.disabled=true;
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,new enablePortal(destination),10L);
if (portal.orange) plugin.util.PlaySound(Sound.PORTAL_EXIT_ORANGE,entity instanceof Player ? (Player)entity : null,new V10Location(teleport));
 else plugin.util.PlaySound(Sound.PORTAL_EXIT_BLUE,entity instanceof Player ? (Player)entity : null,new V10Location(teleport));
}

Fixed version (ground truth):
public Location teleport(Entity entity,V10Location locTo,Vector vector,boolean really){
  if (entity == null || entity.isDead() || blockedEntities.contains(entity))   return null;
  Region regionTo=plugin.regionManager.getRegion(locTo);
  Portal portal=plugin.portalManager.insideBlocks.get(locTo);
  if (portal == null && ((Math.abs(vector.getX()) > 0.5 || (Math.abs(vector.getY()) > 1 || (Math.abs(vector.getZ()) > 0.5))) || entity instanceof Boat)) {
    portal=plugin.portalManager.awayBlocksGeneral.get(locTo);
    if (portal == null && (Math.abs(vector.getX()) > 0.5))     portal=plugin.portalManager.awayBlocksX.get(locTo);
    if (portal == null && (Math.abs(vector.getY()) > 1))     portal=plugin.portalManager.awayBlocksY.get(locTo);
    if (portal == null && (Math.abs(vector.getZ()) > 0.5))     portal=plugin.portalManager.awayBlocksZ.get(locTo);
  }
  if (portal == null && (entity instanceof FallingBlock || entity instanceof TNTPrimed))   portal=plugin.portalManager.awayBlocksY.get(locTo);
  if (portal == null || !portal.open || portal.disabled || (Math.abs(vector.getY()) > 1 && !portal.vertical))   return null;
  double x, y, z;
  for (  V10Location b : portal.inside) {
    x=b.x;
    y=b.y;
    z=b.z;
    if (!portal.vertical) {
      if (x + 0.5 < entity.getLocation().getX() && vector.getX() > 0)       return null;
 else       if (x - 0.5 > entity.getLocation().getX() && vector.getX() < 0)       return null;
 else       if (y + 0.5 < entity.getLocation().getY() && vector.getY() > 0)       return null;
 else       if (z - 0.5 > entity.getLocation().getZ() && vector.getZ() < 0)       return null;
    }
 else {
      if (y + 0.5 < entity.getLocation().getY() && vector.getY() > 0)       return null;
      if (y - 0.5 > entity.getLocation().getY() && vector.getY() < -0.1)       return null;
    }
  }
  Portal destination=portal.getDestination();
  Location teleport=destination.teleport.getHandle();
  teleport.setX(teleport.getX() + 0.5D);
  teleport.setZ(teleport.getZ() + 0.5D);
  float yaw=entity.getLocation().getYaw();
  float pitch=entity.getLocation().getPitch();
  float startyaw=yaw;
switch (portal.teleportFace) {
case EAST:
    yaw-=90;
  break;
case SOUTH:
yaw-=180;
break;
case WEST:
yaw-=270;
break;
case DOWN:
teleport.add(0,1,0);
case UP:
yaw=pitch;
pitch=0;
break;
}
double momentum=0.0;
switch (portal.teleportFace) {
case NORTH:
case SOUTH:
momentum=vector.getX();
break;
case EAST:
case WEST:
momentum=vector.getZ();
break;
case UP:
case DOWN:
momentum=vector.getY();
break;
}
momentum=Math.abs(momentum);
momentum*=regionTo.getDouble(RegionSetting.VELOCITY_MULTIPLIER);
Vector outvector=entity.getVelocity().zero();
switch (destination.teleportFace) {
case NORTH:
yaw+=180;
outvector=outvector.setX(momentum);
break;
case EAST:
yaw+=270;
outvector=outvector.setZ(momentum);
break;
case SOUTH:
yaw+=360;
outvector=outvector.setX(-momentum);
break;
case WEST:
yaw+=430;
outvector=outvector.setZ(-momentum);
break;
case DOWN:
if (portal.teleportFace != BlockFace.UP && portal.teleportFace != BlockFace.DOWN) {
yaw=pitch;
pitch=startyaw;
}
 else {
pitch=yaw;
yaw=startyaw;
}
outvector=outvector.setY(momentum);
break;
case UP:
if (portal.teleportFace != BlockFace.UP && portal.teleportFace != BlockFace.DOWN) {
yaw=pitch;
pitch=startyaw + 180;
}
 else {
pitch=yaw;
yaw=startyaw;
}
outvector=outvector.setY(-momentum);
break;
}
if (!(entity instanceof Player) && !(entity instanceof Chicken) && momentum < 0.5 && (portal.teleportFace == BlockFace.UP || portal.teleportFace == BlockFace.DOWN) && (destination.teleportFace == BlockFace.UP || destination.teleportFace == BlockFace.DOWN)) teleport.setX(teleport.getX() + 0.5D);
entity.setFallDistance(0);
entity.setVelocity(entity.getVelocity().zero());
teleport.setPitch(pitch);
teleport.setYaw(yaw);
if (entity instanceof Arrow) teleport.setY(teleport.getY() + 0.5);
entity.setVelocity(outvector);
destination.disabled=true;
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin,new enablePortal(destination),10L);
if (portal.orange) plugin.util.PlaySound(Sound.PORTAL_EXIT_ORANGE,entity instanceof Player ? (Player)entity : null,new V10Location(teleport));
 else plugin.util.PlaySound(Sound.PORTAL_EXIT_BLUE,entity instanceof Player ? (Player)entity : null,new V10Location(teleport));
if (really && !entity.teleport(teleport)) return null;
return teleport;
}