BetterPerspective
The BetterPerspective integration provides the unlock camera permission.
Adding the Dependency
The BetterPerspective integration is shipped with all official server platform integration artifacts. If you are using the core
artifact, you can add the following dependency to your project:
Important Note
For the examples below, VERSION
with the version you want to use. The latest version can be found here:
dependencies {
compileOnly("net.labymod.serverapi.integration:betterperspective:VERSION")
}
dependencies {
compileOnly "net.labymod.serverapi.integration:betterperspective:VERSION"
}
<dependencies>
<dependency>
<groupId>net.labymod.serverapi.integration</groupId>
<artifactId>betterperspective</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>
Unlock Camera Permission
While not necessary to use, the integration provides a constant for the unlock camera permission methods to toggle the permission easily.
Note
The Unlock Camera permission is enabled by default.
Via BetterPerspectivePlayer
// Get the LabyModPlayer
LabyModPlayer labyModPlayer = LabyModProtocolService.get().getPlayer(uniqueId);
// Get the BetterPerspectivePlayer
BetterPerspectivePlayer betterPerspectivePlayer = labyModPlayer.getIntegrationPlayer(
BetterPerspectivePlayer.class
);
// Disable the permission
betterPerspectivePlayer.denyUnlockCamera();
// Get the LabyModPlayer
LabyModPlayer labyModPlayer = LabyModProtocolService.get().getPlayer(uniqueId);
// Get the BetterPerspectivePlayer
BetterPerspectivePlayer betterPerspectivePlayer = labyModPlayer.getIntegrationPlayer(
BetterPerspectivePlayer.class
);
// Enable the permission
betterPerspectivePlayer.allowUnlockCamera();
Via the LabyModProtocol
// Get the LabyModProtocol
LabyModProtocol labyModProtocol = LabyModProtocolService.get().labyModProtocol();
// Send the packet
labyModProtocol.sendPacket(uniqueId, new PermissionPacket(
BetterPerspectiveIntegration.UNLOCK_CAMERA_PERMISSION.deny()
));
// Get the LabyModProtocol
LabyModProtocol labyModProtocol = LabyModProtocolService.get().labyModProtocol();
// Send the packet
labyModProtocol.sendPacket(uniqueId, new PermissionPacket(
BetterPerspectiveIntegration.UNLOCK_CAMERA_PERMISSION.allow()
));