Update to Minecraft 1.19

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2022-06-08 02:00:00 +10:00
parent 9bfa9ca85b
commit ec575f5252
88 changed files with 1339 additions and 375 deletions

View File

@@ -1,6 +1,6 @@
package org.bukkit.event.entity;
import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.entity.EnderDragon;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@@ -56,7 +56,7 @@ public class EnderDragonChangePhaseEvent extends EntityEvent implements Cancella
* @param newPhase the new dragon phase
*/
public void setNewPhase(@NotNull EnderDragon.Phase newPhase) {
Validate.notNull(newPhase, "New dragon phase cannot be null");
Preconditions.checkArgument(newPhase != null, "New dragon phase cannot be null");
this.newPhase = newPhase;
}

View File

@@ -1,6 +1,6 @@
package org.bukkit.event.entity;
import org.apache.commons.lang.Validate;
import com.google.common.base.Preconditions;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@@ -26,9 +26,9 @@ public class EntityBreedEvent extends EntityEvent implements Cancellable {
public EntityBreedEvent(@NotNull LivingEntity child, @NotNull LivingEntity mother, @NotNull LivingEntity father, @Nullable LivingEntity breeder, @Nullable ItemStack bredWith, int experience) {
super(child);
Validate.notNull(child, "Cannot have null child");
Validate.notNull(mother, "Cannot have null mother");
Validate.notNull(father, "Cannot have null father");
Preconditions.checkArgument(child != null, "Cannot have null child");
Preconditions.checkArgument(mother != null, "Cannot have null mother");
Preconditions.checkArgument(father != null, "Cannot have null father");
// Breeder can be null in the case of spontaneous conception
this.mother = mother;
@@ -101,7 +101,7 @@ public class EntityBreedEvent extends EntityEvent implements Cancellable {
* @param experience experience amount
*/
public void setExperience(int experience) {
Validate.isTrue(experience >= 0, "Experience cannot be negative");
Preconditions.checkArgument(experience >= 0, "Experience cannot be negative");
this.experience = experience;
}

View File

@@ -2,10 +2,11 @@ package org.bukkit.event.entity;
import com.google.common.base.Function;
import com.google.common.base.Functions;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import java.util.EnumMap;
import java.util.Map;
import org.apache.commons.lang.Validate;
import java.util.Objects;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@@ -32,11 +33,11 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
public EntityDamageEvent(@NotNull final Entity damagee, @NotNull final DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers, @NotNull final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) {
super(damagee);
Validate.isTrue(modifiers.containsKey(DamageModifier.BASE), "BASE DamageModifier missing");
Validate.isTrue(!modifiers.containsKey(null), "Cannot have null DamageModifier");
Validate.noNullElements(modifiers.values(), "Cannot have null modifier values");
Validate.isTrue(modifiers.keySet().equals(modifierFunctions.keySet()), "Must have a modifier function for each DamageModifier");
Validate.noNullElements(modifierFunctions.values(), "Cannot have null modifier function");
Preconditions.checkArgument(modifiers.containsKey(DamageModifier.BASE), "BASE DamageModifier missing");
Preconditions.checkArgument(!modifiers.containsKey(null), "Cannot have null DamageModifier");
Preconditions.checkArgument(modifiers.values().stream().allMatch(Objects::nonNull), "Cannot have null modifier values");
Preconditions.checkArgument(modifiers.keySet().equals(modifierFunctions.keySet()), "Must have a modifier function for each DamageModifier");
Preconditions.checkArgument(modifierFunctions.values().stream().allMatch(Objects::nonNull), "Cannot have null modifier function");
this.originals = new EnumMap<DamageModifier, Double>(modifiers);
this.cause = cause;
this.modifiers = modifiers;
@@ -99,7 +100,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
* @see DamageModifier#BASE
*/
public double getDamage(@NotNull DamageModifier type) throws IllegalArgumentException {
Validate.notNull(type, "Cannot have null DamageModifier");
Preconditions.checkArgument(type != null, "Cannot have null DamageModifier");
final Double damage = modifiers.get(type);
return damage == null ? 0 : damage;
}
@@ -116,7 +117,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
* @throws IllegalArgumentException if type is null
*/
public boolean isApplicable(@NotNull DamageModifier type) throws IllegalArgumentException {
Validate.notNull(type, "Cannot have null DamageModifier");
Preconditions.checkArgument(type != null, "Cannot have null DamageModifier");
return modifiers.containsKey(type);
}

View File

@@ -1,9 +1,9 @@
package org.bukkit.event.entity;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import org.apache.commons.lang.Validate;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.Cancellable;
@@ -70,7 +70,7 @@ public class PotionSplashEvent extends ProjectileHitEvent implements Cancellable
* @param intensity relative to maximum effect
*/
public void setIntensity(@NotNull LivingEntity entity, double intensity) {
Validate.notNull(entity, "You must specify a valid entity.");
Preconditions.checkArgument(entity != null, "You must specify a valid entity.");
if (intensity <= 0.0) {
affectedEntities.remove(entity);
} else {