Allow expiry timestamp for temporary assignment args
This commit is contained in:
parent
6451175d0e
commit
98b56691dd
@ -55,10 +55,14 @@ public class GroupSetTempInherit extends SubCommand<Group> {
|
|||||||
|
|
||||||
long duration;
|
long duration;
|
||||||
try {
|
try {
|
||||||
duration = DateUtil.parseDateDiff(args.get(1), true);
|
duration = Long.parseLong(args.get(1));
|
||||||
} catch (DateUtil.IllegalDateException e) {
|
} catch (NumberFormatException e) {
|
||||||
Message.ILLEGAL_DATE_ERROR.send(sender, args.get(1));
|
try {
|
||||||
return CommandResult.INVALID_ARGS;
|
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)) {
|
if (DateUtil.shouldExpire(duration)) {
|
||||||
|
@ -69,10 +69,14 @@ public class GroupSetTempPermission extends SubCommand<Group> {
|
|||||||
|
|
||||||
long duration;
|
long duration;
|
||||||
try {
|
try {
|
||||||
duration = DateUtil.parseDateDiff(args.get(2), true);
|
duration = Long.parseLong(args.get(2));
|
||||||
} catch (DateUtil.IllegalDateException e) {
|
} catch (NumberFormatException e) {
|
||||||
Message.ILLEGAL_DATE_ERROR.send(sender, args.get(2));
|
try {
|
||||||
return CommandResult.INVALID_ARGS;
|
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)) {
|
if (DateUtil.shouldExpire(duration)) {
|
||||||
|
@ -55,11 +55,16 @@ public class UserAddTempGroup extends SubCommand<User> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long duration;
|
long duration;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
duration = DateUtil.parseDateDiff(args.get(1), true);
|
duration = Long.parseLong(args.get(1));
|
||||||
} catch (DateUtil.IllegalDateException e) {
|
} catch (NumberFormatException e) {
|
||||||
Message.ILLEGAL_DATE_ERROR.send(sender, args.get(1));
|
try {
|
||||||
return CommandResult.INVALID_ARGS;
|
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)) {
|
if (DateUtil.shouldExpire(duration)) {
|
||||||
|
@ -69,10 +69,14 @@ public class UserSetTempPermission extends SubCommand<User> {
|
|||||||
|
|
||||||
long duration;
|
long duration;
|
||||||
try {
|
try {
|
||||||
duration = DateUtil.parseDateDiff(args.get(2), true);
|
duration = Long.parseLong(args.get(2));
|
||||||
} catch (DateUtil.IllegalDateException e) {
|
} catch (NumberFormatException e) {
|
||||||
Message.ILLEGAL_DATE_ERROR.send(sender, args.get(2));
|
try {
|
||||||
return CommandResult.INVALID_ARGS;
|
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)) {
|
if (DateUtil.shouldExpire(duration)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user