Skip to content

Commit c98f721

Browse files
committed
Release v0.3
1 parent 664df79 commit c98f721

8 files changed

Lines changed: 52 additions & 18 deletions

File tree

PowerCamera/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,4 @@ local.properties
9494
hs_err_pid*
9595

9696
# End of https://www.toptal.com/developers/gitignore/api/eclipse,java
97+
/target/

PowerCamera/config.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
# -------------------- PowerCamera --------------------
1+
# --------------------------------- PowerCamera ---------------------------------
22
# Create cinematic views on your server
3-
# -----------------------------------------------------
4-
# point-preview-time
3+
# -------------------------------------------------------------------------------
4+
# point-preview-time
55
# Set the preview duration of a point in seconds
6-
# -----------------------------------------------------
7-
# on-new-player-join-camera-path
8-
# Show a camera path when a new player joins
9-
# -----------------------------------------------------
6+
# -------------------------------------------------------------------------------
7+
# on-join
8+
# player-camera-path: The camera path to show when a new player joins
9+
# show-once: true, show the camera path once for new players
10+
# show-once: false, show the camera path always when a players joins
11+
# -------------------------------------------------------------------------------
12+
# camera-effects
13+
# invisible: Set the player as invisible while the camera is active
14+
# spectator-mode: Set the player as spectator while the camera is active
15+
# -------------------------------------------------------------------------------
1016

1117
point-preview-time: 5
12-
on-new-player-join-camera-path: ""
18+
on-join:
19+
player-camera-path: ''
20+
show-once: true
21+
camera-effects:
22+
invisible: false
23+
spectator-mode: true

PowerCamera/src/nl/svenar/powercamera/Util.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static Location deserializeLocation(String input) {
3232
}
3333

3434
public static int timeStringToSecondsConverter(String time_input) {
35-
Matcher regex_int = Pattern.compile("^\\d+[^a-zA-Z]$").matcher(time_input);
35+
Matcher regex_int = Pattern.compile("^\\d+[^a-zA-Z]{0,1}$").matcher(time_input);
3636

3737
Matcher regex_seconds = Pattern.compile("\\d+[sS]").matcher(time_input);
3838
Matcher regex_minutes = Pattern.compile("\\d+[mM]").matcher(time_input);

PowerCamera/src/nl/svenar/powercamera/commands/cmd_create.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.bukkit.ChatColor;
44
import org.bukkit.command.Command;
55
import org.bukkit.command.CommandSender;
6+
import org.bukkit.entity.Player;
67

78
import nl.svenar.powercamera.PowerCamera;
89

@@ -19,7 +20,9 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
1920
String camera_name = args[0];
2021
if (plugin.getConfigCameras().create_camera(camera_name)) {
2122
sender.sendMessage(plugin.getPluginChatPrefix() + ChatColor.GREEN + "Camera '" + camera_name + "' created!");
22-
sender.sendMessage(plugin.getPluginChatPrefix() + ChatColor.GREEN + "Select this camera by doing: /" + commandLabel + " select " + camera_name + "");
23+
// sender.sendMessage(plugin.getPluginChatPrefix() + ChatColor.GREEN + "Select this camera by doing: /" + commandLabel + " select " + camera_name + "");
24+
plugin.player_selected_camera.put((Player) sender, plugin.getConfigCameras().get_camera_name_ignorecase(camera_name));
25+
sender.sendMessage(plugin.getPluginChatPrefix() + ChatColor.GREEN + "Camera '" + camera_name + "' selected!");
2326
} else {
2427
sender.sendMessage(plugin.getPluginChatPrefix() + ChatColor.RED + "A camera with the name '" + camera_name + "' already exists!");
2528
}

PowerCamera/src/nl/svenar/powercamera/commands/cmd_help.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
5555
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.GREEN + "/" + commandLabel + " remove <name>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Remove a camera path");
5656
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.GREEN + "/" + commandLabel + " stats" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Show plugin stats");
5757
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " addpoint" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Add an point to a camera path");
58-
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " delpoint [point_number]" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Remove an point from acamera path");
58+
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " delpoint [point_number]" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Remove an point from a camera path");
5959
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " select <name>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Select a camera path by name");
6060
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " preview <point_number>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Preview a point on the selected camera path");
6161
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " info" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Info about the currently selected camera path");

PowerCamera/src/nl/svenar/powercamera/commands/cmd_preview.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,23 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
4444
GameMode previous_gamemode = ((Player) sender).getGameMode();
4545
Location previous_player_location = ((Player) sender).getLocation();
4646
Location point = Util.deserializeLocation(camera_points.get(num));
47-
// boolean previous_invisible = ((Player) sender).isInvisible();
47+
boolean previous_invisible = ((Player) sender).isInvisible();
4848

