9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-22 16:39:36 +00:00

Update MaxCropsPerChunk.java

This commit is contained in:
XiaoMoMi
2022-05-25 10:11:13 +08:00
committed by GitHub
parent e8816a2d75
commit 1ca8eb5028

View File

@@ -8,6 +8,7 @@ import org.bukkit.configuration.file.FileConfiguration;
public class MaxCropsPerChunk {
public static boolean maxCropsPerChunk(Location location){
FileConfiguration config = CustomCrops.instance.getConfig();
if(!config.getBoolean("config.enable-limit")){
return false;
@@ -26,8 +27,9 @@ public class MaxCropsPerChunk {
final Location square = chunkLocation.clone().add((double)i, 0.0, (double)j);
for (int k = minY; k <= maxY; ++k) {
square.add(0.0, 1.0, 0.0);
if(CustomBlock.byAlreadyPlaced(location.getWorld().getBlockAt(square))!= null){
if (CustomBlock.byAlreadyPlaced(location.getWorld().getBlockAt(square)).getNamespacedID().contains("stage")) {
Blcok b = location.getWorld().getBlcokAt(square);
if(CustomBlock.byAlreadyPlaced(b)!= null){
if (CustomBlock.byAlreadyPlaced(b).getNamespacedID().contains("stage")) {
if (n++ > maxAmount) {
break Label_out;
}