30 lines
843 B
Java
30 lines
843 B
Java
package eu.oskar3123.tapemouse.mixin;
|
|
|
|
import eu.oskar3123.tapemouse.TapeMouse;
|
|
import net.minecraft.client.network.ClientPlayerEntity;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
|
|
@Mixin(ClientPlayerEntity.class)
|
|
public class MixinClientPlayerEntity
|
|
{
|
|
|
|
@Inject(at = @At("HEAD"), method = "sendChatMessage(Ljava/lang/String;)V", cancellable = true)
|
|
public void onSendChatMessage(String string, CallbackInfo info)
|
|
{
|
|
if (string == null)
|
|
{
|
|
return;
|
|
}
|
|
String str = string + " ";
|
|
if (str.toLowerCase().startsWith(".tapemouse "))
|
|
{
|
|
TapeMouse.toggle();
|
|
info.cancel();
|
|
}
|
|
}
|
|
|
|
}
|