4949
plugin.player_camera_mode.put((Player) sender, PowerCamera.CAMERA_MODE.PREVIEW);
50-
((Player) sender).setGameMode(GameMode.SPECTATOR);
51-
// ((Player) sender).setInvisible(true);
50+
if (this.plugin.getConfigPlugin().getConfig().getBoolean("camera-effects.spectator-mode"))
51+
((Player) sender).setGameMode(GameMode.SPECTATOR);
52+
if (this.plugin.getConfigPlugin().getConfig().getBoolean("camera-effects.invisible"))
53+
((Player) sender).setInvisible(true);
5254
((Player) sender).teleport(point);
5355

5456
new BukkitRunnable() {
5557
@Override
5658
public void run() {
5759
((Player) sender).teleport(previous_player_location);
58-
((Player) sender).setGameMode(previous_gamemode);
59-
// ((Player) sender).setInvisible(previous_invisible);
60+
if (plugin.getConfigPlugin().getConfig().getBoolean("camera-effects.spectator-mode"))
61+
((Player) sender).setGameMode(previous_gamemode);
62+
if (plugin.getConfigPlugin().getConfig().getBoolean("camera-effects.invisible"))
63+
((Player) sender).setInvisible(previous_invisible);
6064
plugin.player_camera_mode.put((Player) sender, PowerCamera.CAMERA_MODE.NONE);
6165
sender.sendMessage(plugin.getPluginChatPrefix() + ChatColor.GREEN + "Preview ended!");
6266
}

PowerCamera/src/nl/svenar/powercamera/commands/cmd_stats.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
2626
format.setTimeZone(TimeZone.getTimeZone("UTC"));
2727
Instant current_time = Instant.now();
2828

29+
String invisibility_mode = "None";
30+
31+
if (this.plugin.getConfigPlugin().getConfig().getBoolean("camera-effects.spectator-mode") && this.plugin.getConfigPlugin().getConfig().getBoolean("camera-effects.invisible")) {
32+
invisibility_mode = "spectator & invisible";
33+
} else {
34+
if (this.plugin.getConfigPlugin().getConfig().getBoolean("camera-effects.spectator-mode")) {
35+
invisibility_mode = "specator";
36+
}
37+
38+
if (this.plugin.getConfigPlugin().getConfig().getBoolean("camera-effects.invisible")) {
39+
invisibility_mode = "invisible";
40+
}
41+
}
42+
2943
sender.sendMessage(ChatColor.BLUE + "===" + ChatColor.DARK_AQUA + "----------" + ChatColor.AQUA + plugin.getPluginDescriptionFile().getName() + ChatColor.DARK_AQUA + "----------" + ChatColor.BLUE + "===");
3044
sender.sendMessage(ChatColor.DARK_GREEN + "Server version: " + ChatColor.GREEN + Bukkit.getVersion());
3145
sender.sendMessage(ChatColor.DARK_GREEN + "Bukkit version: " + ChatColor.GREEN + Bukkit.getServer().getBukkitVersion());
@@ -34,6 +48,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
3448
sender.sendMessage(ChatColor.DARK_GREEN + "Plugin uptime: " + ChatColor.GREEN + format.format(Duration.between(plugin.powercamera_start_time, current_time).toMillis()));
3549
sender.sendMessage(ChatColor.DARK_GREEN + "Registered cameras: " + ChatColor.GREEN + plugin.getConfigCameras().getCameras().size());
3650
sender.sendMessage(ChatColor.DARK_GREEN + "Registered players: " + ChatColor.GREEN + plugin.getConfigCameras().getPlayers().size());
51+
sender.sendMessage(ChatColor.DARK_GREEN + "Invisibility mode: " + ChatColor.GREEN + invisibility_mode);
3752
sender.sendMessage(ChatColor.BLUE + "===" + ChatColor.DARK_AQUA + "-------------------------------" + ChatColor.BLUE + "===");
3853

3954
} else {

PowerCamera/src/nl/svenar/powercamera/events/OnJoin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public OnJoin(PowerCamera plugin) {
1818

1919
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false)
2020
public void onPlayerMove(PlayerJoinEvent e) {
21-
if (this.plugin.getConfigCameras().addPlayer(e.getPlayer().getUniqueId())) {
22-
String camera_name = this.plugin.getConfigPlugin().getConfig().getString("on-new-player-join-camera-path");
21+
if (this.plugin.getConfigCameras().addPlayer(e.getPlayer().getUniqueId()) || !this.plugin.getConfigPlugin().getConfig().getBoolean("on-join.show-once")) {
22+
String camera_name = this.plugin.getConfigPlugin().getConfig().getString("on-join.player-camera-path");
2323
if (camera_name.length() > 0) {
2424
if (this.plugin.getConfigCameras().camera_exists(camera_name)) {
2525
new CameraHandler(plugin, e.getPlayer(), camera_name).generatePath().start();

0 commit comments

Comments
 (0)