Additional work for Issue #8

This commit is contained in:
Tobias Ottenweller 2013-02-17 19:43:34 +01:00
parent 02262880da
commit 0dacfaa79b

View File

@ -37,14 +37,14 @@ public class PluginPortalListener implements Listener
Gate closestGate = GateUtil.closestGate(playerLocation); Gate closestGate = GateUtil.closestGate(playerLocation);
if (closestGate != null) if (closestGate != null)
{ {
// Make sure gate and player locations are on the same height (y-value). // Make sure gate and player locations are on the same height (y-value).
// Otherwise the distance will be messed up when players are flying. // Otherwise the distance will be messed up when players are flying.
// FIX ME: this could potentially let a nearby nether portal fail! // FIX ME: this could potentially let a nearby nether portal fail!
playerLocation.setY(closestGate.getLocation().getY()); playerLocation.setY(closestGate.getLocation().getY());
double distToClosestGate = closestGate.getLocation().distance(playerLocation); double distToClosestGate = closestGate.getLocation().distance(playerLocation);
if (distToClosestGate < 1.0) if (distToClosestGate <= 5.0) // the player location is often not very accurate
{ {
gateAtLocation = closestGate; gateAtLocation = closestGate;
} }