mirror of
https://code.chipmunk.land/ChomeNS/chipmunkmod.git
synced 2025-11-13 18:46:15 +00:00
fix: make .say .something actually make the player say .something in chat instead of running a command
This commit is contained in:
parent
e13b035b10
commit
cf428682a2
2 changed files with 6 additions and 7 deletions
|
|
@ -2,6 +2,7 @@ package land.chipmunk.chipmunkmod.mixin;
|
|||
|
||||
import com.google.gson.JsonObject;
|
||||
import land.chipmunk.chipmunkmod.ChipmunkMod;
|
||||
import land.chipmunk.chipmunkmod.command.CommandManager;
|
||||
import land.chipmunk.chipmunkmod.data.ChomeNSBotCommand;
|
||||
import land.chipmunk.chipmunkmod.modules.ChomeNSBotCommandSuggestions;
|
||||
import land.chipmunk.chipmunkmod.util.BotValidationUtilities;
|
||||
|
|
@ -38,6 +39,7 @@ public abstract class ChatScreenMixin {
|
|||
|
||||
@Inject(method = "sendMessage", at = @At("HEAD"), cancellable = true)
|
||||
private void sendMessage (final String chatText, final boolean addToHistory, final CallbackInfo ci) {
|
||||
final CommandManager commandManager = CommandManager.INSTANCE;
|
||||
final MinecraftClient client = MinecraftClient.getInstance();
|
||||
|
||||
if (addToHistory) {
|
||||
|
|
@ -101,6 +103,10 @@ public abstract class ChatScreenMixin {
|
|||
} catch (final Exception ignored) {
|
||||
}
|
||||
}
|
||||
} else if (chatText.startsWith(commandManager.prefix)) {
|
||||
commandManager.executeCommand(chatText.substring(commandManager.prefix.length()));
|
||||
ci.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (client.player == null) return;
|
||||
|
|
|
|||
|
|
@ -126,13 +126,6 @@ public abstract class ClientPlayNetworkHandlerMixin {
|
|||
|
||||
@Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
|
||||
private void sendChatMessage (final String content, final CallbackInfo ci) {
|
||||
final CommandManager commandManager = CommandManager.INSTANCE;
|
||||
if (content.startsWith(commandManager.prefix)) {
|
||||
commandManager.executeCommand(content.substring(commandManager.prefix.length()));
|
||||
ci.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Chat.NEXT_CHAT_PLAYER.get()) {
|
||||
Chat.NEXT_CHAT_PLAYER.set(false);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue