本文整理汇总了Python中evennia.server.sessionhandler.SESSIONS.session_from_player方法的典型用法代码示例。如果您正苦于以下问题:Python SESSIONS.session_from_player方法的具体用法?Python SESSIONS.session_from_player怎么用?Python SESSIONS.session_from_player使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类evennia.server.sessionhandler.SESSIONS
的用法示例。
在下文中一共展示了SESSIONS.session_from_player方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_session
# 需要导入模块: from evennia.server.sessionhandler import SESSIONS [as 别名]
# 或者: from evennia.server.sessionhandler.SESSIONS import session_from_player [as 别名]
def get_session(self, sessid):
"""
Return session with given sessid connected to this player.
note that the sessionhandler also accepts sessid as an iterable.
"""
global _SESSIONS
if not _SESSIONS:
from evennia.server.sessionhandler import SESSIONS as _SESSIONS
return _SESSIONS.session_from_player(self, sessid)
示例2: get_session
# 需要导入模块: from evennia.server.sessionhandler import SESSIONS [as 别名]
# 或者: from evennia.server.sessionhandler.SESSIONS import session_from_player [as 别名]
def get_session(self, sessid):
"""
Retrieve given session.
Args:
sessid (int or list): A session id or list of such to retrieve.
Returns:
session (Session or list): One or more Sessions matching
the given `sessid`s while also being connected to this
Player.
"""
global _SESSIONS
if not _SESSIONS:
from evennia.server.sessionhandler import SESSIONS as _SESSIONS
return _SESSIONS.session_from_player(self, sessid)
示例3: get
# 需要导入模块: from evennia.server.sessionhandler import SESSIONS [as 别名]
# 或者: from evennia.server.sessionhandler.SESSIONS import session_from_player [as 别名]
def get(self, sessid=None):
"""
Get the sessions linked to this object.
Args:
sessid (int, optional): Specify a given session by
session id.
Returns:
sessions (list): A list of Session objects. If `sessid`
is given, this is a list with one (or zero) elements.
"""
global _SESSIONS
if not _SESSIONS:
from evennia.server.sessionhandler import SESSIONS as _SESSIONS
if sessid:
return make_iter(_SESSIONS.session_from_player(self.player, sessid))
else:
return _SESSIONS.sessions_from_player(self.player)