diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e26c15a --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +Copyright (c) 2023 unurled +All rights reserved. \ No newline at end of file diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..2471c2e --- /dev/null +++ b/Readme.md @@ -0,0 +1,35 @@ +# Cutscenes + + A minecraft plugin that makes cutscenes... + +## How to use + +### Create a cutscene + +To create a cutscene, you need to create a folder in the `plugins/ScaredRealms/cutscenes` folder. The folder can be named anything, i recommend that the folder is the name of the cutscene.Inside this folder, make a file named `cutscene.yml`. +Here's an example : +```yaml +name: "Cutscene name" +id: "TUTORIAL" +start: "world,10,10,10,5,5" +end: "world,20,20,20,150,150" +markers: + - "1" + - "2" + - "3" +``` + +A Location is composed of the world name, the x, y and z coordinates and the yaw and pitch. + +The `name` is the name of the cutscene, the `id` is the id of the cutscene (must be without space and unique), the `start` is the start location of the cutscene, the `end` is the end location of the cutscene and the `markers` is a list of markers of the cutscene. +Next create folders for each marker. In this example we have 3 markers, so we need to create 3 folders named `1`, `2` and `3`. In each folder, create a file named `marker.yml`. Here's an example : +```yaml +id: "1" +cutscene_id: "tutorial" +start: "world,10,10,10,5,5" +timeBetweenFrames: "50" +overAllTime: "25000" +``` + +The `id` is the id of the marker (must be without space and unique), the `cutscene_id` is the id of the cutscene, the `start` is the start location of the cutscene, the `timeBetweenFrames` is the time between each frame in milliseconds and the `overAllTime` is the time of the cutscene in milliseconds. +In this marker, every frames will be 50 miliseconds or 1 minecraft tick, due to a minecraft limitation we can't go under 1 tick or 50 milliseconds. \ No newline at end of file diff --git a/build.gradle b/build.gradle index ca8c200..c5b340b 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'me.unurled.sacredrealms' -version = '0.1.0' +version = '0.1.1' def minecraft_version = '1.20.1' repositories { diff --git a/src/main/java/me/unurled/sacredrealms/cutscenes/parse/MarkerParser.java b/src/main/java/me/unurled/sacredrealms/cutscenes/parse/MarkerParser.java index 264c4b2..384afed 100644 --- a/src/main/java/me/unurled/sacredrealms/cutscenes/parse/MarkerParser.java +++ b/src/main/java/me/unurled/sacredrealms/cutscenes/parse/MarkerParser.java @@ -73,24 +73,6 @@ public class MarkerParser { return null; } } - if (file.contains("frames")) { // frames: [ "0,world,x,y,z,yaw,pitch", "1,world,x,y,z,yaw,pitch", ... ] - for (String frames : file.getStringList("markers")) { - try { - String[] frame = frames.split(","); - x = Double.parseDouble(frame[2]); - y = Double.parseDouble(frame[3]); - z = Double.parseDouble(frame[4]); - yaw = Float.parseFloat(frame[5]); - pitch = Float.parseFloat(frame[6]); - Location location = new Location(Bukkit.getWorld(frame[1]), x, y, z, yaw, pitch); - marker.addFrame(new Frame(location, Integer.parseInt(frame[0]))); - } catch (Exception e) { - Cutscenes.getLOGGER().error("Error while parsing cutscene " + id + " frame ID: " + frames + " " + e.getMessage()); - return null; - } - - } - } return marker; } }