Security Cameras API [1.15 - 1.16] [Friendly Camera API for Developers]
- Native Minecraft Version:
- Tested Minecraft Versions:
- Source Code:
- Fefo6644, PulseBeat_02, Conclure
Security Cameras API is one of the best Security Camera API you will get, featuring many options for developers who like coding around security cameras. Features include a well-formatted readable code friendly for developers to work around, an active Github which has committed often being pushed, and discord for support if you require assistance. The code is open source and can be located here, which contains both the API and the example plugin we have provided to point users in the right direction. To use the API, download the jar provided in the Spigot resource and shade it inside your plugin.
What do Security Cameras look like; Security Cameras API relies on the idea of using Armorstands which are invisible and have a "Camera" as its head.
Security Cameras API also uses another one of our libraries, Simple NPC Framework which can be located here. You may ask, why do we must include NPC's in this library? Well the answer is that when a player uses a Camera, a fake NPC with the same exact look as the player is placed at the same location the player was originally in. The actual player is tied to the camera and put into spectator mode, so it looks like on their screen they are viewing the camera, but on other player's screens, they just see the NPC. We have originally used Citizens, but because the library is very heavy and bulky for an API like this, we have proceeded to create our own NPC library which would be used for our plugins. You do not have to add this other API into your workspace, it has already been shaded into the Security Camera API.
The class which is needed for the API to be useful is the CameraManager class, which can be defined using a constructor that accepts a Plugin instance which you pass in (for your own plugin) and a File which is needed to store the necessary configurations the camera requires.
Once you are done defining your CameraManager class, adding a camera is as convienant as
and removing a camera is as simple asCode (Text):CameraManager#addCamera(Location loc, String name)Cameras are saved in the indicated file in YAML format, which gets updated as cameras are created and deleted asynchronously to not block the main server thread with IO operations.Code (Text):CameraManager#removeCamera(Location loc, String name)
Camera data load is also made asynchronously and will be cached upon CameraManager creation.
To use a camera, you would use theto add a watcher to a camera. Cameras by default support multiple watchers at once. In order to remove a watcher from a Camera, use theCode (Text):CameraManager#addWatcher(Player player, Camera camera)method which will either force remove or normally remove a player from a camera view. By default, sneaking will let the player out of the Camera, and teleport the player to its original location.Code (Text):CameraManager#removeWatcher(Player player, boolean forceRemove)
In addition to methods, there are also events as well such as the CameraSetEvent, CameraDestroyEvent, CameraEnterEvent, and CameraExitEvent.
And that's pretty much it. We will be adding more features as we go on, but check out our organization's website located at https://ponclure.github.io, which contains all of our projects and source code made by collaborative developers. I hope this API is useful!