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


Java SourceServer类代码示例

本文整理汇总了Java中com.github.koraktor.steamcondenser.steam.servers.SourceServer的典型用法代码示例。如果您正苦于以下问题:Java SourceServer类的具体用法?Java SourceServer怎么用?Java SourceServer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SourceServer类属于com.github.koraktor.steamcondenser.steam.servers包,在下文中一共展示了SourceServer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getInfo

import com.github.koraktor.steamcondenser.steam.servers.SourceServer; //导入依赖的package包/类
/**
 * Queries the server for its information and game rules.
 * 
 * @return a HashMap of all of the server's information and game rules
 * @see TimeoutException
 * @see SteamCondenserException
 * @see UnknownHostException
 */
public HashMap<String, String> getInfo() {
	
	try {
		server = new SourceServer(InetAddress.getAllByName(mIPaddress)[0], queryport);
		server.initialize();

		gameport = "" + server.getServerInfo().get("serverPort");					
		ping = "" + server.getPing();

		HashMap<String, Object> sinfo = server.getServerInfo();
		mMaxPlayers = "" + sinfo.get("maxPlayers");
		mCurrentPlayers = "" + sinfo.get("numberOfPlayers");
		mMap = "" + sinfo.get("mapName");
		mName = "" + sinfo.get("serverName");
		
		HashMap<String, String> rules = server.getRules();
		mHasPassword = rules.get(ChivServer.RULE_PASSWORD);
		mMinRank = rules.get(ChivServer.RULE_MIN_RANK);
		mMaxRank = rules.get(ChivServer.RULE_MAX_RANK);
		mPerspective = rules.get(ChivServer.RULE_PERSPECTIVE);
	} catch (TimeoutException | SteamCondenserException | UnknownHostException e) {}

	HashMap<String, String> ret = new HashMap<String, String>();
	ret.put("gameport", gameport);
	ret.put("ping", ping);
	ret.put("maxplayers", mMaxPlayers);
	ret.put("currentplayers", mCurrentPlayers);
	ret.put("haspassword", mHasPassword);
	ret.put("minrank", mMinRank);
	ret.put("maxrank", mMaxRank);
	ret.put("map", mMap);
	ret.put("name", mName);
	ret.put("perspective", mPerspective);
	ret.put("ip", mIPaddress);
	ret.put("queryport", "" + queryport);
	
	return ret;
}
 
开发者ID:tranek,项目名称:ChivalryServerBrowser,代码行数:47,代码来源:QueryServerCondenser.java

示例2: getPlayers

import com.github.koraktor.steamcondenser.steam.servers.SourceServer; //导入依赖的package包/类
/**
 * Gets the currently connected players, their scores, and their time connected.
 * 
 * @return a HashMap of the {@link SteamPlayer} connected
 */
public HashMap<String, SteamPlayer> getPlayers() {
	try {
		server = new SourceServer(InetAddress.getAllByName(ip)[0], queryport);
		HashMap<String, SteamPlayer> players = server.getPlayers();
		return players;
	} catch (NumberFormatException | UnknownHostException
			| SteamCondenserException | TimeoutException e) {}
	return null;
}
 
开发者ID:tranek,项目名称:ChivalryServerBrowser,代码行数:15,代码来源:ServerQuery.java

示例3: getInfo

import com.github.koraktor.steamcondenser.steam.servers.SourceServer; //导入依赖的package包/类
/**
 * Gets the information of the server.
 * 
 * @return a HashMap of the server's information
 */
public HashMap<String, Object> getInfo() {
	try {
		server = new SourceServer(InetAddress.getAllByName(ip)[0], queryport);
		HashMap<String, Object> info = server.getServerInfo();
		return info;
	} catch (NumberFormatException | UnknownHostException
			| SteamCondenserException | TimeoutException e) {}
	return null;
}
 
开发者ID:tranek,项目名称:ChivalryServerBrowser,代码行数:15,代码来源:ServerQuery.java

示例4: getRules

import com.github.koraktor.steamcondenser.steam.servers.SourceServer; //导入依赖的package包/类
/**
 * Gets the game rules for the server.
 * 
 * @return a HashMap of the game rules
 */
public HashMap<String, String> getRules() {
	try {
		server = new SourceServer(InetAddress.getAllByName(ip)[0], queryport);
		HashMap<String, String> rules = server.getRules();
		return rules;
	} catch (NumberFormatException | UnknownHostException
			| SteamCondenserException | TimeoutException e) {}
	return null;
}
 
开发者ID:tranek,项目名称:ChivalryServerBrowser,代码行数:15,代码来源:ServerQuery.java


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