From a1961d38b8feb1c9d5f50c441deff2c47ed1858c Mon Sep 17 00:00:00 2001 From: Mats Date: Fri, 31 May 2024 17:24:00 +0200 Subject: [PATCH] Resolve issue introduced in last change --- .../subcommands/region/RegionTempSubCommand.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/commands/subcommands/region/RegionTempSubCommand.java b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/commands/subcommands/region/RegionTempSubCommand.java index c9ae03f0f..8cffb1b4d 100644 --- a/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/commands/subcommands/region/RegionTempSubCommand.java +++ b/plugin/src/main/java/com/craftmend/openaudiomc/spigot/modules/commands/subcommands/region/RegionTempSubCommand.java @@ -35,18 +35,17 @@ public void onExecute(User sender, String[] args) { args[1] = args[1].toLowerCase(); - int volume = 100; + int duration = 100; if (args.length == 4) { try { - volume = Integer.parseInt(args[3]); + duration = Integer.parseInt(args[3]); } catch (NumberFormatException e) { - message(sender, ChatColor.RED + "ERROR! Volume must be a number!"); - return; + throw new CommandError("Duration must be a number!"); } } - if (volume < 0 || volume > 100) { - message(sender, ChatColor.RED + "The volume must be between 0 and 100"); + if (duration < 1) { + message(sender, ChatColor.RED + "The duration must at least be one"); return; } @@ -54,13 +53,11 @@ public void onExecute(User sender, String[] args) { throw new CommandError("Invalid source url."); } - int duration = Integer.parseInt(args[3]); - try { WorldApi.getInstance().registerTempRegion( sender.getWorld(), args[1], - new RegionMediaOptions(args[2], volume), + new RegionMediaOptions(args[2], 100), duration ); } catch (UnknownWorldException e) {