@@ -222,6 +222,22 @@ static boolean isBlockAboveAir(final World world, final int x, final int y, fina
222222 return HOLLOW_MATERIALS .contains (world .getBlockAt (x , y - 1 , z ).getType ().getId ());
223223 }
224224
225+ public static boolean isBlockUnsafeForUser (final IUser user , final World world , final int x , final int y , final int z )
226+ {
227+ if (user .getBase ().isOnline () && world .equals (user .getBase ().getWorld ())
228+ && (user .getBase ().getGameMode () == GameMode .CREATIVE || user .isGodModeEnabled ())
229+ && user .getBase ().getAllowFlight ())
230+ {
231+ return false ;
232+ }
233+
234+ if (isBlockDamaging (world , x , y , z ))
235+ {
236+ return true ;
237+ }
238+ return isBlockAboveAir (world , x , y , z );
239+ }
240+
225241 public static boolean isBlockUnsafe (final World world , final int x , final int y , final int z )
226242 {
227243 if (isBlockDamaging (world , x , y , z ))
@@ -265,9 +281,9 @@ public static Location getRoundedDestination(final Location loc)
265281
266282 public static Location getSafeDestination (final IUser user , final Location loc ) throws Exception
267283 {
268- if (loc .getWorld ().equals (user .getBase ().getWorld ())
269- && (( user .getBase ().getGameMode () == GameMode .CREATIVE
270- || user . isGodModeEnabled ()) && user .getBase ().getAllowFlight () ))
284+ if (user . getBase (). isOnline () && loc .getWorld ().equals (user .getBase ().getWorld ())
285+ && (user .getBase ().getGameMode () == GameMode .CREATIVE || user . isGodModeEnabled ())
286+ && user .getBase ().getAllowFlight ())
271287 {
272288 if (shouldFly (loc ))
273289 {
0 commit comments