/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/creative/GeneralContractorCommands.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/creative/GeneralContractorCommands.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1724 by torben, Mon Mar 12 20:08:39 2012 UTC revision 1725 by torben, Mon Mar 12 20:16:29 2012 UTC
# Line 62  public class GeneralContractorCommands i Line 62  public class GeneralContractorCommands i
62          }          }
63    
64                    
65          void slopeArea(Player player, Location loc, String[] args) {          void slopeArea(Player player, Location loc, String[] split) {
66                  int radius = Integer.parseInt(args[1]);                  int radius;
67                    try {
68                            radius = Integer.parseInt(split[0]);
69                    } catch (Exception e) {
70                            player.sendMessage("setsurface: radius must be an integer");
71                            return;
72                    }
73    
74                  System.out.println("Player " + player.getName() + " used slopearea with radius=" + radius);                  System.out.println("Player " + player.getName() + " used slopearea with radius=" + radius);
75                                    
# Line 98  public class GeneralContractorCommands i Line 104  public class GeneralContractorCommands i
104    
105    
106    
107                  if (split.length != 3) {                  if (split.length != 2) {
108                          player.sendMessage("Usage /setsurface [radius] [blockID]");                          player.sendMessage("Usage /setsurface [radius] [blockID]");
109                          return;                          return;
110                  }                  }
# Line 106  public class GeneralContractorCommands i Line 112  public class GeneralContractorCommands i
112    
113                  int radius;                  int radius;
114                  try {                  try {
115                          radius = Integer.parseInt(split[1]);                          radius = Integer.parseInt(split[0]);
116                  } catch (Exception e) {                  } catch (Exception e) {
117                          player.sendMessage("setsurface: radius must be an integer");                          player.sendMessage("setsurface: radius must be an integer");
118                          return;                          return;
# Line 120  public class GeneralContractorCommands i Line 126  public class GeneralContractorCommands i
126    
127                  int blockid;                  int blockid;
128                  try {                  try {
129                          blockid = Integer.parseInt(split[2]);                          blockid = Integer.parseInt(split[1]);
130                  } catch (Exception e) {                  } catch (Exception e) {
131                          player.sendMessage("setsurface: blockid must be an integer");                          player.sendMessage("setsurface: blockid must be an integer");
132                          return;                          return;
# Line 161  public class GeneralContractorCommands i Line 167  public class GeneralContractorCommands i
167                  }                  }
168          }          }
169    
170          private boolean validateLevelOrFill(Player player, String[] split) {          private boolean validateLevelOrFill(Player player, String label, String[] split) {
171                  if (split.length < 2 || split.length > 3) {                  if (split.length < 1 || split.length > 2) {
172                          player.sendMessage("Usage: " + split[0] + " [radius]");                          player.sendMessage("Usage: " + label + " [radius]");
173                          return false;                          return false;
174                  }                  }
175                                    
176                  int radius;                  int radius;
177                  try {                  try {
178                          radius = Integer.parseInt(split[1]);                          radius = Integer.parseInt(split[0]);
179                  } catch (Exception e) {                  } catch (Exception e) {
180                          player.sendMessage(split[0] + ": radius must be an integer");                          player.sendMessage(label + ": radius must be an integer");
181                          return false;                          return false;
182                  }                  }
183    
184                  if (radius > 20) {                  if (radius > 20) {
185                          player.sendMessage(split[0] + ": radius may not exceed 20");                          player.sendMessage(label + ": radius may not exceed 20");
186                          return false;                          return false;
187                  }                  }
188                                    
189                  if (split.length == 3) {                  if (split.length == 2) {
190                          int id;                          int id;
191                          try {                          try {
192                                  id = Integer.parseInt( split[2] );                                  id = Integer.parseInt( split[1] );
193                          } catch (Exception e) {                          } catch (Exception e) {
194                                  player.sendMessage(split[0] + ": id must be an integer");                                  player.sendMessage(label + ": id must be an integer");
195                                  return false;                                  return false;
196                          }                          }
197                          if ( id == 46) {                          if ( id == 46) {
# Line 199  public class GeneralContractorCommands i Line 205  public class GeneralContractorCommands i
205          }          }
206    
207          private void fillArea(Player player, Location loc, String[] split) {          private void fillArea(Player player, Location loc, String[] split) {
208                  int radius = Integer.parseInt(split[1]);                  int radius = Integer.parseInt(split[0]);
209                                    
210                  int material = Material.DIRT.getId();                  int material = Material.DIRT.getId();
211                                    
212                  if (split.length == 3) {                  if (split.length == 2) {
213                          material = Integer.parseInt( split[2] );                          material = Integer.parseInt( split[1] );
214                  }                  }
215    
216                  System.out.println("Player " + player.getName() + " used fillarea with radius=" + radius);                  System.out.println("Player " + player.getName() + " used fillarea with radius=" + radius);
# Line 232  public class GeneralContractorCommands i Line 238  public class GeneralContractorCommands i
238    
239          private void levelArea(Player player, Location loc, String[] split) {          private void levelArea(Player player, Location loc, String[] split) {
240    
241                  int radius = Integer.parseInt(split[1]);                  int radius = Integer.parseInt(split[0]);
242    
243                  System.out.println("Player " + player.getName() + " used levelarea with radius=" + radius);                  System.out.println("Player " + player.getName() + " used levelarea with radius=" + radius);
244                                    

Legend:
Removed from v.1724  
changed lines
  Added in v.1725

  ViewVC Help
Powered by ViewVC 1.1.20