#3832: Fix width setter in PlainMessageBody and make all API fluent

This commit is contained in:
Outfluencer 2025-05-25 10:15:07 +10:00 committed by md_5
parent fbbcc454d5
commit 442ff808f3
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
2 changed files with 7 additions and 3 deletions

View File

@ -3,12 +3,14 @@ package net.md_5.bungee.api.dialog.action;
import com.google.common.base.Preconditions;
import lombok.Data;
import lombok.NonNull;
import lombok.experimental.Accessors;
import net.md_5.bungee.api.chat.BaseComponent;
/**
* Represents a dialog action which will usually appear as a button.
*/
@Data
@Accessors(fluent = true)
public class DialogAction
{

View File

@ -5,6 +5,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import lombok.ToString;
import lombok.experimental.Accessors;
import net.md_5.bungee.api.chat.BaseComponent;
/**
@ -12,6 +13,7 @@ import net.md_5.bungee.api.chat.BaseComponent;
* width.
*/
@Data
@Accessors(fluent = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class PlainMessageBody extends DialogBody
@ -36,12 +38,12 @@ public class PlainMessageBody extends DialogBody
{
super( "minecraft:plain_message" );
this.contents = contents;
setWidth( width );
width( width );
}
public void setWidth(int width)
public void width(Integer width)
{
Preconditions.checkArgument( width >= 1 && width <= 1024, "width must be between 1 and 1024" );
Preconditions.checkArgument( width == null || ( width >= 1 && width <= 1024 ), "width must be between 1 and 1024" );
this.width = width;
}
}