Added brightness to hue

This commit is contained in:
stijnb1234 2020-05-19 10:54:31 +02:00
parent bbb34a47c9
commit 86217acca6

View file

@ -66,7 +66,7 @@ public class MCTPAudioCmd implements CommandExecutor {
sender.sendMessage(prefix + "Gestart met afspelen!");
return true;
} else if (args.length == 6 && args[0].equalsIgnoreCase("hue")) {
} else if ((args.length == 6 || args.length == 7) && args[0].equalsIgnoreCase("hue")) {
int r;
int g;
int b;
@ -79,6 +79,21 @@ public class MCTPAudioCmd implements CommandExecutor {
return true;
}
int brightness = 0;
if (args.length == 7) {
try {
brightness = Integer.parseInt(args[6]);
} catch (IllegalArgumentException ex) {
sender.sendMessage(prefix + args[6] + " is geen correcte brightness.");
return true;
}
if (brightness < 0 || brightness > 255) {
sender.sendMessage(prefix + args[6] + " is geen correcte brightness.");
return true;
}
}
HueType type;
try {
type = HueType.valueOf(args[5].toUpperCase());
@ -110,6 +125,7 @@ public class MCTPAudioCmd implements CommandExecutor {
data.put("task", "HUE");
data.put("rgb", r + ":" + g + ":" + b);
data.put("type", type.name());
if (brightness != 0) data.put("brightness", brightness);
data.put("uuid", p.getUniqueId().toString().replace("-", ""));
Main.getClient().sendData(data);
}