--- miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/creative/GeneralContractorCommands.java 2012/03/13 07:58:31 1729 +++ miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/creative/GeneralContractorCommands.java 2012/03/13 08:30:39 1730 @@ -23,8 +23,11 @@ } final static int Y_MAX = 255; + final 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} ; HashMap commands = new HashMap(); + + //@Override public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) { @@ -41,14 +44,15 @@ return true; } - commands.put(player.getName(), new StoredCommand(label,args) ); - if (label.equals("replay") || label.equals("*") ) { + if ( command.getLabel().equals("replay") ) { StoredCommand cmd = commands.get(player.getName() ); if (cmd != null) { label = cmd.label; args = cmd.args; } + } else { + commands.put(player.getName(), new StoredCommand(label,args) ); } //System.out.println( ">>" + label); //DEBUG @@ -78,6 +82,11 @@ setSurface(player, loc, args); return true; } + + if (label.equals("platform") ) { + platform(player,loc,args); + return true; + } return false; @@ -121,17 +130,70 @@ } } - private void setSurface(Player player, Location loc, String[] split) { - 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} ; + private void platform(Player player, Location loc, String[] split) { + + if (split.length != 2) { + player.sendMessage("Usage /platform [radius] [blockID]"); + return; + } + int radius; + try { + radius = Integer.parseInt(split[0]); + } catch (Exception e) { + player.sendMessage("platform: radius must be an integer"); + return; + } + if (radius > 20) { + player.sendMessage("platform: radius may not exceed 20"); + return; + } + + int blockid; + try { + blockid = Integer.parseInt(split[1]); + } catch (Exception e) { + player.sendMessage("platform: blockid must be an integer"); + return; + } +/* + boolean validblock = false; + for (int i=0; i