generated from FabricMC/fabric-example-mod
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add await command, remove succeed when
- Loading branch information
Showing
5 changed files
with
124 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/io/github/misode/packtest/commands/AwaitCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.github.misode.packtest.commands; | ||
|
||
import com.mojang.brigadier.CommandDispatcher; | ||
import com.mojang.brigadier.builder.LiteralArgumentBuilder; | ||
import net.minecraft.commands.CommandBuildContext; | ||
import net.minecraft.commands.CommandSourceStack; | ||
|
||
import static net.minecraft.commands.Commands.literal; | ||
|
||
public class AwaitCommand { | ||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, CommandBuildContext buildContext) { | ||
LiteralArgumentBuilder<CommandSourceStack> awaitBuilder = literal("await") | ||
.requires(ctx -> ctx.hasPermission(2)); | ||
AssertCommand.addConditions(awaitBuilder, buildContext, predicate -> new AssertCommand.AssertCustomExecutor(true, predicate)); | ||
LiteralArgumentBuilder<CommandSourceStack> notBuilder = literal("not"); | ||
AssertCommand.addConditions(notBuilder, buildContext, predicate -> new AssertCommand.AssertCustomExecutor(false, predicate)); | ||
awaitBuilder = awaitBuilder.then(notBuilder); | ||
dispatcher.register(awaitBuilder); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters