我目前正在尝试使用其API设置Beam
交互式应用,但我遇到了问题。
BeamAPI beam = new BeamAPI("oauthtoken");
BeamUser user = beam.use(UsersService.class).getCurrent().get();
pro.beam.interactive.robot.Robot robot = new RobotBuilder()
.channel(user.channel)
.build(beam, false)
.get();
robot.on(Protocol.Report.class, report -> {
// If we have any joysticks in the report
if (report.getJoystickCount() > 0) {
// Get the coordMean from the joystick
Protocol.Coordinate coordMean = report.getJoystick(0).getCoordMean();
Point mousePosition = MouseInfo.getPointerInfo().getLocation();
// Apply it to the current mouse position, if its values are not NaN
if (!Double.isNaN(coordMean.getX()) && !Double.isNaN(coordMean.getY())) {
}
}
});
}
问题是诸如getJoystickCount
之类的方法没有显示并且没有被解析,但是如果我将语言级别设置为java 7,则所有方法都会正确显示但代码不会因为它使用了来自Java 8的lambda。
为java 8以及项目设置设置所有maven设置,并对Protocol
类进行反编译,所有方法都在那里。
可能导致此问题的原因是什么?
这是我的POM文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>beamplays</groupId>
<artifactId>splix</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>beam-releases</id>
<url>https://maven.beam.pro/content/repositories/releases/</url>
</repository>
<repository>
<id>beam-snapshots</id>
<url>https://maven.beam.pro/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>pro.beam</groupId>
<artifactId>api</artifactId>
<version>3.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>pro.beam</groupId>
<artifactId>interactive</artifactId>
<version>1.5.1-SNAPSHOT</version>
</dependency>
</dependencies>
答案 0 :(得分:0)
我尝试运行代码,即使出现错误,并且在添加一切工作正常后,得到了一个NoClassDefFoundError请求Google Protobuf。