9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-26 10:29:10 +00:00
This commit is contained in:
XiaoMoMi
2024-02-29 01:35:15 +08:00
parent 85e645a608
commit da68bd6793
6 changed files with 20 additions and 32 deletions

View File

@@ -30,8 +30,6 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.List;
public class QualityLoot extends Loot {
private final String[] qualityLoots;

View File

@@ -1081,34 +1081,26 @@ public class PlatformManager extends Function {
}
}
List<Block> lineOfSight = player.getLineOfSight(null, 5);
List<String> blockIds = lineOfSight.stream().map(block -> {
if (block == null) {
return "AIR";
}
if (block.getBlockData() instanceof Waterlogged waterlogged && waterlogged.isWaterlogged()) {
return "WATER";
}
return plugin.getPlatformInterface().getBlockID(block);
}).toList();
Block targetBlock = player.getTargetBlockExact(5, FluidCollisionMode.ALWAYS);
if (targetBlock == null)
return true;
String blockId = plugin.getPlatformInterface().getBlockID(targetBlock);
if (targetBlock.getBlockData() instanceof Waterlogged waterlogged && waterlogged.isWaterlogged()) {
blockId = "WATER";
}
for (PositiveFillMethod positiveFillMethod : wateringCanConfig.getPositiveFillMethods()) {
int index = 0;
for (String blockId : blockIds) {
if (positiveFillMethod.getId().equals(blockId)) {
Block block = lineOfSight.get(index);
if (!plugin.getAntiGriefLib().canPlace(player, block.getLocation()))
return true;
if (!wateringCanConfig.canUse(player, location))
return true;
add = positiveFillMethod.getAmount();
if (positiveFillMethod.getSound() != null)
AdventureUtils.playerSound(player, positiveFillMethod.getSound());
if (positiveFillMethod.getParticle() != null)
block.getWorld().spawnParticle(positiveFillMethod.getParticle(), block.getLocation().add(0.5,1.1, 0.5),5,0.1,0.1,0.1);
break;
}
index++;
if (positiveFillMethod.getId().equals(blockId)) {
if (!plugin.getAntiGriefLib().canPlace(player, targetBlock.getLocation()))
return true;
if (!wateringCanConfig.canUse(player, location))
return true;
add = positiveFillMethod.getAmount();
if (positiveFillMethod.getSound() != null)
AdventureUtils.playerSound(player, positiveFillMethod.getSound());
if (positiveFillMethod.getParticle() != null)
targetBlock.getWorld().spawnParticle(positiveFillMethod.getParticle(), targetBlock.getLocation().add(0.5,1.1, 0.5),5,0.1,0.1,0.1);
break;
}
}
}

View File

@@ -22,7 +22,6 @@ import de.tr7zw.changeme.nbtapi.NBTItem;
import io.th0rgal.oraxen.api.OraxenBlocks;
import io.th0rgal.oraxen.api.OraxenFurniture;
import io.th0rgal.oraxen.api.OraxenItems;
import io.th0rgal.oraxen.api.events.furniture.OraxenFurnitureInteractEvent;
import io.th0rgal.oraxen.items.ItemBuilder;
import io.th0rgal.oraxen.mechanics.Mechanic;
import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanic;

View File

@@ -20,7 +20,6 @@ package net.momirealms.customcrops.integration.season;
import me.casperge.realisticseasons.api.SeasonsAPI;
import net.advancedplugins.seasons.api.AdvancedSeasonsAPI;
import net.momirealms.customcrops.api.object.season.CCSeason;
import net.momirealms.customcrops.helper.Log;
import net.momirealms.customcrops.integration.SeasonInterface;
import org.bukkit.Bukkit;