- Added both 1.17- files and 1.18 files to same download.
- Optimized region handler. (Still work to be done though)
- Added API
Code (Text):
public class CinematicStudioAPI {
//Check if player is currently in a cutscene
public static boolean isInCutscene(Player p) {
return CutsceneMode.isPlayerInCutsceneMode(p);
}
//Get a cutscene object
public static Cutscene getCutscene(Player p, String name) {
DataPath dataPath = new DataPath(name, Standards.PATH_TO_CUTSCENES);
if(!DataHandler.checkIfFileExists(dataPath)) {
return null;
}
return new Cutscene(dataPath, p);
}
public static Cutscene getCurrentCutscene(Player p) {
if(CutsceneMode.cutsceneLink.containsKey(p.getUniqueId())) {
return CutsceneMode.cutsceneLink.get(p.getUniqueId());
}
return null;
}
//Example #1: Play a cutscene
public static Cutscene playCutscene(Player p, String name) {
Cutscene cutscene = CinematicStudioAPI.getCutscene(p, name);
if(cutscene == null) {
return null;
}
//Integer argument determines at what node the cutscene starts
cutscene.startCutscene(0);
CutsceneMode.setPlayerCutsceneMode(p, true, cutscene);
return cutscene;
}
//Example #2: Pause a cutscene
public static void pauseCutscene(Player p) {
Cutscene cutscene = CinematicStudioAPI.getCurrentCutscene(p);
if(cutscene == null) {
return;
}
cutscene.setIsPaused(true);
}
//Example #3: Stop a cutscene
public static void stopCutscene(Player p) {
Cutscene cutscene = CinematicStudioAPI.getCurrentCutscene(p);
if(cutscene == null) {
return;
}
//Boolean argument 1 = Whether this is called by server reloading.
//Boolean argument 2 = Whether the cutscene should loop
cutscene.stopCutscene(false, false);
}
}