本文整理汇总了Java中lilypad.client.connect.api.request.RequestException类的典型用法代码示例。如果您正苦于以下问题:Java RequestException类的具体用法?Java RequestException怎么用?Java RequestException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestException类属于lilypad.client.connect.api.request包,在下文中一共展示了RequestException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LilyPadWrapper
import lilypad.client.connect.api.request.RequestException; //导入依赖的package包/类
public LilyPadWrapper(@Nonnull Connect connect) {
this.connect = connect;
messenger = new AbstractMessenger(
(channel, message) -> {
try {
connect.request(new MessageRequest(Collections.emptyList(), channel, message));
} catch (RequestException | UnsupportedEncodingException e) {
e.printStackTrace();
}
},
channel -> {
if (listening.getAndSet(true)) {
return;
}
try {
connect.registerEvents(this);
} catch (Exception e) {
listening.set(false);
}
},
channel -> {}
);
}
示例2: exec
import lilypad.client.connect.api.request.RequestException; //导入依赖的package包/类
@Override
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException {
String username, password, key;
if (args.length == 1) {
ConnectSettings settings = CHLilyPadStatic.getConnect(t).getSettings();
username = settings.getUsername();
password = settings.getPassword();
key = args[0].val();
} else {
username = args[0].val();
password = args[1].val();
key = args[2].val();
}
try {
return CHLilyPadStatic.evaluate(CHLilyPadStatic.getConnect(t).request(new AuthenticateRequest(username, password, key)).awaitUninterruptibly(), t);
} catch (RequestException ex) {
throw new ConfigRuntimeException(ex.getMessage(), Exceptions.ExceptionType.PluginInternalException, t);
}
}
示例3: redirectPlayer
import lilypad.client.connect.api.request.RequestException; //导入依赖的package包/类
@Override
public void redirectPlayer(@Nonnull String serverId, @Nonnull String playerUsername) {
try {
connect.request(new RedirectRequest(serverId, playerUsername));
} catch (RequestException e) {
e.printStackTrace();
}
}
示例4: resendLocalPlayers
import lilypad.client.connect.api.request.RequestException; //导入依赖的package包/类
public void resendLocalPlayers() throws RequestException {
this.localPlayersLock.lock();
try {
for(String player : this.localPlayers) {
this.connect.request(new NotifyPlayerRequest(true, player));
}
} finally {
this.localPlayersLock.unlock();
}
}
示例5: notifyPlayerLeave
import lilypad.client.connect.api.request.RequestException; //导入依赖的package包/类
public void notifyPlayerLeave(String player) {
this.localPlayersLock.lock();
try {
this.localPlayers.remove(player);
} finally {
this.localPlayersLock.unlock();
}
try {
this.connect.request(new NotifyPlayerRequest(false, player));
} catch(RequestException exception) {
// ignore
}
}
示例6: queryPlayers
import lilypad.client.connect.api.request.RequestException; //导入依赖的package包/类
public boolean queryPlayers() throws RequestException, InterruptedException {
GetPlayersResult result = this.connect.request(new GetPlayersRequest(false)).await(10000L);
if(result == null) {
return false;
}
this.playerCount = result.getCurrentPlayers();
this.playerMaximum = result.getMaximumPlayers();
return true;
}