本文整理匯總了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);
}
}
示例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.";
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例9: decode
import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public AsProxyResult decode(StatusCode statusCode, ByteBuf buffer) {
return new AsProxyResult(statusCode);
}
示例10: decode
import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public NotifyPlayerResult decode(StatusCode statusCode, ByteBuf buffer) {
return new NotifyPlayerResult(statusCode);
}
示例11: decode
import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public AuthenticateResult decode(StatusCode statusCode, ByteBuf buffer) {
return new AuthenticateResult(statusCode);
}
示例12: decode
import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public MessageResult decode(StatusCode statusCode, ByteBuf buffer) {
return new MessageResult(statusCode);
}
示例13: decode
import lilypad.client.connect.api.result.StatusCode; //導入依賴的package包/類
public RedirectResult decode(StatusCode statusCode, ByteBuf buffer) {
return new RedirectResult(statusCode);
}
示例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;
}
示例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;
}