@@ -117,41 +117,56 @@ public void showConfirmation(Player player, UniDialogConfirmationRequest request
117117 public void showMultiAction (Player player , UniDialogMultiActionRequest request ) {
118118 String namespace = resolveNamespace (request .getNamespace ());
119119
120- PaperMultiActionDialog dialog = manager .createMultiActionDialog ().title (request .getTitle ())
121- .body (builder -> builder .text ().text (request .getBody ())).columns (request .getColumns ());
120+ PaperMultiActionDialog dialog = manager .createMultiActionDialog ()
121+ .title (getTextOrEmpty (request .getTitle ()))
122+ .columns (Math .max (1 , request .getColumns ()));
122123
123- applyInputs (dialog , request .getInputs ());
124+ if (request .getBody () != null && !request .getBody ().isEmpty ()) {
125+ dialog .body (builder -> builder .text ().text (request .getBody ()));
126+ }
124127
125- for (UniDialogButton button : request .getButtons ()) {
126- String actionId = resolveActionId (button .getActionId ());
128+ applyInputs (dialog , request .getInputs ());
127129
128- if (button .getCallback () != null ) {
129- registerCustomAction (namespace , actionId , button .getCallback ());
130- }
130+ if (request .getButtons () != null ) {
131+ for (UniDialogButton button : request .getButtons ()) {
132+ if (button == null ) {
133+ continue ;
134+ }
131135
132- dialog .action (action -> {
133- action .label (button .getText ());
136+ String actionId = resolveActionId (button .getActionId ());
134137
135- if (button .getTooltip () != null && ! button . getTooltip (). isEmpty () ) {
136- action . tooltip ( button .getTooltip ());
138+ if (button .getCallback () != null ) {
139+ registerCustomAction ( namespace , actionId , button .getCallback ());
137140 }
138141
139- Integer width = button .getWidth ();
140- if (width == null ) {
141- width = request .getButtonWidth ();
142- }
142+ dialog .action (action -> {
143+ action .label (getTextOrEmpty (button .getText ()));
143144
144- if (width != null ) {
145- action .width (width .intValue ());
146- }
145+ if (button .getTooltip () != null && !button .getTooltip ().isEmpty ()) {
146+ action .tooltip (button .getTooltip ());
147+ }
148+
149+ Integer width = button .getWidth ();
150+ if (width == null ) {
151+ width = request .getButtonWidth ();
152+ }
153+
154+ if (width != null && width .intValue () > 0 ) {
155+ action .width (width .intValue ());
156+ }
147157
148- action .dynamicCustom (namespace , actionId );
149- });
158+ action .dynamicCustom (namespace , actionId );
159+ });
160+ }
150161 }
151162
152163 dialog .opener ().open (player .getUniqueId ());
153164 }
154165
166+ private String getTextOrEmpty (String text ) {
167+ return text == null ? "" : text ;
168+ }
169+
155170 private void applyInputs (PaperNoticeDialog dialog , Iterable <UniDialogInput > inputs ) {
156171 if (inputs == null ) {
157172 return ;
0 commit comments