Skip to content

Commit 442ff80

Browse files
Outfluencermd-5
authored andcommitted
#3832: Fix width setter in PlainMessageBody and make all API fluent
1 parent fbbcc45 commit 442ff80

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

dialog/src/main/java/net/md_5/bungee/api/dialog/action/DialogAction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
import com.google.common.base.Preconditions;
44
import lombok.Data;
55
import lombok.NonNull;
6+
import lombok.experimental.Accessors;
67
import net.md_5.bungee.api.chat.BaseComponent;
78

89
/**
910
* Represents a dialog action which will usually appear as a button.
1011
*/
1112
@Data
13+
@Accessors(fluent = true)
1214
public class DialogAction
1315
{
1416

dialog/src/main/java/net/md_5/bungee/api/dialog/body/PlainMessageBody.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
import lombok.EqualsAndHashCode;
66
import lombok.NonNull;
77
import lombok.ToString;
8+
import lombok.experimental.Accessors;
89
import net.md_5.bungee.api.chat.BaseComponent;
910

1011
/**
1112
* Represents a dialog body which consists of text constrained to a certain
1213
* width.
1314
*/
1415
@Data
16+
@Accessors(fluent = true)
1517
@ToString(callSuper = true)
1618
@EqualsAndHashCode(callSuper = true)
1719
public class PlainMessageBody extends DialogBody
@@ -36,12 +38,12 @@ public PlainMessageBody(@NonNull BaseComponent contents, Integer width)
3638
{
3739
super( "minecraft:plain_message" );
3840
this.contents = contents;
39-
setWidth( width );
41+
width( width );
4042
}
4143

42-
public void setWidth(int width)
44+
public void width(Integer width)
4345
{
44-
Preconditions.checkArgument( width >= 1 && width <= 1024, "width must be between 1 and 1024" );
46+
Preconditions.checkArgument( width == null || ( width >= 1 && width <= 1024 ), "width must be between 1 and 1024" );
4547
this.width = width;
4648
}
4749
}

0 commit comments

Comments
 (0)