# Player position triggering teleports

I'm developing a Minecraft plugin (bukkit) in which a server admin can create 'portals' - a small region that will teleport any players who enter it. I have the teleportation sorted and I know how I could define areas that the player's position could be tested against.

This would involve an ArrayList containing the zones and then hooking the PlayerMoveEvent so that the ArrayList is searched each time for a matching portal region.

Although this method would work, I doubt that it would be very efficient when 100+ players are all moving around at the same time. Is there a better way of checking a player position against a set of 'zones' / regions?

• What you are looking for are broad-phase collision detection algorithms. stackoverflow.com/questions/1616448/… – user8363 Aug 12 '12 at 22:58
• Since it is Minecraft, couldn't you just use hidden teleporting command blocks combined with a redstone clock or custom mob spawner for this? Though, it might not be as easy and convenient for admins, I suppose. – Gigggas Jun 9 '13 at 4:30