166 |
return (srv.getBlockIdAt(x,y,z) == BLOCK_AIR && srv.getBlockIdAt(x,y+1,z) == BLOCK_AIR); |
return (srv.getBlockIdAt(x,y,z) == BLOCK_AIR && srv.getBlockIdAt(x,y+1,z) == BLOCK_AIR); |
167 |
} |
} |
168 |
|
|
169 |
|
public void slopeArea(Player player, java.lang.String[] split) { |
170 |
|
int radius = Integer.parseInt(split[1]); |
171 |
|
|
172 |
|
System.out.println("Player " + player.getName() + " used slopearea with radius=" + radius); |
173 |
|
|
174 |
|
|
175 |
|
int playerX = roundPos( player.getX() ); |
176 |
|
int playerY = (int) player.getY(); |
177 |
|
int playerZ = roundPos( player.getZ() ); |
178 |
|
|
179 |
|
Server srv = etc.getServer(); |
180 |
|
|
181 |
|
for (int x=(playerX-radius); x<=(playerX+radius); x++) { |
182 |
|
for (int z=(playerZ-radius); z<=(playerZ+radius); z++) { |
183 |
|
|
184 |
|
|
185 |
|
int xdist = Math.abs(playerX-x); |
186 |
|
int zdist = Math.abs(playerZ-z); |
187 |
|
|
188 |
|
int dist = Math.max(xdist,zdist); |
189 |
|
|
190 |
|
//for (int y=playerY; y<=playerY+radius; y++) { |
191 |
|
for (int y=(playerY+dist); y<=128; y++) { |
192 |
|
srv.setBlockAt(BLOCK_AIR, x, y, z); |
193 |
|
} |
194 |
|
|
195 |
|
} |
196 |
|
|
197 |
|
} |
198 |
|
} |
199 |
|
|
200 |
@Override |
@Override |
201 |
public boolean onCommand(Player player, java.lang.String[] split) { |
public boolean onCommand(Player player, java.lang.String[] split) { |
202 |
|
if (! player.canUseCommand(split[0]) ) { |
203 |
|
return false; |
204 |
|
} |
205 |
|
|
206 |
if( split[0].equals("/setpos") && player.canUseCommand("/setpos") ) { |
if( split[0].equals("/setpos") && player.canUseCommand("/setpos") ) { |
207 |
setPos(player, split); |
setPos(player, split); |
208 |
return true; |
return true; |
209 |
} else if ( split[0].equals("/whereis" ) && player.canUseCommand("/whereis")) { |
} else if ( split[0].equals("/whereis" ) && player.canUseCommand("/whereis")) { |
210 |
whereIs(player, split); |
whereIs(player, split); |
211 |
return true; |
return true; |
212 |
} else if (split[0].equals("/levelarea") && player.canUseCommand("/levelarea")) { |
} else if ( (split[0].equals("/levelarea") || split[0].equals("/la")) && player.canUseCommand("/levelarea")) { |
213 |
if (validateLevelOrFill(player,split)) { |
if (validateLevelOrFill(player,split)) { |
214 |
levelArea(player, split); |
levelArea(player, split); |
215 |
} |
} |
216 |
return true; |
return true; |
217 |
|
} else if (split[0].equals("/slopearea") ) { |
218 |
|
if (validateLevelOrFill(player,split)) { |
219 |
|
slopeArea(player,split); |
220 |
|
} |
221 |
|
return true; |
222 |
} else if (split[0].equals("/fillarea") && player.canUseCommand("/fillarea")) { |
} else if (split[0].equals("/fillarea") && player.canUseCommand("/fillarea")) { |
223 |
if (validateLevelOrFill(player,split)) { |
if (validateLevelOrFill(player,split)) { |
224 |
fillArea(player, split); |
fillArea(player, split); |