当前位置: 首页>>代码示例>>Python>>正文


Python API.registerHelp方法代码示例

本文整理汇总了Python中api.API.registerHelp方法的典型用法代码示例。如果您正苦于以下问题:Python API.registerHelp方法的具体用法?Python API.registerHelp怎么用?Python API.registerHelp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在api.API的用法示例。


在下文中一共展示了API.registerHelp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from api import API [as 别名]
# 或者: from api.API import registerHelp [as 别名]

#.........这里部分代码省略.........
						for group in self.permissions["users"][uuid]["groups"]:
							player.message("- %s" % group)
						player.message("&aUser '%s' is granted these individual permissions (not including permissions inherited from groups): " % username)
						for node in self.permissions["users"][uuid]["permissions"]:
							value = self.permissions["users"][uuid]["permissions"][node]
							if value == True:
								player.message("- %s: &2%s" % (node, value))
							elif value == False:
								player.message("- %s: &4%s" % (node, value))
							else:
								player.message("- %s: &7%s" % (node, value))
					else:
						usage("users <username> <group/set/info>")
				else:
					usage("<groups/users/RESET> (Note: RESET is case-sensitive!)")
					player.message("&cAlias commands: /perms, /perm, /super")
				return False
		return True
	def getUUID(self, name):
		f = open("usercache.json", "r")
		data = json.loads(f.read())
		f.close()
		for u in data:
			if u["name"] == name:
				return u["uuid"]
		return False
	def start(self):
		self.configManager.loadConfig()
		self.config = self.configManager.config
		signal.signal(signal.SIGINT, self.SIGINT)
		signal.signal(signal.SIGTERM, self.SIGINT)
		
		self.api = API(self, "Wrapper.py")
		self.api.registerHelp("Wrapper", "Internal Wrapper.py commands ", [
			("/wrapper [update/memory/halt]", "If no subcommand is provided, it'll show the Wrapper version.", None),
			("/plugins", "Show a list of the installed plugins", None),
			("/permissions <groups/users/RESET>", "Command used to manage permission groups and users, add permission nodes, etc.", None),
			("/playerstats", "Show the most active players.", None)
		])
		
		self.server = Server(sys.argv, self.log, self.configManager.config, self)
		self.server.init()
		
		self.loadPlugins()
		
		if self.config["IRC"]["irc-enabled"]:
			self.irc = IRC(self.server, self.config, self.log, self, self.config["IRC"]["server"], self.config["IRC"]["port"], self.config["IRC"]["nick"], self.config["IRC"]["channels"])
			t = threading.Thread(target=self.irc.init, args=())
			t.daemon = True
			t.start()
		if self.config["Web"]["web-enabled"]:
			if web.IMPORT_SUCCESS:
				self.web = web.Web(self)
				t = threading.Thread(target=self.web.wrap, args=())
				t.daemon = True
				t.start()
			else:
				self.log.error("Web remote could not be started because you do not have the required modules installed: pkg_resources")
				self.log.error("Hint: http://stackoverflow.com/questions/7446187")
		if len(sys.argv) < 2:
			wrapper.server.args = wrapper.configManager.config["General"]["command"].split(" ")
		else:
			wrapper.server.args = sys.argv[1:]
		
		consoleDaemon = threading.Thread(target=self.console, args=())
		consoleDaemon.daemon = True
开发者ID:gitter-badger,项目名称:minecraft-wrapper,代码行数:70,代码来源:__main__.py


注:本文中的api.API.registerHelp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。