mine quantity
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user