1- /* Copyright (c) 2012 Jesper Öqvist <jesper@llbit.se>
1+ /* Copyright (c) 2012-2021 Jesper Öqvist <jesper@llbit.se>
2+ * Copyright (c) 2012-2021 Chunky contributors
23 *
34 * This file is part of Chunky.
45 *
@@ -140,8 +141,9 @@ public synchronized void selectRegion(World world, int cx, int cz) {
140141
141142 /**
142143 * Select chunks within rectangle.
144+ * @return true if anything was changed, false if no chunks were selected.
143145 */
144- public synchronized void selectChunks (World world , int cx0 , int cz0 , int cx1 , int cz1 ) {
146+ public synchronized boolean selectChunks (World world , int cx0 , int cz0 , int cx1 , int cz1 ) {
145147 boolean selectionChanged = false ;
146148 for (int cx = cx0 ; cx <= cx1 ; ++cx ) {
147149 for (int cz = cz0 ; cz <= cz1 ; ++cz ) {
@@ -156,12 +158,14 @@ public synchronized void selectChunks(World world, int cx0, int cz0, int cx1, in
156158 if (selectionChanged ) {
157159 notifyChunkSelectionChange ();
158160 }
161+ return selectionChanged ;
159162 }
160163
161164 /**
162165 * Deselect chunks within rectangle.
166+ * @return true if anything was changed, false if no chunks were deselected.
163167 */
164- public synchronized void deselectChunks (int cx0 , int cz0 , int cx1 , int cz1 ) {
168+ public synchronized boolean deselectChunks (int cx0 , int cz0 , int cx1 , int cz1 ) {
165169 boolean selectionChanged = false ;
166170 for (int cx = cx0 ; cx <= cx1 ; ++cx ) {
167171 for (int cz = cz0 ; cz <= cz1 ; ++cz ) {
@@ -176,6 +180,7 @@ public synchronized void deselectChunks(int cx0, int cz0, int cx1, int cz1) {
176180 if (selectionChanged ) {
177181 notifyChunkSelectionChange ();
178182 }
183+ return selectionChanged ;
179184 }
180185
181186 /**
0 commit comments