initial commit, command hooks, messenger and test command
This commit is contained in:
1 parent
a649a8fdb1
commit
bddad16344
19 files changed
+1064
-2
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package carpet.commands;
|
||||
|
||||
import carpet.utils.Messenger;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
|
||||
import static com.mojang.brigadier.arguments.StringArgumentType.getString;
|
||||
import static com.mojang.brigadier.arguments.StringArgumentType.word;
|
||||
import static net.minecraft.server.command.CommandManager.argument;
|
||||
import static net.minecraft.server.command.CommandManager.literal;
|
||||
|
||||
public class TestCommand
|
||||
{
|
||||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher)
|
||||
{
|
||||
dispatcher.register(literal("test").
|
||||
then(argument("first",word()).
|
||||
executes( (c)-> test(c, getString(c, "first")+" 1"))).
|
||||
then(argument("second", word()).
|
||||
executes( (c)-> test(c, getString(c, "second")+" 2"))));
|
||||
}
|
||||
|
||||
private static int test(CommandContext<ServerCommandSource> c, String term)
|
||||
{
|
||||
Messenger.m(c.getSource(),"w term is: ",term.substring(0,1)+"b "+term);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user