Fixed number related argument checks being too strict.
This commit is contained in:
@@ -80,7 +80,7 @@ public final class TrackScheduler extends AudioEventAdapter {
|
||||
}
|
||||
|
||||
public final void removeFromQueue(final int index) {
|
||||
Checks.positive(index, "Index");
|
||||
Checks.notNegative(index, "Index");
|
||||
|
||||
logger.info("Track '" + queue.remove(index).getTrack().getInfo().title + "' has been removed from the queue in "
|
||||
+ this.guild.getName() + " (" + this.guild.getId() + ").");
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class CommandResponse {
|
||||
}
|
||||
|
||||
public final CommandResponse setDeletionDelay(final long delay, final TimeUnit unit) {
|
||||
Checks.positive(delay, "Delay");
|
||||
Checks.notNegative(delay, "Delay");
|
||||
Checks.notNull(unit, "Unit");
|
||||
|
||||
this.deletionDelay = delay;
|
||||
@@ -83,7 +83,7 @@ public final class CommandResponse {
|
||||
}
|
||||
|
||||
public final CommandResponse setReactionCallbackExpireDelay(final long delay, final TimeUnit unit) {
|
||||
Checks.positive(delay, "Delay");
|
||||
Checks.notNegative(delay, "Delay");
|
||||
Checks.notNull(unit, "Unit");
|
||||
|
||||
this.expireDelay = delay;
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class ReactionCallbackManager {
|
||||
|
||||
public static final void executeCallback(final long messageID, final TextChannel channel, final Member reactor,
|
||||
final String emoji) {
|
||||
Checks.positive(messageID, "Message ID");
|
||||
Checks.notNegative(messageID, "Message ID");
|
||||
Checks.notNull(channel, "Channel");
|
||||
Checks.notNull(reactor, "Reactor");
|
||||
Checks.notEmpty(emoji, "Emoji");
|
||||
|
||||
@@ -30,7 +30,7 @@ public final class Scheduler {
|
||||
|
||||
public static final ScheduledFuture<?> schedule(final Runnable runnable, final long delay, final TimeUnit unit) {
|
||||
Checks.notNull(runnable, "Runnable");
|
||||
Checks.positive(delay, "Delay");
|
||||
Checks.notNegative(delay, "Delay");
|
||||
Checks.notNull(unit, "Unit");
|
||||
|
||||
return pool.schedule(runnable, delay, unit);
|
||||
@@ -39,8 +39,8 @@ public final class Scheduler {
|
||||
public static final ScheduledFuture<?> scheduleRepeating(final Runnable runnable, final long initialDelay,
|
||||
final long period, final TimeUnit unit) {
|
||||
Checks.notNull(runnable, "Runnable");
|
||||
Checks.positive(initialDelay, "Initial delay");
|
||||
Checks.positive(period, "Period");
|
||||
Checks.notNegative(initialDelay, "Initial delay");
|
||||
Checks.notNegative(period, "Period");
|
||||
Checks.notNull(unit, "Unit");
|
||||
|
||||
return pool.scheduleAtFixedRate(runnable, initialDelay, period, unit);
|
||||
|
||||
@@ -81,7 +81,7 @@ public final class StringUtil {
|
||||
}
|
||||
|
||||
public static final String formatTime(final long milliseconds) {
|
||||
Checks.positive(milliseconds, "Milliseconds");
|
||||
Checks.notNegative(milliseconds, "Milliseconds");
|
||||
|
||||
final long second = (milliseconds / 1000) % 60;
|
||||
final long minute = (milliseconds / (1000 * 60)) % 60;
|
||||
|
||||
Reference in New Issue
Block a user