Added brightness to hue
This commit is contained in:
parent
bbb34a47c9
commit
86217acca6
1 changed files with 17 additions and 1 deletions
|
@ -66,7 +66,7 @@ public class MCTPAudioCmd implements CommandExecutor {
|
||||||
|
|
||||||
sender.sendMessage(prefix + "Gestart met afspelen!");
|
sender.sendMessage(prefix + "Gestart met afspelen!");
|
||||||
return true;
|
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 r;
|
||||||
int g;
|
int g;
|
||||||
int b;
|
int b;
|
||||||
|
@ -79,6 +79,21 @@ public class MCTPAudioCmd implements CommandExecutor {
|
||||||
return true;
|
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;
|
HueType type;
|
||||||
try {
|
try {
|
||||||
type = HueType.valueOf(args[5].toUpperCase());
|
type = HueType.valueOf(args[5].toUpperCase());
|
||||||
|
@ -110,6 +125,7 @@ public class MCTPAudioCmd implements CommandExecutor {
|
||||||
data.put("task", "HUE");
|
data.put("task", "HUE");
|
||||||
data.put("rgb", r + ":" + g + ":" + b);
|
data.put("rgb", r + ":" + g + ":" + b);
|
||||||
data.put("type", type.name());
|
data.put("type", type.name());
|
||||||
|
if (brightness != 0) data.put("brightness", brightness);
|
||||||
data.put("uuid", p.getUniqueId().toString().replace("-", ""));
|
data.put("uuid", p.getUniqueId().toString().replace("-", ""));
|
||||||
Main.getClient().sendData(data);
|
Main.getClient().sendData(data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue