initial commit, command hooks, messenger and test command

This commit is contained in:
gnembon committed 2019-05-10 00:05:25 -03:00
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;
}
}