Created
May 20, 2014 21:27
-
-
Save macalinao/3e287f325fc26b42e46e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gets the sponge that the player will modify. | |
* | |
* @param p | |
* @return | |
*/ | |
public TrackerSponge getSponge(Player p) { | |
TrackerSponge closest = null; | |
for (TrackerSponge sponge : sponges) { | |
if (closest != null) { | |
continue; | |
} | |
if (!sponge.b.getWorld().equals(p.getWorld())) { | |
continue; | |
} | |
if (sponge.b.getLocation().distanceSquared(p.getLocation()) < closest.b.getLocation().distanceSquared(p.getLocation())) { | |
closest = sponge; | |
} | |
} | |
return closest; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment