Basic Autoreply (#429)

Warning: Don't send yourself a message because it will repeatedly reply, leading to a kick.
Reply message not configurable so maybe add support in future.
This commit is contained in:
Bella Who 2020-03-03 16:31:44 +00:00 committed by GitHub
parent f314dd1fe5
commit 4ec845e14d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
package me.zeroeightsix.kami.module.modules.misc;
import java.util.function.Predicate;
import me.zeroeightsix.kami.util.Wrapper;
import net.minecraft.network.play.server.SPacketChat;
import me.zero.alpine.listener.EventHandler;
import me.zeroeightsix.kami.event.events.PacketEvent;
import me.zero.alpine.listener.Listener;
import me.zeroeightsix.kami.module.Module;
@Module.Info(name = "AutoReply", description = "automatically replies to private messages", category = Module.Category.MISC)
public class AutoReply extends Module
{
@EventHandler
public Listener<PacketEvent.Receive> receiveListener;
public AutoReply() {
this.receiveListener = new Listener<PacketEvent.Receive>(event -> {
if (event.getPacket() instanceof SPacketChat && ((SPacketChat)event.getPacket()).getChatComponent().getUnformattedText().contains("whispers:")) {
Wrapper.getPlayer().sendChatMessage("/r Kami Blue On Top");
}
}, (Predicate<PacketEvent.Receive>[])new Predicate[0]);
}
}