added single type constructor to block component
This commit is contained in:
parent
bfa145b862
commit
d7f1759502
@ -5,6 +5,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
interface CheckFunction {
|
interface CheckFunction {
|
||||||
@ -36,6 +37,12 @@ public class BlockComponent {
|
|||||||
this.customCheckFunction = customCheckFunction;
|
this.customCheckFunction = customCheckFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockComponent(Material type){
|
||||||
|
this.blocks = new HashSet<>();
|
||||||
|
this.blocks.add(type);
|
||||||
|
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user