diff options
author | Jake Potrebic <[email protected]> | 2024-09-30 11:44:36 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-09-30 16:02:52 -0700 |
commit | e7e1ab56ca2a401aabacaee2de5818a93886bea3 (patch) | |
tree | b8fc5d35bec2d9466f8cac95289797684a70968b /patches/api/0445-add-number-format-api.patch | |
parent | ba3c29b92ec29c8c321f7e6160a4a25f65f18088 (diff) | |
download | Paper-e7e1ab56ca2a401aabacaee2de5818a93886bea3.tar.gz Paper-e7e1ab56ca2a401aabacaee2de5818a93886bea3.zip |
Finish converting most of the undeprecated api to jspecify
Diffstat (limited to 'patches/api/0445-add-number-format-api.patch')
-rw-r--r-- | patches/api/0445-add-number-format-api.patch | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/patches/api/0445-add-number-format-api.patch b/patches/api/0445-add-number-format-api.patch index 6d32302ad0..8d36669b0a 100644 --- a/patches/api/0445-add-number-format-api.patch +++ b/patches/api/0445-add-number-format-api.patch @@ -18,19 +18,20 @@ index 0000000000000000000000000000000000000000..486da6ebe0137bb3280e8b33c8e35e30 +} diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java new file mode 100644 -index 0000000000000000000000000000000000000000..66e0569789d523076cb571fb32be78ecff74305b +index 0000000000000000000000000000000000000000..3ef4595b692a13566c5c738050b83b0462094e9b --- /dev/null +++ b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormat.java -@@ -0,0 +1,19 @@ +@@ -0,0 +1,20 @@ +package io.papermc.paper.scoreboard.numbers; + +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.ComponentLike; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * A scoreboard number format that replaces the score number with a chat component. + */ ++@NullMarked +public interface FixedFormat extends NumberFormat, ComponentLike { + + /** @@ -38,43 +39,45 @@ index 0000000000000000000000000000000000000000..66e0569789d523076cb571fb32be78ec + * + * @return the chat component + */ -+ @NotNull Component component(); ++ Component component(); + +} diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..969bbfcdb68ffb5a207207e20e4d79621900c0f5 +index 0000000000000000000000000000000000000000..be47bf438805f9ab84b241e564281ea9c287aa6e --- /dev/null +++ b/src/main/java/io/papermc/paper/scoreboard/numbers/FixedFormatImpl.java -@@ -0,0 +1,12 @@ +@@ -0,0 +1,13 @@ +package io.papermc.paper.scoreboard.numbers; + +import net.kyori.adventure.text.Component; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + -+record FixedFormatImpl(@NotNull Component component) implements FixedFormat { ++@NullMarked ++record FixedFormatImpl(Component component) implements FixedFormat { + + @Override -+ public @NotNull Component asComponent() { ++ public Component asComponent() { + return this.component(); + } +} diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java b/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java new file mode 100644 -index 0000000000000000000000000000000000000000..eadf637f5fc582a2af5db71274ac1f01b2a28913 +index 0000000000000000000000000000000000000000..7c093e4e9a2a67021da9025631a3c6fa7ac3ef35 --- /dev/null +++ b/src/main/java/io/papermc/paper/scoreboard/numbers/NumberFormat.java -@@ -0,0 +1,60 @@ +@@ -0,0 +1,61 @@ +package io.papermc.paper.scoreboard.numbers; + +import net.kyori.adventure.text.ComponentLike; +import net.kyori.adventure.text.format.Style; +import net.kyori.adventure.text.format.StyleBuilderApplicable; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * Describes a scoreboard number format that applies custom formatting to scoreboard scores. + */ ++@NullMarked +public interface NumberFormat { + + /** @@ -82,7 +85,7 @@ index 0000000000000000000000000000000000000000..eadf637f5fc582a2af5db71274ac1f01 + * + * @return a blank number format + */ -+ static @NotNull NumberFormat blank() { ++ static NumberFormat blank() { + return BlankFormatImpl.INSTANCE; + } + @@ -91,7 +94,7 @@ index 0000000000000000000000000000000000000000..eadf637f5fc582a2af5db71274ac1f01 + * + * @return an un-styled number format + */ -+ static @NotNull StyledFormat noStyle() { ++ static StyledFormat noStyle() { + return StyledFormatImpl.NO_STYLE; + } + @@ -101,7 +104,7 @@ index 0000000000000000000000000000000000000000..eadf637f5fc582a2af5db71274ac1f01 + * @param style the style to apply on the number + * @return a styled number format + */ -+ static @NotNull StyledFormat styled(final @NotNull Style style) { ++ static StyledFormat styled(final Style style) { + return new StyledFormatImpl(style); + } + @@ -111,7 +114,7 @@ index 0000000000000000000000000000000000000000..eadf637f5fc582a2af5db71274ac1f01 + * @param styleBuilderApplicables the style to apply on the number + * @return a styled number format + */ -+ static @NotNull StyledFormat styled(final @NotNull StyleBuilderApplicable @NotNull... styleBuilderApplicables) { ++ static StyledFormat styled(final StyleBuilderApplicable... styleBuilderApplicables) { + return styled(Style.style(styleBuilderApplicables)); + } + @@ -121,25 +124,26 @@ index 0000000000000000000000000000000000000000..eadf637f5fc582a2af5db71274ac1f01 + * @param component the component to replace the number with + * @return a fixed number format + */ -+ static @NotNull FixedFormat fixed(final @NotNull ComponentLike component) { ++ static FixedFormat fixed(final ComponentLike component) { + return new FixedFormatImpl(component.asComponent()); + } +} diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java new file mode 100644 -index 0000000000000000000000000000000000000000..fe844677d689c3afe5ff2b706d562724e4121137 +index 0000000000000000000000000000000000000000..cfb14bb1b338727a5d9eeaa7a73c40540b04dbed --- /dev/null +++ b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormat.java -@@ -0,0 +1,19 @@ +@@ -0,0 +1,20 @@ +package io.papermc.paper.scoreboard.numbers; + +import net.kyori.adventure.text.format.Style; +import net.kyori.adventure.text.format.StyleBuilderApplicable; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + +/** + * A scoreboard number format that applies a custom formatting to the score number. + */ ++@NullMarked +public interface StyledFormat extends NumberFormat, StyleBuilderApplicable { + + /** @@ -147,25 +151,26 @@ index 0000000000000000000000000000000000000000..fe844677d689c3afe5ff2b706d562724 + * + * @return the style to apply + */ -+ @NotNull Style style(); ++ Style style(); + +} diff --git a/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..0421e6c7cb32a912cf4aa281623c4311d5d1a34f +index 0000000000000000000000000000000000000000..e288beb1596f2d4e7e602364955da4e8bc0de21c --- /dev/null +++ b/src/main/java/io/papermc/paper/scoreboard/numbers/StyledFormatImpl.java -@@ -0,0 +1,13 @@ +@@ -0,0 +1,14 @@ +package io.papermc.paper.scoreboard.numbers; + +import net.kyori.adventure.text.format.Style; -+import org.jetbrains.annotations.NotNull; ++import org.jspecify.annotations.NullMarked; + -+record StyledFormatImpl(@NotNull Style style) implements StyledFormat { ++@NullMarked ++record StyledFormatImpl(Style style) implements StyledFormat { + static final StyledFormat NO_STYLE = new StyledFormatImpl(Style.empty()); + + @Override -+ public void styleApply(final Style.@NotNull Builder style) { ++ public void styleApply(final Style.Builder style) { + style.merge(this.style); + } +} |