109 |
} |
} |
110 |
|
|
111 |
public void whereIs(Player p1, java.lang.String[] split) { |
public void whereIs(Player p1, java.lang.String[] split) { |
112 |
if (split.length != 2) { |
if (split.length < 2 || split.length >3) { |
113 |
p1.sendMessage( Colors.Rose + "usage: /whereis <playername>"); |
p1.sendMessage( Colors.Rose + "usage: /whereis (playername|home|warp) [warpname]" ); |
114 |
return; |
return; |
115 |
} |
} |
|
Player p2 = etc.getServer().getPlayer(split[1]); |
|
116 |
|
|
|
if (p2 == null) { |
|
|
p1.sendMessage( Colors.Rose + "whereis: no player named " + split[1] ); |
|
|
return; |
|
|
} |
|
117 |
Location loc1 = p1.getLocation(); |
Location loc1 = p1.getLocation(); |
118 |
Location loc2 = p2.getLocation(); |
Location loc2; |
119 |
|
String name2; |
120 |
|
|
121 |
|
if (split[1].equals("home") ) { |
122 |
|
|
123 |
|
Warp home = etc.getDataSource().getHome( p1.getName() ); |
124 |
|
if (home == null) { |
125 |
|
p1.sendMessage(Colors.Rose + "you haven't set a home."); |
126 |
|
return; |
127 |
|
} |
128 |
|
loc2 = home.Location; |
129 |
|
name2 = "Your home"; |
130 |
|
} else if (split[1].equals("warp")) { |
131 |
|
if (split.length != 3) { |
132 |
|
p1.sendMessage("you have to enter the name of the warp point"); |
133 |
|
return; |
134 |
|
} |
135 |
|
Warp warp = etc.getDataSource().getWarp( split[2] ); |
136 |
|
if (warp == null) { |
137 |
|
p1.sendMessage("Found now warp with name " + split[2]); |
138 |
|
return; |
139 |
|
} |
140 |
|
loc2 = warp.Location; |
141 |
|
name2 = "Warppoint " + split[2]; |
142 |
|
|
143 |
|
|
144 |
|
} else { |
145 |
|
|
146 |
|
Player p2 = etc.getServer().getPlayer(split[1]); |
147 |
|
|
148 |
|
if (p2 == null) { |
149 |
|
p1.sendMessage( Colors.Rose + "whereis: no player named " + split[1] ); |
150 |
|
return; |
151 |
|
} |
152 |
|
|
153 |
|
loc2 = p2.getLocation(); |
154 |
|
name2 = p2.getName(); |
155 |
|
} |
156 |
//Location loc2 = new Location(); |
//Location loc2 = new Location(); |
157 |
//loc2.x = loc2.y = loc2.z = 0; |
//loc2.x = loc2.y = loc2.z = 0; |
158 |
|
|
183 |
angle += 270.0; |
angle += 270.0; |
184 |
} |
} |
185 |
|
|
186 |
p1.sendMessage( Colors.Yellow + p2.getName() + " is at x:" + roundToPlaces(p2.getX(),2) + " y:" + roundToPlaces(p2.getY(),2) + " z: " + roundToPlaces(p2.getZ(),2) ); |
p1.sendMessage( Colors.Yellow + name2 + " is at x:" + roundToPlaces(loc2.x, 2) + " y:" + roundToPlaces(loc2.y, 2) + " z: " + roundToPlaces(loc2.z, 2) ); |
187 |
p1.sendMessage( Colors.Yellow + "Distance is " + dist + " blocks" ); |
p1.sendMessage( Colors.Yellow + "Distance is " + dist + " blocks" ); |
188 |
p1.sendMessage( Colors.Yellow + "Bearing: " + (int) angle + " (" + getBearingStr( (int) angle) + ")" ); |
p1.sendMessage( Colors.Yellow + "Bearing: " + (int) angle + " (" + getBearingStr( (int) angle) + ")" ); |
189 |
|
|