# Define an area

Comments in 'Plugin Development' started by Tuff, Jun 22, 2014.

1. Offline

### TuffActive Member

Joined:
Jan 25, 2014
Posts:
203
Minecraft User:
Hey guys! I am working on a plugin, and am stuck on something that seems simple, but I can't seem to figure out. How can I define a three dimensional area? I have a concept in my head, but I cant figure out how to do it.

I want to make a plugin that does something when a player walks into a certain area. I am planning on using the EntityMoveEvent to figure out if the player is in the area, I just dont know how to define the area. The creator would be able to do /pos1 and /pos2 and /create [name] to create the area. I have never used the Vector3 stuff before and I dont know how it works, it you could help me out that would be great!
2. Offline

### FalkStaff MemberGlobal Moderator

Joined:
Sep 2, 2013
Posts:
1,699
Plugins:
22
Minecraft User:
I personally prefer just doing /create <Name> and the being prompted to tap a position one and two. More accurate as there is no rounding and less commands.
3. Offline

### TuffActive Member

Joined:
Jan 25, 2014
Posts:
203
Minecraft User:
That's pretty cool too, It doesn't really matter to me how the two points are defined, I just have no clue how to define the area inside the points.

Would I have to make it make a list of every coordinate inside the area? And then match the EntityMove event to the coordinates to see if they match? That was my original idea, but I thought that there had to be an easier, more efficient way.
4. Offline

### FalkStaff MemberGlobal Moderator

Joined:
Sep 2, 2013
Posts:
1,699
Plugins:
22
Minecraft User:
You check if x is between min(x1,x2) and max(x1,x2) and the same for y and z. If you want to go through every point in the area you do three for loops inside each other (x, y, z).
Tuff likes this.
5. Offline

### TuffActive Member

Joined:
Jan 25, 2014
Posts:
203
Minecraft User:
OOOOOOHHHH!

So would that be an IF statement? like IF the player is inside x, then go on to the next IF, which would be IF player is inside y and so on? I get what you are saying, so it does not really matter if it is an IF statement or not.

Thanks genius!
iJoshuaHD likes this.
6. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
iJoshuaHD and Tuff like this.
7. Offline

### TuffActive Member

Joined:
Jan 25, 2014
Posts:
203
Minecraft User:
8. Offline

### TuffActive Member

Joined:
Jan 25, 2014
Posts:
203
Minecraft User:
Sorry, that his some useful stuff you have there, thanks for sharing itm
PEMapModder likes this.
9. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,230
Plugins:
11
Minecraft User:
Like pls xD
iJoshuaHD and Tuff like this.