1.19.1-pre2
This commit is contained in:
1 parent
6019f812d3
commit
0a00734f65
2 files changed
+8
-7
No files matched your search
@@ -4,6 +4,7 @@ import carpet.CarpetServer;
|
||||
import carpet.network.CarpetClient;
|
||||
import carpet.api.settings.SettingsManager;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -12,21 +13,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@Mixin(LocalPlayer.class)
|
||||
public class LocalPlayer_clientCommandMixin
|
||||
{
|
||||
@Inject(method = "chat", at = @At("HEAD"))
|
||||
private void inspectMessage(String string, CallbackInfo ci)
|
||||
@Inject(method = "commandSigned", at = @At("HEAD"))
|
||||
private void inspectMessage(String string, Component component, CallbackInfo ci)
|
||||
{
|
||||
if (string.startsWith("/call "))
|
||||
if (string.startsWith("call "))
|
||||
{
|
||||
String command = string.substring(6);
|
||||
String command = string.substring(5);
|
||||
CarpetClient.sendClientCommand(command);
|
||||
}
|
||||
if (CarpetServer.minecraft_server == null && !CarpetClient.isCarpet())
|
||||
{
|
||||
LocalPlayer playerSource = (LocalPlayer)(Object) this;
|
||||
CarpetServer.settingsManager.inspectClientsideCommand(playerSource.createCommandSourceStack(), string);
|
||||
CarpetServer.settingsManager.inspectClientsideCommand(playerSource.createCommandSourceStack(), "/"+string);
|
||||
CarpetServer.extensions.forEach(e -> {
|
||||
SettingsManager sm = e.extensionSettingsManager();
|
||||
if (sm != null) sm.inspectClientsideCommand(playerSource.createCommandSourceStack(), string);
|
||||
if (sm != null) sm.inspectClientsideCommand(playerSource.createCommandSourceStack(), "/"+string);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user