本文整理汇总了Java中pro.beam.api.exceptions.BeamException类的典型用法代码示例。如果您正苦于以下问题:Java BeamException类的具体用法?Java BeamException怎么用?Java BeamException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BeamException类属于pro.beam.api.exceptions包,在下文中一共展示了BeamException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUser
import pro.beam.api.exceptions.BeamException; //导入依赖的package包/类
public BeamUser getUser(BeamAPI beam) throws BeamException {
String username = this.config.getString("beam.auth.username");
String password = this.config.getString("beam.auth.password");
String twoFactor = this.config.getString("beam.auth.twoFactor");
Game.minecraftUsername = this.config.getString("minecraft.username");
CheckedFuture<BeamUser, BeamException> task;
if (twoFactor == null) {
task = beam.use(UsersService.class).login(username, password);
} else {
task = beam.use(UsersService.class).login(username, password, twoFactor);
}
return task.checkedGet();
}
示例2: findRelationship
import pro.beam.api.exceptions.BeamException; //导入依赖的package包/类
public CheckedFuture<ChannelStatusResponse, BeamException> findRelationship(BTBBeamChannel channel, BTBBeamUser user) {
return new Channels.StatusChecker(this.beam.gson).check(this.get(
String.format("%d/relationship", channel.id),
ChannelStatusResponse.class,
BeamHttpClient.getArgumentsBuilder()
.put("user", String.valueOf(user.id))
.build()
));
}
示例3: start
import pro.beam.api.exceptions.BeamException; //导入依赖的package包/类
public void start() throws ExecutionException, InterruptedException, BeamException {
BeamUser user = this.bridge.getUser(this.beam);
BeamChat chat = this.beam.use(ChatService.class).findOne(this.channel).get();
BeamChatConnectable connectable = chat.makeConnectable(this.beam);
connectable.connectBlocking();
connectable.send(AuthenticateMessage.from(user.channel, user, chat.authkey));
connectable.on(IncomingMessageEvent.class, incomingMessageHandler());
}
示例4: authenticate
import pro.beam.api.exceptions.BeamException; //导入依赖的package包/类
/**
* Prepares the given instance of the BeamAPI (see: Java Client; https://githuib.com/WatchBeam/beam-client-java)
* by authenticating it with the API so that it may fetch robot network credentials later (see #findCredentials).
*
* @param beam The API that will be prepared.
* @return The prepared version of that API.
*
* @throws BeamException Thrown if invalid credentials are given with which to login.
*/
protected BeamAPI authenticate(BeamAPI beam) throws BeamException {
UsersService users = beam.use(UsersService.class);
CheckedFuture<BeamUser, BeamException> loginTask = null;
if (this.builder.twoFactor != null) {
loginTask = users.login(this.builder.username, this.builder.password, this.builder.twoFactor);
} else {
loginTask = users.login(this.builder.username, this.builder.password);
}
loginTask.checkedGet();
return beam;
}
示例5: findCredentials
import pro.beam.api.exceptions.BeamException; //导入依赖的package包/类
/**
* Finds the robot's credentials for the given channel in a blocking fashion.
*
* @param beam The API to work with.
* @return The asked for credentials.
*
* @throws ExecutionException
* @throws InterruptedException
*/
protected RobotInfo findCredentials(BeamAPI beam) throws BeamException, ExecutionException, InterruptedException {
return beam.use(TetrisService.class).getRobotCredentials(this.builder.channel).checkedGet();
}