diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java index 47a08602b..c09b9b058 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempInherit.java @@ -55,10 +55,14 @@ public class GroupSetTempInherit extends SubCommand { long duration; try { - duration = DateUtil.parseDateDiff(args.get(1), true); - } catch (DateUtil.IllegalDateException e) { - Message.ILLEGAL_DATE_ERROR.send(sender, args.get(1)); - return CommandResult.INVALID_ARGS; + duration = Long.parseLong(args.get(1)); + } catch (NumberFormatException e) { + try { + duration = DateUtil.parseDateDiff(args.get(1), true); + } catch (DateUtil.IllegalDateException e1) { + Message.ILLEGAL_DATE_ERROR.send(sender, args.get(1)); + return CommandResult.INVALID_ARGS; + } } if (DateUtil.shouldExpire(duration)) { diff --git a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java index 112b2f7ba..17880c09a 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/group/subcommands/GroupSetTempPermission.java @@ -69,10 +69,14 @@ public class GroupSetTempPermission extends SubCommand { long duration; try { - duration = DateUtil.parseDateDiff(args.get(2), true); - } catch (DateUtil.IllegalDateException e) { - Message.ILLEGAL_DATE_ERROR.send(sender, args.get(2)); - return CommandResult.INVALID_ARGS; + duration = Long.parseLong(args.get(2)); + } catch (NumberFormatException e) { + try { + duration = DateUtil.parseDateDiff(args.get(2), true); + } catch (DateUtil.IllegalDateException e1) { + Message.ILLEGAL_DATE_ERROR.send(sender, args.get(2)); + return CommandResult.INVALID_ARGS; + } } if (DateUtil.shouldExpire(duration)) { diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java index 25136a771..a56c2759b 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserAddTempGroup.java @@ -55,11 +55,16 @@ public class UserAddTempGroup extends SubCommand { } long duration; + try { - duration = DateUtil.parseDateDiff(args.get(1), true); - } catch (DateUtil.IllegalDateException e) { - Message.ILLEGAL_DATE_ERROR.send(sender, args.get(1)); - return CommandResult.INVALID_ARGS; + duration = Long.parseLong(args.get(1)); + } catch (NumberFormatException e) { + try { + duration = DateUtil.parseDateDiff(args.get(1), true); + } catch (DateUtil.IllegalDateException e1) { + Message.ILLEGAL_DATE_ERROR.send(sender, args.get(1)); + return CommandResult.INVALID_ARGS; + } } if (DateUtil.shouldExpire(duration)) { diff --git a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java index 6364da96a..e1b5ea9ab 100644 --- a/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java +++ b/common/src/main/java/me/lucko/luckperms/commands/user/subcommands/UserSetTempPermission.java @@ -69,10 +69,14 @@ public class UserSetTempPermission extends SubCommand { long duration; try { - duration = DateUtil.parseDateDiff(args.get(2), true); - } catch (DateUtil.IllegalDateException e) { - Message.ILLEGAL_DATE_ERROR.send(sender, args.get(2)); - return CommandResult.INVALID_ARGS; + duration = Long.parseLong(args.get(2)); + } catch (NumberFormatException e) { + try { + duration = DateUtil.parseDateDiff(args.get(2), true); + } catch (DateUtil.IllegalDateException e1) { + Message.ILLEGAL_DATE_ERROR.send(sender, args.get(2)); + return CommandResult.INVALID_ARGS; + } } if (DateUtil.shouldExpire(duration)) {