diff --git a/src/me/mctp/MCTPAudioCmd.java b/src/me/mctp/MCTPAudioCmd.java index 4904b51..0664f0f 100644 --- a/src/me/mctp/MCTPAudioCmd.java +++ b/src/me/mctp/MCTPAudioCmd.java @@ -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); }