Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobp925 committed Mar 23, 2023
0 parents commit 18391a3
Show file tree
Hide file tree
Showing 23 changed files with 1,819 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Project exclude paths
/.idea/
/libs/
/out/
/target/
Binary file added Cinematic Resource Pack.zip
Binary file not shown.
663 changes: 663 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Cinematics

## 📃 About

**Version:** `1.19.3`

> Allows users to create cinematics and chain them together to create cutscenes, intros, tutorials, etc. Unlike other
cinematic plugins, this one supports interpolated spline curves, which means you can add multiple points and have
smooth, non-linear movement between them.

> I originally developed an implementation of this in late 2021. Since then, others have copied it and sold the plugin,
> so I decided to come back and add some extra features for fun.
> I do not plan to regularly update this or provide any extra support.
**Note:** *You may use this on your servers; however, you may not reuse or resell any of the code.*

## 🎉 Features

- Linear & interpolated spline curve cinematics
- Resource pack (Cinematic Resource Pack.zip)
- Adds cinematic bars
- Adds fading
- Hides armorstands
- Per cinematic speed control
- Per cinematic in-game time control
- Chat control
- Disables chat while in cinematics
- Refreshes chat after cinematic ends so players don't miss messages
- Chaining cinematics
- Automatic smooth fading
- API

## 🎥 Video

[![Watch the video](https://img.youtube.com/vi/p_Fy2Jt-RCU/hqdefault.jpg)](https://youtu.be/p_Fy2Jt-RCU)
94 changes: 94 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?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>me.jacob</groupId>
<artifactId>Cinematics</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.19.3-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-mojang
</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>
${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar
</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.19.3-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT:jar:remapped-obf
</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>

<repositories>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
55 changes: 55 additions & 0 deletions src/main/java/me/jacob/cinematics/Cinematics.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package me.jacob.cinematics;

import lombok.Getter;
import me.jacob.cinematics.commands.CinematicsCommand;
import me.jacob.cinematics.handler.ChatHandler;
import me.jacob.cinematics.handler.CinematicHandler;
import me.jacob.cinematics.handler.TitleHandler;
import me.jacob.cinematics.listeners.PlayerListener;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

@Getter
public class Cinematics extends JavaPlugin {

private static Cinematics plugin;

private CinematicHandler cinematicHandler;
private ChatHandler chatHandler;
private TitleHandler titleHandler;

public void onEnable() {
plugin = this;

cinematicHandler = new CinematicHandler();
titleHandler = new TitleHandler();
chatHandler = new ChatHandler();

registerEvents();
registerCommands();

getServer().getConsoleSender().sendMessage("Cinematics has been enabled");
}

@Override
public void onDisable() {
plugin = null;
getServer().getConsoleSender().sendMessage("Cinematics has been disabled");
}

public void registerEvents() {
PluginManager manager = getServer().getPluginManager();
manager.registerEvents(new PlayerListener(), this);
}

public void registerCommands() {
Objects.requireNonNull(getCommand("cinematics")).setExecutor(new CinematicsCommand());
}

public static Cinematics getInstance() {
return plugin;
}

}
33 changes: 33 additions & 0 deletions src/main/java/me/jacob/cinematics/api/CinematicAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package me.jacob.cinematics.api;

import me.jacob.cinematics.objects.CinematicPlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

import java.util.List;

public class CinematicAPI {

/**
* Play a list of cinematics in order
*
* @param player
* @param cinematicNames
*/
public static void playCinematic(@NotNull Player player, @NotNull String... cinematicNames) {
CinematicPlayer cinematicPlayer = CinematicPlayer.getByUUID(player.getUniqueId());
cinematicPlayer.playCinematics(List.of(cinematicNames));
}

/**
* Check if player is in cinematic
*
* @param player
* @return inCinematic
*/
public static boolean isPlayerInCinematic(@NotNull Player player) {
CinematicPlayer cinematicPlayer = CinematicPlayer.getByUUID(player.getUniqueId());
return cinematicPlayer != null && cinematicPlayer.isInCinematic();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package me.jacob.cinematics.api.events;

import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;

/**
* Called when a player exits all cinematics
*/
public class CinematicEndEvent extends PlayerEvent {

private static final HandlerList handlers = new HandlerList();

public CinematicEndEvent(@NotNull final Player player) {
super(player);
}

@Override
public @NotNull HandlerList getHandlers() {
return handlers;
}

@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package me.jacob.cinematics.api.events;

import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;

/**
* Called when a player enters a cinematic
*/
public class CinematicStartEvent extends PlayerEvent implements Cancellable {

private static final HandlerList handlers = new HandlerList();
protected boolean cancel;

public CinematicStartEvent(@NotNull final Player player) {
super(player);
this.cancel = false;
}

@Override
public @NotNull HandlerList getHandlers() {
return handlers;
}

@NotNull
public static HandlerList getHandlerList() {
return handlers;
}

public boolean isCancelled() {
return this.cancel;
}

public void setCancelled(boolean cancel) {
this.cancel = cancel;
}
}
Loading

0 comments on commit 18391a3

Please sign in to comment.