Skip to content

Commit

Permalink
Allow negative amplifiers in potion effects (#2478)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImMorpheus authored Nov 18, 2023
1 parent f578181 commit 3141631
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static Builder builder() {
* @param amplifier The zero-indexed amplifier
* @param duration The duration in ticks
* @return The potion effect
* @throws IllegalArgumentException If the amplifier is negative or the duration is not positive
* @throws IllegalArgumentException If the duration is not positive
*/
static PotionEffect of(final PotionEffectType type, final int amplifier, final Ticks duration) throws IllegalArgumentException {
return PotionEffect.builder().potionType(type).amplifier(amplifier).duration(duration).build();
Expand All @@ -76,7 +76,7 @@ static PotionEffect of(final PotionEffectType type, final int amplifier, final T
* @param amplifier The amplifier
* @param duration The duration in ticks
* @return The potion effect
* @throws IllegalArgumentException If the amplifier is negative or the duration is not positive
* @throws IllegalArgumentException If the duration is not positive
*/
static PotionEffect of(final Supplier<? extends PotionEffectType> type, final int amplifier, final Ticks duration) throws IllegalArgumentException {
return PotionEffect.builder().potionType(type).amplifier(amplifier).duration(duration).build();
Expand Down Expand Up @@ -172,15 +172,14 @@ default Builder potionType(final Supplier<? extends PotionEffectType> potionEffe
/**
* Sets the amplifier power of the potion effect.
*
* <p>Amplifiers must be greater than or equal to zero. See
* <p>See
* {@link #amplifier()} for an explanation of what the amplifier means.
* </p>
*
* @param amplifier The amplifier power
* @return This builder, for chaining
* @throws IllegalArgumentException If the amplifier is less than zero
*/
Builder amplifier(int amplifier) throws IllegalArgumentException;
Builder amplifier(int amplifier);

/**
* Sets whether the potion effect is ambient.
Expand Down

0 comments on commit 3141631

Please sign in to comment.