Skip to content

Commit

Permalink
Implement ChunkMock isForceLoaded (#969)
Browse files Browse the repository at this point in the history
* implement ChunkMock isForceLoaded

* unit tests for ChunkMock isForceLoaded

---------

Co-authored-by: Thorinwasher <37477983+Thorinwasher@users.noreply.github.com>
  • Loading branch information
Figishe and Thorinwasher committed Feb 17, 2024
1 parent 7148f46 commit 97402da
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/be/seeseemelk/mockbukkit/ChunkMock.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ChunkMock implements Chunk
private final int z;
private final PersistentDataContainer persistentDataContainer = new PersistentDataContainerMock();
private boolean isSlimeChunk;
private boolean isForceLoaded = false;

/**
* Constructs a new {@link ChunkMock} for the provided world, at the specified coordinates.
Expand Down Expand Up @@ -254,15 +255,13 @@ else if (obj instanceof ChunkMock chunk)
@Override
public boolean isForceLoaded()
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
return isForceLoaded;
}

@Override
public void setForceLoaded(boolean forced)
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
this.isForceLoaded = forced;
}

@Override
Expand Down
15 changes: 15 additions & 0 deletions src/test/java/be/seeseemelk/mockbukkit/ChunkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,21 @@ void isLoaded_AfterLoad_True()
assertTrue(chunk.isLoaded());
}

@Test
void isForceLoaded_JustCreated_False()
{
ChunkMock chunk = world.getChunkAt(0, 0);
assertFalse(chunk.isForceLoaded());
}

@Test
void isForceLoaded_AfterSet_True()
{
ChunkMock chunk = world.getChunkAt(0, 0);
chunk.setForceLoaded(true);
assertTrue(chunk.isForceLoaded());
}

@Test
void equals_DifferentChunk_False()
{
Expand Down

0 comments on commit 97402da

Please sign in to comment.