Add fabric builds for older MC versions & add checkstyle (#449)

* Remove instance getters, improve command logic, register APi

* Publish multiple fabric builds, enforce checkstyle

* Bump guava

* Bump to 4.4.2
This commit is contained in:
William authored and GitHub committed 2023-07-02 13:26:12 +01:00
1 parent 51baf196b3
commit c9f5262292
219 files changed
+8032 -1392

No files matched your search

@@ -39,6 +39,28 @@ public class UnsafeBlocks {
@YamlKey("safe_occupation_blocks")
public List<String> safeOccupationBlocks;
/**
* Returns if the block, by provided identifier, are unsafe.
*
* @param blockId The block identifier (e.g. {@code minecraft:stone})
* @return {@code true} if the block is on the unsafe blocks list, {@code false} otherwise
*/
public boolean isUnsafe(@NotNull String blockId) {
return unsafeBlocks.contains(this.formatBlockId(blockId));
}
/**
* Returns if the block, by provided identifier, is unsafe to stand in.
*
* @param blockId The block identifier (e.g. {@code minecraft:stone})
* @return {@code true} if the block is on the unsafe blocks list, {@code false} otherwise
*/
public boolean isUnsafeToOccupy(@NotNull String blockId) {
return !safeOccupationBlocks.contains(this.formatBlockId(blockId));
}
// Format a block ID to be in the format namespace:id
@NotNull
private String formatBlockId(@NotNull String blockId) {
if (!blockId.startsWith(Key.MINECRAFT_NAMESPACE + ":")) {
blockId = Key.MINECRAFT_NAMESPACE + ":" + blockId;
@@ -46,28 +68,6 @@ public class UnsafeBlocks {
return blockId;
}
/**
* Returns if the block, by provided identifier, is unsafe
*
* @param blockId The block identifier (e.g. {@code minecraft:stone})
* @return {@code true} if the block is on the unsafe blocks list, {@code false} otherwise
*/
public boolean isUnsafe(@NotNull String blockId) {
blockId = this.formatBlockId(blockId);
return unsafeBlocks.contains(blockId);
}
/**
* Returns if the block, by provided identifier, is unsafe to stand in
*
* @param blockId The block identifier (e.g. {@code minecraft:stone})
* @return {@code true} if the block is on the unsafe blocks list, {@code false} otherwise
*/
public boolean isUnsafeToOccupy(@NotNull String blockId) {
blockId = this.formatBlockId(blockId);
return !safeOccupationBlocks.contains(blockId);
}
@SuppressWarnings("unused")
public UnsafeBlocks() {
}