fixed custom function interface location
This commit is contained in:
parent
8bbcc2ae44
commit
2a86656188
@ -8,14 +8,10 @@ import java.util.Collections;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
interface CheckFunction {
|
|
||||||
boolean apply(Location location);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class BlockComponent {
|
public class BlockComponent {
|
||||||
private final BlockComponentMode mode;
|
private final BlockComponentMode mode;
|
||||||
private final Set<Material> blocks;
|
private final Set<Material> blocks;
|
||||||
private CheckFunction customCheckFunction;
|
private ICheckFunction customCheckFunction;
|
||||||
|
|
||||||
public BlockComponent(BlockComponentMode mode){
|
public BlockComponent(BlockComponentMode mode){
|
||||||
if(mode == BlockComponentMode.SET){
|
if(mode == BlockComponentMode.SET){
|
||||||
@ -31,7 +27,7 @@ public class BlockComponent {
|
|||||||
this.blocks = validBlocks;
|
this.blocks = validBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockComponent(CheckFunction customCheckFunction){
|
public BlockComponent(ICheckFunction customCheckFunction){
|
||||||
this.mode = BlockComponentMode.CUSTOM;
|
this.mode = BlockComponentMode.CUSTOM;
|
||||||
this.blocks = Collections.emptySet();
|
this.blocks = Collections.emptySet();
|
||||||
this.customCheckFunction = customCheckFunction;
|
this.customCheckFunction = customCheckFunction;
|
||||||
@ -43,6 +39,7 @@ public class BlockComponent {
|
|||||||
this.mode = BlockComponentMode.SET;
|
this.mode = BlockComponentMode.SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isValidBlock(Location location){
|
public boolean isValidBlock(Location location){
|
||||||
if(this.mode == BlockComponentMode.CUSTOM){
|
if(this.mode == BlockComponentMode.CUSTOM){
|
||||||
return this.customCheckFunction.apply(location);
|
return this.customCheckFunction.apply(location);
|
||||||
|
7
src/main/java/org/kapelle/multiblock/ICheckFunction.java
Normal file
7
src/main/java/org/kapelle/multiblock/ICheckFunction.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package org.kapelle.multiblock;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public interface ICheckFunction {
|
||||||
|
boolean apply(Location location);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user