mirror of
https://github.com/BentoBoxWorld/Greenhouses.git
synced 2024-11-25 03:55:29 +01:00
Remove some code smells.
This commit is contained in:
parent
6f6745e849
commit
8af2b2057d
@ -92,8 +92,8 @@ public class Greenhouses extends Addon {
|
||||
*/
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (manager != null) {
|
||||
if (manager.getEcoMgr() != null) manager.getEcoMgr().cancel();
|
||||
if (manager != null && manager.getEcoMgr() != null) {
|
||||
manager.getEcoMgr().cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,7 +419,7 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
||||
* @return a list of blocks that are required for this recipe
|
||||
*/
|
||||
public List<String> getRecipeBlocks() {
|
||||
return requiredBlocks.entrySet().stream().map(en -> Util.prettifyText(en.getKey().toString()) + " x " + en.getValue()).collect(Collectors.toList());
|
||||
return requiredBlocks.entrySet().stream().map(en -> Util.prettifyText(en.getKey().toString()) + " x " + en.getValue()).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -471,10 +471,10 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
||||
|
||||
private boolean canGrowOn(GrowthBlock block, GreenhousePlant p) {
|
||||
// Ceiling plants can only grow on ceiling blocks
|
||||
if (CEILING_PLANTS.contains(p.plantMaterial()) && block.floor()) {
|
||||
if (CEILING_PLANTS.contains(p.plantMaterial()) && Boolean.TRUE.equals(block.floor())) {
|
||||
return false;
|
||||
}
|
||||
return p.plantGrownOn().equals(block.block().getRelative(block.floor() ? BlockFace.DOWN : BlockFace.UP).getType());
|
||||
return p.plantGrownOn().equals(block.block().getRelative(Boolean.TRUE.equals(block.floor()) ? BlockFace.DOWN : BlockFace.UP).getType());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -24,7 +25,6 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
|
||||
import com.google.common.base.Enums;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
import world.bentobox.greenhouses.Greenhouses;
|
||||
@ -100,7 +100,7 @@ public class SnowTracker implements Listener {
|
||||
}
|
||||
|
||||
private boolean placeSnow(Block b) {
|
||||
Optional<Material> snowCauldron = Enums.getIfPresent(Material.class, "POWDER_SNOW_CAULDRON");
|
||||
Optional<Material> snowCauldron = Enums.getIfPresent(Material.class, "POWDER_SNOW_CAULDRON").toJavaUtil();
|
||||
if (snowCauldron.isPresent()) {
|
||||
if (b.getType().equals(Material.CAULDRON)) {
|
||||
b.setType(snowCauldron.get());
|
||||
|
Loading…
Reference in New Issue
Block a user