Commits

Doc authored and md_5 committed 54a36938667
SPIGOT-7944, #1077: Allow nullable fields in DamageTypeTags
No tags

src/main/java/org/bukkit/tag/DamageTypeTags.java

Modified
1 1 package org.bukkit.tag;
2 2
3 -import java.util.Objects;
4 3 import org.bukkit.Bukkit;
5 4 import org.bukkit.NamespacedKey;
6 5 import org.bukkit.Tag;
7 6 import org.bukkit.damage.DamageType;
8 7 import org.jetbrains.annotations.ApiStatus;
9 -import org.jetbrains.annotations.NotNull;
8 +import org.jetbrains.annotations.Nullable;
10 9
11 10 /**
12 11 * Vanilla {@link DamageType} {@link Tag tags}.
13 12 */
14 13 @ApiStatus.Experimental
15 14 public final class DamageTypeTags {
16 15
17 16 /**
18 17 * Vanilla tag representing damage types which damage helmets.
19 18 */
25 24 /**
26 25 * Vanilla tag representing damage types which bypass shields.
27 26 */
28 27 public static final Tag<DamageType> BYPASSES_SHIELD = getTag("bypasses_shield");
29 28 /**
30 29 * Vanilla tag representing damage types which bypass invulnerability.
31 30 */
32 31 public static final Tag<DamageType> BYPASSES_INVULNERABILITY = getTag("bypasses_invulnerability");
33 32 /**
34 33 * Vanilla tag representing damage types which bypass cooldowns.
34 + * <br>
35 + * <b>Note:</b> this can be null unless a datapack add values to this tag because vanilla not has any values for this.
35 36 */
37 + @Nullable
36 38 public static final Tag<DamageType> BYPASSES_COOLDOWN = getTag("bypasses_cooldown");
37 39 /**
38 40 * Vanilla tag representing damage types which bypass effects.
39 41 */
40 42 public static final Tag<DamageType> BYPASSES_EFFECTS = getTag("bypasses_effects");
41 43 /**
42 44 * Vanilla tag representing damage types which bypass resistance.
43 45 */
44 46 public static final Tag<DamageType> BYPASSES_RESISTANCE = getTag("bypasses_resistance");
45 47 /**
151 153 /**
152 154 * Vanilla tag representing damage types which originate from mace smashes.
153 155 */
154 156 public static final Tag<DamageType> IS_MACE_SMASH = getTag("mace_smash");
155 157 /**
156 158 * Internal use only.
157 159 */
158 160 @ApiStatus.Internal
159 161 public static final String REGISTRY_DAMAGE_TYPES = "damage_types";
160 162
161 - @NotNull
163 + @Nullable
162 164 private static Tag<DamageType> getTag(String key) {
163 - return Objects.requireNonNull(Bukkit.getTag(REGISTRY_DAMAGE_TYPES, NamespacedKey.minecraft(key), DamageType.class));
165 + return Bukkit.getTag(REGISTRY_DAMAGE_TYPES, NamespacedKey.minecraft(key), DamageType.class);
164 166 }
165 167
166 168 private DamageTypeTags() {
167 169 }
168 170 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut