Search in sources :

Example 1 with ChatEvent

use of baritone.api.event.events.ChatEvent in project baritone by cabaletta.

the class MixinEntityPlayerSP method sendChatMessage.

@Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
private void sendChatMessage(String msg, CallbackInfo ci) {
    ChatEvent event = new ChatEvent(msg);
    IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this);
    if (baritone == null) {
        return;
    }
    baritone.getGameEventHandler().onSendChatMessage(event);
    if (event.isCancelled()) {
        ci.cancel();
    }
}
Also used : IBaritone(baritone.api.IBaritone) ChatEvent(baritone.api.event.events.ChatEvent) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 2 with ChatEvent

use of baritone.api.event.events.ChatEvent in project Spark-Client by Spark-Client-Development.

the class MixinEntityPlayerSP method sendChatMessage.

@Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
private void sendChatMessage(String msg, CallbackInfo ci) {
    ChatEvent event = new ChatEvent(msg);
    IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this);
    if (baritone == null) {
        return;
    }
    baritone.getGameEventHandler().onSendChatMessage(event);
    if (event.isCancelled()) {
        ci.cancel();
    }
}
Also used : IBaritone(baritone.api.IBaritone) ChatEvent(baritone.api.event.events.ChatEvent) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

IBaritone (baritone.api.IBaritone)2 ChatEvent (baritone.api.event.events.ChatEvent)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2