Fixed cauldrons as chunk loaders not detected correctly

This commit is contained in:
OmerBenGera 2020-10-03 13:24:51 +03:00
parent 972ea6ddb2
commit 014f3b2575

View File

@ -2,11 +2,13 @@ package com.bgsoftware.wildloaders.handlers;
import com.bgsoftware.wildloaders.WildLoadersPlugin;
import com.bgsoftware.wildloaders.api.loaders.LoaderData;
import com.bgsoftware.wildloaders.utils.ServerVersion;
import com.bgsoftware.wildloaders.utils.database.Database;
import com.bgsoftware.wildloaders.utils.locations.LocationUtils;
import com.bgsoftware.wildloaders.utils.threads.Executor;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import java.io.File;
import java.util.Optional;
@ -50,7 +52,13 @@ public final class DataHandler {
if(!loaderData.isPresent())
continue;
if(location.getBlock().getType() != loaderData.get().getLoaderItem().getType()){
Material blockType = location.getBlock().getType();
if(ServerVersion.isLegacy() && blockType == Material.CAULDRON){
blockType = Material.CAULDRON_ITEM;
}
if(blockType != loaderData.get().getLoaderItem().getType()){
WildLoadersPlugin.log("The chunk-loader at " + LocationUtils.getLocation(location) + " is invalid.");
continue;
}