Update to Minecraft 1.20.2

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2023-09-22 02:40:00 +10:00
parent e589401ea7
commit a67391a13e
9 changed files with 56 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableMap;
import java.util.Map;
import java.util.NoSuchElementException;
import org.bukkit.Color;
import org.bukkit.NamespacedKey;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.SerializableAs;
import org.bukkit.entity.LivingEntity;
@@ -108,8 +109,14 @@ public class PotionEffect implements ConfigurationSerializable {
@NotNull
private static PotionEffectType getEffectType(@NotNull Map<?, ?> map) {
int type = getInt(map, TYPE);
PotionEffectType effect = PotionEffectType.getById(type);
PotionEffectType effect;
if (map.get(TYPE) instanceof String) {
String type = (String) map.get(TYPE);
effect = PotionEffectType.getByKey(NamespacedKey.fromString(type));
} else {
int type = getInt(map, TYPE);
effect = PotionEffectType.getById(type);
}
if (effect != null) {
return effect;
}
@@ -136,7 +143,7 @@ public class PotionEffect implements ConfigurationSerializable {
@NotNull
public Map<String, Object> serialize() {
return ImmutableMap.<String, Object>builder()
.put(TYPE, type.getId())
.put(TYPE, type.getKey().toString())
.put(DURATION, duration)
.put(AMPLIFIER, amplifier)
.put(AMBIENT, ambient)