Skip to content

Commit 400a1fe

Browse files
committed
release v0.4
1 parent 2e890f9 commit 400a1fe

File tree

5 files changed

+49
-45
lines changed

5 files changed

+49
-45
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,28 @@ public CameraHandler generatePath() {
4949

5050
Location point = Util.deserializeLocation(raw_point);
5151
Location point_next = Util.deserializeLocation(raw_point_next);
52-
5352

5453
this.camera_path_points.add(point);
5554
for (int j = 0; j < max_points / (raw_camera_move_points.size() - 1) - 1; j++) {
5655
this.camera_path_points.add(translateLinear(point, point_next, j, max_points / (raw_camera_move_points.size() - 1) - 1));
5756
}
5857
}
59-
58+
6059
int command_index = 0;
6160
for (String raw_point : raw_camera_points) {
6261
String type = raw_point.split(":", 2)[0];
6362
String data = raw_point.split(":", 2)[1];
64-
63+
6564
if (type.equalsIgnoreCase("location")) {
6665
command_index += 1;
6766
}
68-
67+
6968
if (type.equalsIgnoreCase("command")) {
7069
int index = ((command_index) * max_points / (raw_camera_move_points.size()) - 1);
7170
index = command_index == 0 ? 0 : index - 1;
7271
index = index < 0 ? 0 : index;
73-
if (!this.camera_path_commands.containsKey(index)) this.camera_path_commands.put(index, new ArrayList<String>());
72+
if (!this.camera_path_commands.containsKey(index))
73+
this.camera_path_commands.put(index, new ArrayList<String>());
7474
this.camera_path_commands.get(index).add(data);
7575
// this.camera_path_commands.put(index, raw_camera_points.get(0));
7676
}
@@ -163,7 +163,7 @@ public void run() {
163163
Location next_point = camera_path_points.get(this.ticks + 1);
164164

165165
player.teleport(camera_path_points.get(this.ticks));
166-
166+
167167
if (camera_path_commands.containsKey(this.ticks)) {
168168
for (String cmd : camera_path_commands.get(this.ticks)) {
169169
String command = cmd.replaceAll("%player%", player.getName());
@@ -196,7 +196,7 @@ public CameraHandler preview(Player player, int num, int preview_time) {
196196

197197
if (num > camera_points.size() - 1)
198198
num = camera_points.size() - 1;
199-
199+
200200
if (!camera_points.get(num).split(":", 2)[0].equalsIgnoreCase("location")) {
201201
player.sendMessage(plugin.getPluginChatPrefix() + ChatColor.RED + "Point " + (num + 1) + " is not a location!");
202202
return this;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ private void setupConfig() {
8585

8686
if (!config_plugin.getConfig().isSet("camera-effects.spectator-mode"))
8787
config_plugin.getConfig().set("camera-effects.spectator-mode", true);
88-
88+
8989
if (!config_plugin.getConfig().isSet("camera-effects.invisible"))
9090
config_plugin.getConfig().set("camera-effects.invisible", false);
91-
91+
9292
if (config_plugin.getConfig().isSet("on-new-player-join-camera-path")) {
9393
config_plugin.getConfig().set("on-join.player-camera-path", config_plugin.getConfig().getString("on-new-player-join-camera-path"));
9494
config_plugin.getConfig().set("on-join.show-once", true);
9595
config_plugin.getConfig().set("on-new-player-join-camera-path", null);
9696
}
97-
97+
9898
for (String camera_name : config_cameras.getCameras()) {
9999
List<String> points = config_cameras.getPoints(camera_name);
100100
List<String> new_points = new ArrayList<String>();

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
2929
help_messages.add(tellrawbase.replaceAll("%arg%", "create <name>").replaceAll("%help%", "Create a new camera path").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
3030
help_messages.add(tellrawbase.replaceAll("%arg%", "remove <name>").replaceAll("%help%", "Remove a camera path").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
3131
help_messages.add(tellrawbase.replaceAll("%arg%", "addpoint").replaceAll("%help%", "Add an point to a camera path").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
32+
help_messages.add(tellrawbase.replaceAll("%arg%", "addcommand <command>").replaceAll("%player%", sender.getName()).replaceAll("%help%", "Add an command to a camera path, %player% gets replaced with the player's name").replaceAll("%cmd%", commandLabel));
3233
help_messages.add(tellrawbase.replaceAll("%arg%", "delpoint [point_number]").replaceAll("%help%", "Remove an point from acamera path").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
3334
help_messages.add(tellrawbase.replaceAll("%arg%", "select <name>").replaceAll("%help%", "Select a camera path by name").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
3435
help_messages.add(tellrawbase.replaceAll("%arg%", "preview <point_number>").replaceAll("%help%", "Preview a point on the selected camera path").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
3536
help_messages.add(tellrawbase.replaceAll("%arg%", "info").replaceAll("%help%", "Info about the currently selected camera path").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
3637
help_messages
3738
.add(tellrawbase.replaceAll("%arg%", "setduration <duration>").replaceAll("%help%", "Set the total duration of the current camera path").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
3839
help_messages.add(tellrawbase.replaceAll("%arg%", "start").replaceAll("%help%", "Run the camera").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
40+
help_messages.add(tellrawbase.replaceAll("%arg%", "stop").replaceAll("%help%", "Stop the camera").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
3941
help_messages.add(tellrawbase.replaceAll("%arg%", "stats").replaceAll("%help%", "Show plugin stats").replaceAll("%player%", sender.getName()).replaceAll("%cmd%", commandLabel));
4042

4143
help_messages.add(
@@ -51,16 +53,18 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
5153
} else {
5254
sender.sendMessage(ChatColor.BLUE + "===" + ChatColor.DARK_AQUA + "----------" + ChatColor.AQUA + plugin.getPluginDescriptionFile().getName() + ChatColor.DARK_AQUA + "----------" + ChatColor.BLUE + "===");
5355

54-
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.GREEN + "/" + commandLabel + " create <name>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Create a new camera path");
55-
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.GREEN + "/" + commandLabel + " remove <name>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Remove a camera path");
56-
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.GREEN + "/" + commandLabel + " stats" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Show plugin stats");
56+
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " create <name>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Create a new camera path");
57+
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " remove <name>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Remove a camera path");
5758
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " addpoint" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Add an point to a camera path");
59+
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " addcommand <command>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Add an command to a camera path, %player% gets replaced with the player's name");
5860
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " delpoint [point_number]" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Remove an point from a camera path");
5961
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " select <name>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Select a camera path by name");
6062
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " preview <point_number>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Preview a point on the selected camera path");
6163
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " info" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Info about the currently selected camera path");
6264
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " setduration <duration>" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Set the total duration of the current camera path");
6365
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " start" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Run the camera");
66+
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.RED + "/" + commandLabel + " stop" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Stop the camera");
67+
sender.sendMessage(ChatColor.BLACK + "[" + ChatColor.GREEN + "/" + commandLabel + " stats" + ChatColor.BLACK + "] " + ChatColor.DARK_GREEN + "Show plugin stats");
6468

6569
sender.sendMessage(ChatColor.BLUE + "===" + ChatColor.DARK_AQUA + "-------------------------------" + ChatColor.BLUE + "===");
6670
}

PowerCamera/src/nl/svenar/powercamera/config/CameraStorage.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private void createConfigFile() {
4545
public FileConfiguration getConfig() {
4646
return this.config;
4747
}
48-
48+
4949
public void saveConfig() {
5050
try {
5151
this.config.save(this.configFile);
@@ -57,22 +57,22 @@ public void saveConfig() {
5757
public boolean create_camera(String camera_name) {
5858
if (camera_exists(camera_name))
5959
return false;
60-
60+
6161
getConfig().set("cameras." + camera_name + ".duration", 10);
6262
getConfig().set("cameras." + camera_name + ".points", new ArrayList<String>());
6363
saveConfig();
6464
return true;
6565
}
66-
66+
6767
public boolean remove_camera(String camera_name) {
6868
if (!camera_exists(camera_name))
6969
return false;
70-
70+
7171
getConfig().set("cameras." + get_camera_name_ignorecase(camera_name), null);
7272
saveConfig();
7373
return true;
7474
}
75-
75+
7676
public boolean camera_exists(String camera_name) {
7777
boolean exists = false;
7878
for (String cam : getConfig().getConfigurationSection("cameras").getKeys(false)) {
@@ -83,7 +83,7 @@ public boolean camera_exists(String camera_name) {
8383
}
8484
return exists;
8585
}
86-
86+
8787
public String get_camera_name_ignorecase(String input_name) {
8888
String camera_name = null;
8989
for (String cam : getConfig().getConfigurationSection("cameras").getKeys(false)) {
@@ -98,46 +98,46 @@ public String get_camera_name_ignorecase(String input_name) {
9898
public void camera_addpoint(Location location, String camera_name) {
9999
if (!camera_exists(camera_name))
100100
return;
101-
101+
102102
String new_point = "location:" + Util.serializeLocation(location);
103-
103+
104104
List<String> camera_points = getConfig().getStringList("cameras." + get_camera_name_ignorecase(camera_name) + ".points");
105105
camera_points.add(new_point);
106-
106+
107107
getConfig().set("cameras." + get_camera_name_ignorecase(camera_name) + ".points", camera_points);
108108
saveConfig();
109109
}
110-
110+
111111
public void camera_addcommand(String command, String camera_name) {
112112
if (!camera_exists(camera_name))
113-
return;
114-
113+
return;
114+
115115
String new_point = "command:" + command;
116-
116+
117117
List<String> camera_points = getConfig().getStringList("cameras." + get_camera_name_ignorecase(camera_name) + ".points");
118118
camera_points.add(new_point);
119-
119+
120120
getConfig().set("cameras." + get_camera_name_ignorecase(camera_name) + ".points", camera_points);
121121
saveConfig();
122122
}
123-
123+
124124
public void camera_removepoint(String camera_name, int num) {
125125
if (!camera_exists(camera_name))
126126
return;
127-
127+
128128
List<String> camera_points = getConfig().getStringList("cameras." + get_camera_name_ignorecase(camera_name) + ".points");
129-
129+
130130
if (num < 0)
131131
num = 0;
132-
132+
133133
if (num > camera_points.size() - 1)
134134
num = camera_points.size() - 1;
135-
135+
136136
if (camera_points.size() > 0) {
137137
if (num == -1)
138138
num = camera_points.size() - 1;
139139
camera_points.remove(num);
140-
140+
141141
getConfig().set("cameras." + get_camera_name_ignorecase(camera_name) + ".points", camera_points);
142142
saveConfig();
143143
}
@@ -146,37 +146,37 @@ public void camera_removepoint(String camera_name, int num) {
146146
public List<String> getPoints(String camera_name) {
147147
if (!camera_exists(camera_name))
148148
return null;
149-
149+
150150
return getConfig().getStringList("cameras." + get_camera_name_ignorecase(camera_name) + ".points");
151151
}
152152

153153
public boolean setDuration(String camera_name, int duration) {
154154
if (!camera_exists(camera_name))
155155
return false;
156-
156+
157157
getConfig().set("cameras." + get_camera_name_ignorecase(camera_name) + ".duration", duration);
158158
saveConfig();
159159
return true;
160-
160+
161161
}
162-
162+
163163
public int getDuration(String camera_name) {
164164
if (!camera_exists(camera_name))
165165
return -1;
166-
166+
167167
return getConfig().getInt("cameras." + get_camera_name_ignorecase(camera_name) + ".duration");
168168
}
169169

170170
public Set<String> getCameras() {
171171
return getConfig().getConfigurationSection("cameras").getKeys(false);
172172
}
173-
173+
174174
public boolean addPlayer(UUID uuid) {
175175
List<String> players = getConfig().getStringList("players");
176-
176+
177177
if (!players.contains(uuid.toString())) {
178178
players.add(uuid.toString());
179-
179+
180180
getConfig().set("players", players);
181181
saveConfig();
182182
return true;

PowerCamera/src/nl/svenar/powercamera/config/PluginConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ private void createConfigFile() {
3636
e.printStackTrace();
3737
}
3838
}
39-
39+
4040
public FileConfiguration getConfig() {
41-
return this.config;
42-
}
43-
41+
return this.config;
42+
}
43+
4444
public void saveConfig() {
4545
try {
4646
this.config.save(this.configFile);

0 commit comments

Comments
 (0)