mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-14 22:56:31 +01:00
Add static parse for ArgumentBlockState
This commit is contained in:
parent
e95cc4d295
commit
a29f5f1274
@ -20,6 +20,18 @@ public class ArgumentBlockState extends Argument<Block> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Block parse(@NotNull String input) throws ArgumentSyntaxException {
|
public @NotNull Block parse(@NotNull String input) throws ArgumentSyntaxException {
|
||||||
|
return staticParse(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processNodes(@NotNull NodeMaker nodeMaker, boolean executable) {
|
||||||
|
DeclareCommandsPacket.Node argumentNode = simpleArgumentNode(this, executable, false, false);
|
||||||
|
argumentNode.parser = "minecraft:block_state";
|
||||||
|
|
||||||
|
nodeMaker.addNodes(new DeclareCommandsPacket.Node[]{argumentNode});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Block staticParse(@NotNull String input) throws ArgumentSyntaxException {
|
||||||
final int nbtIndex = input.indexOf("[");
|
final int nbtIndex = input.indexOf("[");
|
||||||
if (nbtIndex == 0)
|
if (nbtIndex == 0)
|
||||||
throw new ArgumentSyntaxException("No block type", input, NO_BLOCK);
|
throw new ArgumentSyntaxException("No block type", input, NO_BLOCK);
|
||||||
@ -46,14 +58,6 @@ public class ArgumentBlockState extends Argument<Block> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void processNodes(@NotNull NodeMaker nodeMaker, boolean executable) {
|
|
||||||
DeclareCommandsPacket.Node argumentNode = simpleArgumentNode(this, executable, false, false);
|
|
||||||
argumentNode.parser = "minecraft:block_state";
|
|
||||||
|
|
||||||
nodeMaker.addNodes(new DeclareCommandsPacket.Node[]{argumentNode});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("BlockState<%s>", getId());
|
return String.format("BlockState<%s>", getId());
|
||||||
|
Loading…
Reference in New Issue
Block a user