-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from LinoxGH/v1.15
Added the velocity methods for EntityMock and BlockDataMock.
- Loading branch information
Showing
6 changed files
with
126 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/be/seeseemelk/mockbukkit/block/data/BlockDataMock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package be.seeseemelk.mockbukkit.block.data; | ||
|
||
import org.bukkit.Material; | ||
import org.bukkit.block.data.BlockData; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import be.seeseemelk.mockbukkit.UnimplementedOperationException; | ||
|
||
public class BlockDataMock implements BlockData | ||
{ | ||
private final Material type; | ||
|
||
public BlockDataMock(Material type) | ||
{ | ||
this.type = type; | ||
} | ||
|
||
@Override | ||
public @NotNull Material getMaterial() | ||
{ | ||
return type; | ||
} | ||
|
||
@Override | ||
public @NotNull String getAsString() | ||
{ | ||
// TODO Auto-generated method stub | ||
throw new UnimplementedOperationException(); | ||
} | ||
|
||
@Override | ||
public @NotNull String getAsString(boolean hideUnspecified) | ||
{ | ||
// TODO Auto-generated method stub | ||
throw new UnimplementedOperationException(); | ||
} | ||
|
||
@Override | ||
public @NotNull BlockData merge(@NotNull BlockData data) | ||
{ | ||
// TODO Auto-generated method stub | ||
throw new UnimplementedOperationException(); | ||
} | ||
|
||
@Override | ||
public boolean matches(@Nullable BlockData data) | ||
{ | ||
if (data == null) return false; | ||
return data.getMaterial() == type; | ||
} | ||
|
||
@Override | ||
public @NotNull BlockData clone() | ||
{ | ||
try { | ||
return (BlockData) super.clone(); | ||
} catch (CloneNotSupportedException e) { | ||
return new BlockDataMock(type); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/test/java/be/seeseemelk/mockbukkit/block/data/BlockDataTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package be.seeseemelk.mockbukkit.block.data; | ||
|
||
import org.bukkit.Material; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class BlockDataTest { | ||
|
||
@Test | ||
public void testMatches() | ||
{ | ||
BlockDataMock blockData1 = new BlockDataMock(Material.STONE); | ||
BlockDataMock blockData2 = new BlockDataMock(Material.STONE); | ||
Assert.assertTrue(blockData1.matches(blockData2)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters