mine quantity

This commit is contained in:
Leijurv
2018-09-17 14:22:45 -07:00
parent 42e179c4ce
commit 71952410eb
2 changed files with 29 additions and 7 deletions

View File

@@ -289,14 +289,23 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
}
if (msg.startsWith("mine")) {
String[] blockTypes = msg.substring(4).trim().split(" ");
try {
int quantity = Integer.parseInt(blockTypes[1]);
ChunkPacker.stringToBlock(blockTypes[0]).hashCode();
MineBehavior.INSTANCE.mine(quantity, blockTypes[0]);
logDirect("Will mine " + quantity + " " + blockTypes[0]);
event.cancel();
return;
} catch (NumberFormatException | ArrayIndexOutOfBoundsException | NullPointerException ex) {}
for (String s : blockTypes) {
if (ChunkPacker.stringToBlock(s) == null) {
logDirect(s + " isn't a valid block name");
event.cancel();
return;
}
}
MineBehavior.INSTANCE.mine(blockTypes);
MineBehavior.INSTANCE.mine(0, blockTypes);
logDirect("Started mining blocks of type " + Arrays.toString(blockTypes));
event.cancel();
return;