RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
SendInputMessage.java
1package com.osroyale.net.packet.out;
2import com.osroyale.net.packet.OutgoingPacket;
3import com.osroyale.net.packet.PacketType;
4import com.osroyale.net.codec.ByteModification;
5import com.osroyale.game.world.entity.mob.player.Player;
6
7import java.util.Optional;
8import java.util.function.Consumer;
9
39
40public class SendInputMessage extends OutgoingPacket {
41
42 private final Consumer<String> action;
43 private final String inputMessage;
44 private final int inputLength;
45
46 public SendInputMessage(String message, int length, Consumer<String> action) {
47 super(187, PacketType.VAR_SHORT);
48 this.action = action;
49 this.inputMessage = message;
50 this.inputLength = length;
51 }
52
53 @Override
54 public boolean encode(Player player) {
55 player.enterInputListener = Optional.of(action);
56 builder.writeString(inputMessage)
57 .writeShort(inputLength, ByteModification.ADD);
58 return true;
59 }
60
61}