mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-23 11:15:24 +01:00
Make check an NPE check and failure
This commit is contained in:
parent
3ece0d049a
commit
7fbae58bb2
@ -17,6 +17,7 @@ import world.bentobox.bentobox.util.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@ -64,8 +65,7 @@ public class SafeSpotTeleport {
|
||||
this.runnable = builder.getRunnable();
|
||||
this.failRunnable = builder.getFailRunnable();
|
||||
this.result = builder.getResult();
|
||||
this.world = location.getWorld();
|
||||
assert world != null;
|
||||
this.world = Objects.requireNonNull(location.getWorld());
|
||||
this.maxHeight = world.getMaxHeight() - 20;
|
||||
// Try to go
|
||||
Util.getChunkAtAsync(location).thenRun(() -> tryToGo(builder.getFailureMessage()));
|
||||
|
@ -146,7 +146,7 @@ public class SafeSpotTeleportTest {
|
||||
/**
|
||||
* Test method for {@link world.bentobox.bentobox.util.teleport.SafeSpotTeleport#SafeSpotTeleport(world.bentobox.bentobox.util.teleport.SafeSpotTeleport.Builder)}.
|
||||
*/
|
||||
@Test(expected = AssertionError.class)
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testSafeSpotTeleportNullWorld() {
|
||||
when(location.getWorld()).thenReturn(null);
|
||||
sst = new SafeSpotTeleport(builder);
|
||||
|
Loading…
Reference in New Issue
Block a user