fixed custom function interface location

This commit is contained in:
Niklas 2020-06-28 01:51:26 +02:00
parent 8bbcc2ae44
commit 2a86656188
2 changed files with 10 additions and 6 deletions

View File

@ -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<Material> 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);

View File

@ -0,0 +1,7 @@
package org.kapelle.multiblock;
import org.bukkit.Location;
public interface ICheckFunction {
boolean apply(Location location);
}