4 |
|
|
5 |
public class HoerupUtils extends Plugin { |
public class HoerupUtils extends Plugin { |
6 |
|
|
7 |
final static Logger log = Logger.getLogger("HoerupUtils"); |
final static Logger log = Logger.getLogger("Minecraft"); |
8 |
|
|
9 |
|
|
10 |
private void registerCommands() { |
private void registerCommands() { |
134 |
final static int BLOCK_GRASS = 2; |
final static int BLOCK_GRASS = 2; |
135 |
final static int BLOCK_DIRT = 3; |
final static int BLOCK_DIRT = 3; |
136 |
|
|
137 |
|
private HashMap<String, String[]> commands = new HashMap<String,String[]>(); |
138 |
|
|
139 |
|
|
140 |
|
|
141 |
//http://www.minecraftforum.net/viewtopic.php?f=35&t=14739 |
//http://www.minecraftforum.net/viewtopic.php?f=35&t=14739 |
208 |
if (! player.canUseCommand(split[0]) ) { |
if (! player.canUseCommand(split[0]) ) { |
209 |
return false; |
return false; |
210 |
} |
} |
211 |
|
|
212 |
|
if ( split[0].equals("/levelarea") || split[0].equals("/la") || split[0].equals("/slopearea") || split[0].equals("/fillarea") || split[0].equals("/setsurface") ) { |
213 |
|
commands.put(player.getName(), split); |
214 |
|
} |
215 |
|
|
216 |
if( split[0].equals("/setpos") && player.canUseCommand("/setpos") ) { |
if ( split[0].equals("//") ) { |
217 |
|
String cmd[] = commands.get(player.getName() ); |
218 |
|
if (cmd != null) { |
219 |
|
onCommand(player, commands.get(player.getName() ) ); |
220 |
|
} else { |
221 |
|
player.sendMessage("//: no recorded command found"); |
222 |
|
} |
223 |
|
return true; |
224 |
|
} else if( split[0].equals("/setpos") && player.canUseCommand("/setpos") ) { |
225 |
setPos(player, split); |
setPos(player, split); |
226 |
return true; |
return true; |
227 |
} else if ( split[0].equals("/whereis" ) && player.canUseCommand("/whereis")) { |
} else if ( split[0].equals("/whereis" ) && player.canUseCommand("/whereis")) { |
261 |
} |
} |
262 |
|
|
263 |
private void setSurface(Player player, String[] split) { |
private void setSurface(Player player, String[] split) { |
264 |
int valid_block_array[] = {1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 35, 41, 42, 43, 44, 45, 46, 48, 49, 56, 57, 73, 74, 79, 80, 82} ; |
int valid_block_array[] = {1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 35, 41, 42, 43, 44, 45, 48, 49, 56, 57, 73, 74, 79, 80, 82} ; |
265 |
|
|
266 |
final int BLOCK_MAX = 86; |
final int BLOCK_MAX = 86; |
267 |
|
|
345 |
} |
} |
346 |
|
|
347 |
if (split.length == 3) { |
if (split.length == 3) { |
348 |
|
int id; |
349 |
try { |
try { |
350 |
Integer.parseInt( split[2] ); |
id = Integer.parseInt( split[2] ); |
351 |
} catch (Exception e) { |
} catch (Exception e) { |
352 |
player.sendMessage(split[0] + ": radius must be an integer"); |
player.sendMessage(split[0] + ": id must be an integer"); |
353 |
|
return false; |
354 |
|
} |
355 |
|
if ( id == 46) { |
356 |
|
player.sendMessage("Sorry dave, i can't do that"); |
357 |
return false; |
return false; |
358 |
} |
} |
359 |
|
|
360 |
} |
} |
361 |
|
|
362 |
return true; |
return true; |