-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,3 +74,7 @@ def setup() { | |
|
||
defineMixins() | ||
} | ||
|
||
subprojects { | ||
remapJar.finalizedBy(mergeJars) | ||
} |
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
32 changes: 32 additions & 0 deletions
32
...teunlimited/extensions/com/mojang/brigadier/context/CommandContext/CommandContextExt.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,32 @@ | ||
package dev.rdh.createunlimited.extensions.com.mojang.brigadier.context.CommandContext; | ||
|
||
import manifold.ext.rt.api.Extension; | ||
import manifold.ext.rt.api.This; | ||
|
||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.network.chat.Component; | ||
|
||
import com.mojang.brigadier.context.CommandContext; | ||
|
||
@Extension | ||
public class CommandContextExt { | ||
public static void message(@This CommandContext<CommandSourceStack> context, Component message) { | ||
#if PRE_CURRENT_MC_1_19_2 | ||
context.getSource().sendSuccess(message, false); | ||
#elif POST_CURRENT_MC_1_20_1 | ||
context.getSource().sendSuccess(() -> message, false); | ||
#endif | ||
} | ||
|
||
public static void message(@This CommandContext<CommandSourceStack> context, String message) { | ||
context.message(Component.nullToEmpty(message)); | ||
} | ||
|
||
public static void error(@This CommandContext<CommandSourceStack> context, Component message) { | ||
context.getSource().sendFailure(message); | ||
} | ||
|
||
public static void error(@This CommandContext<CommandSourceStack> context, String message) { | ||
context.error(Component.nullToEmpty(message)); | ||
} | ||
} |
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