Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow negative amplifiers in potion effects #2478

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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