@@ -157,14 +157,26 @@ public boolean onCommand(final PlotPlayer<?> player, String[] args) {
157157
158158 UUID uuid = player .getUUID ();
159159
160- if (!force && !plot .isOwner (uuid )) {
161- if (!player .hasPermission (Permission .PERMISSION_ADMIN_COMMAND_MERGE )) {
162- player .sendMessage (TranslatableCaption .of ("permission.no_plot_perms" ));
160+ if (!force ) {
161+ if (!plot .isOwner (uuid )) {
162+ if (!player .hasPermission (Permission .PERMISSION_ADMIN_COMMAND_MERGE )) {
163+ player .sendMessage (TranslatableCaption .of ("permission.no_plot_perms" ));
164+ return false ;
165+ } else {
166+ uuid = plot .getOwnerAbs ();
167+ }
168+ }
169+
170+ if (this .econHandler .isEnabled (plotArea ) && !player .hasPermission (Permission .PERMISSION_ADMIN_BYPASS_ECON ) && price > 0d && this .econHandler .getMoney (
171+ player ) < price ) {
172+ player .sendMessage (
173+ TranslatableCaption .of ("economy.cannot_afford_merge" ),
174+ TagResolver .resolver ("money" , Tag .inserting (Component .text (this .econHandler .format (price ))))
175+ );
163176 return false ;
164- } else {
165- uuid = plot .getOwnerAbs ();
166177 }
167178 }
179+
168180 if (direction == Direction .ALL ) {
169181 boolean terrain = true ;
170182 if (args .length == 2 ) {
@@ -181,32 +193,22 @@ public boolean onCommand(final PlotPlayer<?> player, String[] args) {
181193 return true ;
182194 }
183195 if (plot .getPlotModificationManager ().autoMerge (Direction .ALL , maxSize , uuid , player , terrain )) {
184- if (this .econHandler .isEnabled (plotArea ) && !player .hasPermission (Permission .PERMISSION_ADMIN_BYPASS_ECON ) && price > 0d ) {
185- this .econHandler .withdrawMoney (player , price );
186- player .sendMessage (
187- TranslatableCaption .of ("economy.removed_balance" ),
188- TagResolver .resolver ("money" , Tag .inserting (Component .text (this .econHandler .format (price )))),
189- TagResolver .resolver (
190- "balance" ,
191- Tag .inserting (Component .text (this .econHandler .format (this .econHandler .getMoney (player ))))
192- )
193- );
194- }
196+ this .econHandler .withdrawMoney (player , price );
197+ player .sendMessage (
198+ TranslatableCaption .of ("economy.removed_balance" ),
199+ TagResolver .resolver ("money" , Tag .inserting (Component .text (this .econHandler .format (price )))),
200+ TagResolver .resolver (
201+ "balance" ,
202+ Tag .inserting (Component .text (this .econHandler .format (this .econHandler .getMoney (player ))))
203+ )
204+ );
195205 player .sendMessage (TranslatableCaption .of ("merge.success_merge" ));
196206 eventDispatcher .callPostMerge (player , plot );
197207 return true ;
198208 }
199209 player .sendMessage (TranslatableCaption .of ("merge.no_available_automerge" ));
200210 return false ;
201211 }
202- if (!force && this .econHandler .isEnabled (plotArea ) && !player .hasPermission (Permission .PERMISSION_ADMIN_BYPASS_ECON ) && price > 0d && this .econHandler .getMoney (
203- player ) < price ) {
204- player .sendMessage (
205- TranslatableCaption .of ("economy.cannot_afford_merge" ),
206- TagResolver .resolver ("money" , Tag .inserting (Component .text (this .econHandler .format (price ))))
207- );
208- return false ;
209- }
210212 final boolean terrain ;
211213 if (args .length == 2 ) {
212214 terrain = "true" .equalsIgnoreCase (args [1 ]);
0 commit comments