#3832: Fix width setter in PlainMessageBody and make all API fluent
This commit is contained in:
parent
fbbcc454d5
commit
442ff808f3
@ -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
|
||||
{
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user