RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
ButtonClickPacketListener.java
1package com.osroyale.net.packet.in;
2
3import com.osroyale.content.event.EventDispatcher;
4import com.osroyale.content.event.impl.ClickButtonInteractionEvent;
5import com.osroyale.game.event.impl.ButtonClickEvent;
6import com.osroyale.game.plugin.PluginManager;
7import com.osroyale.game.world.entity.mob.data.PacketType;
8import com.osroyale.game.world.entity.mob.player.Player;
9import com.osroyale.game.world.entity.mob.player.PlayerRight;
10import com.osroyale.net.packet.ClientPackets;
11import com.osroyale.net.packet.GamePacket;
12import com.osroyale.net.packet.PacketListener;
13import com.osroyale.net.packet.PacketListenerMeta;
14import com.osroyale.net.packet.out.SendMessage;
15
45
47
48 @Override
49 public void handlePacket(final Player player, GamePacket packet) {
50 final int button = packet.readShort();
51
52 if (player.isDead()) {
53 return;
54 }
55
56 if (player.locking.locked(PacketType.CLICK_BUTTON, button)) {
57 return;
58 }
59
60
61 // player.message("Currently not available");
62
63 if (PlayerRight.isDeveloper(player) || PlayerRight.isOwner(player)) {
64 player.send(new SendMessage(String.format("[%s]: button=%d", ButtonClickPacketListener.class.getSimpleName(), button)));
65 System.out.println(String.format("[%s]: button=%d", ButtonClickPacketListener.class.getSimpleName(), button));
66 }//save it plz theres no save button with intellij
67
68
69 if (EventDispatcher.execute(player, new ClickButtonInteractionEvent(button))) {
70 return;
71 }
72
73 PluginManager.getDataBus().publish(player, new ButtonClickEvent(button));
74 }
75}
void handlePacket(final Player player, GamePacket packet)