Port over fix from v2
@@ -6,22 +6,23 @@ package io.github.nucleuspowered.nucleus.modules.warp.data;
import io.github.nucleuspowered.nucleus.api.module.warp.data.Warp;
import io.github.nucleuspowered.nucleus.api.module.warp.data.WarpCategory;
-import org.spongepowered.api.text.Text;
+import net.kyori.adventure.text.Component;
+import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Collection;
import java.util.Optional;
public class WarpCategoryData implements WarpCategory {
- public WarpCategoryData(final String id, final TextComponent displayName, final TextComponent description) {
+ public WarpCategoryData(final String id, @Nullable final Component displayName, final Component description) {
this.id = id;
this.displayName = displayName;
this.description = description;
}
private final String id;
- private final TextComponent displayName;
- private final TextComponent description;
+ @Nullable private final Component displayName;
+ private final Component description;
@Override
public String getId() {
@@ -29,12 +30,12 @@ public class WarpCategoryData implements WarpCategory {
}
@Override
- public TextComponent getDisplayName() {
- return this.displayName;
+ public Component getDisplayName() {
+ return this.displayName == null ? Component.text(this.id) : this.displayName;
}
@Override
- public Optional<Text> getDescription() {
+ public Optional<Component> getDescription() {
return Optional.ofNullable(this.description);
}
