本文整理匯總了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();
}