From 2a86656188e7518fb02cc7dd85198af6722aeaee Mon Sep 17 00:00:00 2001 From: Niklas Date: Sun, 28 Jun 2020 01:51:26 +0200 Subject: [PATCH] fixed custom function interface location --- src/main/java/org/kapelle/multiblock/BlockComponent.java | 9 +++------ src/main/java/org/kapelle/multiblock/ICheckFunction.java | 7 +++++++ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 src/main/java/org/kapelle/multiblock/ICheckFunction.java diff --git a/src/main/java/org/kapelle/multiblock/BlockComponent.java b/src/main/java/org/kapelle/multiblock/BlockComponent.java index 6a6faae..c8bf6d2 100644 --- a/src/main/java/org/kapelle/multiblock/BlockComponent.java +++ b/src/main/java/org/kapelle/multiblock/BlockComponent.java @@ -8,14 +8,10 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; -interface CheckFunction { - boolean apply(Location location); -} - public class BlockComponent { private final BlockComponentMode mode; private final Set blocks; - private CheckFunction customCheckFunction; + private ICheckFunction customCheckFunction; public BlockComponent(BlockComponentMode mode){ if(mode == BlockComponentMode.SET){ @@ -31,7 +27,7 @@ public class BlockComponent { this.blocks = validBlocks; } - public BlockComponent(CheckFunction customCheckFunction){ + public BlockComponent(ICheckFunction customCheckFunction){ this.mode = BlockComponentMode.CUSTOM; this.blocks = Collections.emptySet(); this.customCheckFunction = customCheckFunction; @@ -43,6 +39,7 @@ public class BlockComponent { this.mode = BlockComponentMode.SET; } + public boolean isValidBlock(Location location){ if(this.mode == BlockComponentMode.CUSTOM){ return this.customCheckFunction.apply(location); diff --git a/src/main/java/org/kapelle/multiblock/ICheckFunction.java b/src/main/java/org/kapelle/multiblock/ICheckFunction.java new file mode 100644 index 0000000..cfaddf5 --- /dev/null +++ b/src/main/java/org/kapelle/multiblock/ICheckFunction.java @@ -0,0 +1,7 @@ +package org.kapelle.multiblock; + +import org.bukkit.Location; + +public interface ICheckFunction { + boolean apply(Location location); +}