本文整理汇总了Python中hypershade.usersession.UserSessionManager.items方法的典型用法代码示例。如果您正苦于以下问题:Python UserSessionManager.items方法的具体用法?Python UserSessionManager.items怎么用?Python UserSessionManager.items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hypershade.usersession.UserSessionManager
的用法示例。
在下文中一共展示了UserSessionManager.items方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: simpleMasterRequest
# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import items [as 别名]
def simpleMasterRequest(caller):
#check for other privileged people
privileged=[(session,user) for session,user in UserSessionManager.items() if session[0]=='ingame' and user[1]!='']
if len(privileged)==0:
setSimpleMaster(caller)
else:
playerCS.executeby(caller,"echo PermissionError: There are masters/admins present.")
raise PermissionError("There are masters/admins present.")
示例2: takeMaster
# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import items [as 别名]
def takeMaster(caller):
"""This command takes master from the person that currently has it."""
masters=[session for session,user in UserSessionManager.items() if session[0]=='ingame' and user[1]=='master']
for master in masters:
playerCS.executeby(master,"relinquish; logout")
示例3: voteMap
# 需要导入模块: from hypershade.usersession import UserSessionManager [as 别名]
# 或者: from hypershade.usersession.UserSessionManager import items [as 别名]
def voteMap(caller,mode,name):
otherplayers=[(session,user) for session,user in UserSessionManager.items() if session[0]=='ingame' and session!=caller]
if len(otherplayers)==0:
systemCS.executestring("map %s %s" % (name,mode))