From 3064ac86e3f806f20c68ff6c67d58d5f4bbb4e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=99=A8=E8=BF=91?= Date: Wed, 18 Nov 2020 17:04:10 +0800 Subject: [PATCH] =?UTF-8?q?Session=E5=A2=9E=E5=8A=A0clientId=E6=B3=A8?= =?UTF-8?q?=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/github/yezhihao/netmc/session/Session.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/yezhihao/netmc/session/Session.java b/src/main/java/io/github/yezhihao/netmc/session/Session.java index fc0fb2e..18358ae 100644 --- a/src/main/java/io/github/yezhihao/netmc/session/Session.java +++ b/src/main/java/io/github/yezhihao/netmc/session/Session.java @@ -1,10 +1,10 @@ package io.github.yezhihao.netmc.session; +import io.github.yezhihao.netmc.core.model.Header; import io.netty.channel.Channel; import io.netty.util.AttributeKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.github.yezhihao.netmc.core.model.Header; import java.util.Collection; import java.util.Map; @@ -81,6 +81,17 @@ public class Session { sessionManager.put(clientId, this); } + public void register(Object clientId) { + this.register(clientId, null); + } + + public void register(Object clientId, Object subject) { + this.clientId = clientId; + this.registered = true; + this.subject = subject; + sessionManager.put(clientId, this); + } + public Object getClientId() { return clientId; }