當前位置: 首頁>>代碼示例>>Java>>正文


Java StatusCode類代碼示例

本文整理匯總了Java中lilypad.client.connect.api.result.StatusCode的典型用法代碼示例。如果您正苦於以下問題:Java StatusCode類的具體用法?Java StatusCode怎麽用?Java StatusCode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StatusCode類屬於lilypad.client.connect.api.result包,在下文中一共展示了StatusCode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: decode

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public GetPlayersResult decode(StatusCode statusCode, ByteBuf buffer) {
	if(statusCode == StatusCode.SUCCESS) {
		boolean hasList = buffer.readBoolean();
		int currentPlayers = buffer.readUnsignedShort();
		int maximumPlayers = buffer.readUnsignedShort();
		Set<String> players = new HashSet<String>();
		if(hasList) {
			for(int i = 0; i < currentPlayers; i++) {
				players.add(BufferUtils.readString(buffer));
			}
		}
		return new GetPlayersResult(currentPlayers, maximumPlayers, players);
	} else {
		return new GetPlayersResult(statusCode);
	}
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:17,代碼來源:GetPlayersResultDecoder.java

示例2: docs

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public static String docs() {
	return "A class of functions to use with LilyPad. It is highly recommended to not run some of this functions on the main thread,"
		+ " but asynchronously with the x_new_thread function. Somes of this functions are in fact request to the network,"
		+ " so they will always return an array, whose one of the keys will be always present, the 'status' key, whose the value"
		+ " can only be one of " + StringUtils.Join(StatusCode.values(), ", ", ", or ", " or ") + ", " + StatusCode.INVALID_ROLE
		+ " means that the request failed because you do not have the required role on the network to make the request, and "
		+ StatusCode.INVALID_GENERIC + " means that the request failed due to the arguments you passed to the request.";
}
 
開發者ID:King-Fisher,項目名稱:CHLilyPad,代碼行數:9,代碼來源:LilyPadFunctions.java

示例3: dispatchResult

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public <T extends Result> void dispatchResult(int id, StatusCode statusCode, ByteBuf buffer) {
	FutureResultImpl<T> futureResult = this.pendingFutures.remove(id);
	if(futureResult == null) {
		return;
	}
	ResultDecoder<?> resultDecoder = ConnectResultDecoderRegistry.instance.getByResult(futureResult.getResultClass());
	if(resultDecoder == null) {
		return; // encoder without decoder? fail safe anyway
	}
	futureResult.notifyResult((T) resultDecoder.decode(statusCode, buffer));
	if(buffer != null) {
		buffer.release();
	}
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:16,代碼來源:ConnectImpl.java

示例4: decode

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public AsServerResult decode(StatusCode statusCode, ByteBuf buffer) {
	if(statusCode == StatusCode.SUCCESS) {
		return new AsServerResult(BufferUtils.readString(buffer));
	} else {
		return new AsServerResult(statusCode);
	}
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:8,代碼來源:AsServerResultDecoder.java

示例5: decode

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public GetKeyResult decode(StatusCode statusCode, ByteBuf buffer) {
	if(statusCode == StatusCode.SUCCESS) {
		return new GetKeyResult(BufferUtils.readString(buffer));
	} else {
		return new GetKeyResult(statusCode);
	}
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:8,代碼來源:GetKeyResultDecoder.java

示例6: decode

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public GetWhoamiResult decode(StatusCode statusCode, ByteBuf buffer) {
	if(statusCode == StatusCode.SUCCESS) {
		return new GetWhoamiResult(BufferUtils.readString(buffer));
	} else {
		return new GetWhoamiResult(statusCode);
	}
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:8,代碼來源:GetWhoamiResultDecoder.java

示例7: decode

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public GetDetailsResult decode(StatusCode statusCode, ByteBuf buffer) {
	if(statusCode == StatusCode.SUCCESS) {
		return new GetDetailsResult(BufferUtils.readString(buffer), buffer.readUnsignedShort(), BufferUtils.readString(buffer), BufferUtils.readString(buffer));
	} else {
		return new GetDetailsResult(statusCode);
	}
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:8,代碼來源:GetDetailsResultDecoder.java

示例8: channelRead0

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
@Override
protected void channelRead0(ChannelHandlerContext context, Packet packet) throws Exception {
	switch(packet.getOpcode()) {
	case 0x00:
		context.writeAndFlush(packet);
		break;
	case 0x02:
		ResultPacket resultPacket = (ResultPacket) packet;
		StatusCode statusCode;
		switch(resultPacket.getStatusCode()) {
		case ConnectPacketConstants.statusSuccess:
			statusCode = StatusCode.SUCCESS;
			break;
		case ConnectPacketConstants.statusInvalidRole:
			statusCode = StatusCode.INVALID_ROLE;
			break;
		case ConnectPacketConstants.statusInvalidGeneric:
		default:
			statusCode = StatusCode.INVALID_GENERIC;
			break;
		}
		this.connect.dispatchResult(resultPacket.getId(), statusCode, resultPacket.getPayload());
		break;
	case 0x03:
		MessagePacket messagePacket = (MessagePacket) packet;
		MessageEvent messageEvent = new MessageEvent(messagePacket.getSender(), messagePacket.getChannel(), BufferUtils.readBytes(messagePacket.getPayload(), messagePacket.getPayload().readableBytes()));
		messagePacket.getPayload().release();
		this.connect.dispatchMessageEvent(new lilypad.client.connect.api.MessageEvent(messageEvent));
		this.connect.dispatchEvent(messageEvent);
		break;
	case 0x04:
		RedirectPacket redirectPacket = (RedirectPacket) packet;
		RedirectEvent redirectEvent = new RedirectEvent(redirectPacket.getServer(), redirectPacket.getPlayer());
		this.connect.dispatchRedirectEvent(new lilypad.client.connect.api.RedirectEvent(redirectEvent));
		this.connect.dispatchEvent(redirectEvent);
		break;
	case 0x05:
		ServerPacket serverPacket = (ServerPacket) packet;
		if(serverPacket.isAdding()) {
			ServerAddPacket serverAddPacket = (ServerAddPacket) serverPacket;
			ServerAddEvent serverAddEvent = new ServerAddEvent(serverAddPacket.getServer(), serverAddPacket.getSecurityKey(), new InetSocketAddress(serverAddPacket.getAddress(), serverAddPacket.getPort()));
			this.connect.dispatchServerAddEvent(new lilypad.client.connect.api.ServerAddEvent(serverAddEvent));
			this.connect.dispatchEvent(serverAddEvent);
		} else {
			ServerRemoveEvent serverRemoveEvent = new ServerRemoveEvent(serverPacket.getServer());
			this.connect.dispatchServerRemoveEvent(serverPacket.getServer());
			this.connect.dispatchEvent(serverRemoveEvent);
		}
		break;
	default:
		context.close(); // invalid packet
		break;
	}
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:55,代碼來源:ConnectNetworkHandler.java

示例9: decode

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public AsProxyResult decode(StatusCode statusCode, ByteBuf buffer) {
	return new AsProxyResult(statusCode);
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:4,代碼來源:AsProxyResultDecoder.java

示例10: decode

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public NotifyPlayerResult decode(StatusCode statusCode, ByteBuf buffer) {
	return new NotifyPlayerResult(statusCode);
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:4,代碼來源:NotifyPlayerResultDecoder.java

示例11: decode

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public AuthenticateResult decode(StatusCode statusCode, ByteBuf buffer) {
	return new AuthenticateResult(statusCode);
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:4,代碼來源:AuthenticateResultDecoder.java

示例12: decode

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public MessageResult decode(StatusCode statusCode, ByteBuf buffer) {
	return new MessageResult(statusCode);
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:4,代碼來源:MessageResultDecoder.java

示例13: decode

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public RedirectResult decode(StatusCode statusCode, ByteBuf buffer) {
	return new RedirectResult(statusCode);
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:4,代碼來源:RedirectResultDecoder.java

示例14: GetDetailsResult

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
/**
 * Showing the result was successful, passing the data
 * to accompany the result.
 * 
 * @param ip of the result
 * @param port of the result
 * @param motd of the result
 * @param version of the result
 */
public GetDetailsResult(String ip, int port, String motd, String version) {
	super(StatusCode.SUCCESS);
	this.ip = ip;
	this.port = port;
	this.motd = motd;
	this.version = version;
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:17,代碼來源:GetDetailsResult.java

示例15: GetPlayersResult

import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
/**
 * Showing the result was successful, passing the data
 * to accompany the result.
 * 
 * @param currentPlayers
 * @param maximumPlayers
 * @param players
 */
public GetPlayersResult(int currentPlayers, int maximumPlayers, Set<String> players) {
	super(StatusCode.SUCCESS);
	this.currentPlayers = currentPlayers;
	this.maximumPlayers = maximumPlayers;
	this.players = players;
}
 
開發者ID:LilyPad,項目名稱:JLilyPad,代碼行數:15,代碼來源:GetPlayersResult.java


注:本文中的lilypad.client.connect.api.result.StatusCode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。