RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Session.java
1package com.osroyale.net.session;
2
3import com.osroyale.Config;
4import io.netty.channel.Channel;
5import io.netty.channel.ChannelFuture;
6
7import java.net.InetSocketAddress;
8
44
45public class Session {
46
50 protected final Channel channel;
51
55 protected final String host;
56
63 public Session(Channel channel) {
64 this.channel = channel;
65 this.host = ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
66 }
67
71 public final void close() {
72 onClose(channel.close());
73 }
74
81 protected void onClose(ChannelFuture future) {
82
83 }
84
91 public void handleClientPacket(Object o) {
92
93 }
94
100 public Channel getChannel() {
101 return channel;
102 }
103
107 public String getHost() {
108 final Channel channel = getChannel();
109 if (channel != null && channel.hasAttr(Config.SOURCE_ADDRESS)) {
110 return channel.attr(Config.SOURCE_ADDRESS).get();
111 }
112 return host;
113 }
114
115}
void onClose(ChannelFuture future)
Definition Session.java:81
void handleClientPacket(Object o)
Definition Session.java:91