Move to Java 16
This commit is contained in:
parent
de4a4c17c0
commit
38de645e6b
18
pom.xml
18
pom.xml
|
@ -43,8 +43,8 @@
|
|||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<powermock.version>2.0.2</powermock.version>
|
||||
<java.version>16</java.version>
|
||||
<powermock.version>2.0.9</powermock.version>
|
||||
<!-- More visible way how to change dependency versions -->
|
||||
<spigot.version>1.16.3-R0.1-SNAPSHOT</spigot.version>
|
||||
<bentobox.version>1.16.0</bentobox.version>
|
||||
|
@ -126,7 +126,7 @@
|
|||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.11.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -185,14 +185,18 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<release>${java.version}</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.0</version>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<argLine>
|
||||
--illegal-access=permit
|
||||
</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -207,10 +211,12 @@
|
|||
<show>public</show>
|
||||
<failOnError>false</failOnError>
|
||||
<additionalJOption>-Xdoclint:none</additionalJOption>
|
||||
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package world.bentobox.greenhouses.data;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
@ -163,17 +164,17 @@ public class Greenhouse implements DataObject {
|
|||
/**
|
||||
* @return the boundingBox
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
public BoundingBox getBoundingBox() {
|
||||
return boundingBox;
|
||||
return Objects.requireNonNullElseGet(boundingBox, BoundingBox::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a bounding box of the greenhouse that does not include the walls or roof
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
public BoundingBox getInternalBoundingBox() {
|
||||
return boundingBox == null ? null : boundingBox.clone().expand(-1D);
|
||||
return getBoundingBox().clone().expand(-1D);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -64,7 +64,7 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
// Conversions
|
||||
// Original Material, Original Type, New Material, New Type, Probability
|
||||
//private final Map<Material, GreenhouseBlockConversions> conversionBlocks = new EnumMap<>(Material.class);
|
||||
private Multimap<Material, GreenhouseBlockConversions> conversionBlocks = ArrayListMultimap.create();
|
||||
private final Multimap<Material, GreenhouseBlockConversions> conversionBlocks = ArrayListMultimap.create();
|
||||
|
||||
private int mobLimit;
|
||||
private int waterCoverage;
|
||||
|
@ -121,7 +121,7 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
mobTree.put(lastProb + probability, new GreenhouseMob(mobType, mobSpawnOn));
|
||||
return true;
|
||||
} else {
|
||||
addon.logError("Mob chances add up to > 100% in " + type.toString() + " biome recipe! Skipping " + mobType.toString());
|
||||
addon.logError("Mob chances add up to > 100% in " + type.toString() + " biome recipe! Skipping " + mobType);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -245,17 +245,17 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
for(GreenhouseBlockConversions conversion_option : conversionBlocks.get(bType)) {
|
||||
|
||||
// Roll the dice before bothering with checking the surrounding block as I think it's more common for greenhouses to be filled with convertable blocks and thus this dice roll wont be "wasted"
|
||||
if(ThreadLocalRandom.current().nextDouble() < conversion_option.getProbability()) {
|
||||
if(ThreadLocalRandom.current().nextDouble() < conversion_option.probability()) {
|
||||
// Check if any of the adjacent blocks matches the required LocalMaterial, if there are any required LocalMaterials
|
||||
if(conversion_option.getLocalMaterial() != null) {
|
||||
if(conversion_option.localMaterial() != null) {
|
||||
for(BlockFace adjacent_block : ADJ_BLOCKS) {
|
||||
if(b.getRelative(adjacent_block).getType() == conversion_option.getLocalMaterial()) {
|
||||
b.setType(conversion_option.getNewMaterial());
|
||||
if(b.getRelative(adjacent_block).getType() == conversion_option.localMaterial()) {
|
||||
b.setType(conversion_option.newMaterial());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
b.setType(conversion_option.getNewMaterial());
|
||||
b.setType(conversion_option.newMaterial());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,10 +345,10 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
Location spawnLoc = b.getLocation().clone().add(new Vector(0.5, 0, 0.5));
|
||||
return getRandomMob()
|
||||
// Check if the spawn on block matches, if it exists
|
||||
.filter(m -> m.getMobSpawnOn().map(b.getRelative(BlockFace.DOWN).getType()::equals).orElse(true))
|
||||
.filter(m -> Optional.of(m.mobSpawnOn()).map(b.getRelative(BlockFace.DOWN).getType()::equals).orElse(true))
|
||||
// If spawn occurs, check if it can fit inside greenhouse
|
||||
.map(m -> {
|
||||
Entity entity = b.getWorld().spawnEntity(spawnLoc, m.getMobType());
|
||||
Entity entity = b.getWorld().spawnEntity(spawnLoc, m.mobType());
|
||||
if (entity != null) {
|
||||
preventZombie(entity);
|
||||
return addon
|
||||
|
@ -383,13 +383,11 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
return;
|
||||
}
|
||||
|
||||
if (entity instanceof Piglin) {
|
||||
Piglin p = (Piglin)entity;
|
||||
if (entity instanceof Piglin p) {
|
||||
p.setImmuneToZombification(true);
|
||||
return;
|
||||
}
|
||||
if (entity instanceof Hoglin) {
|
||||
Hoglin h = (Hoglin)entity;
|
||||
if (entity instanceof Hoglin h) {
|
||||
h.setImmuneToZombification(true);
|
||||
}
|
||||
}
|
||||
|
@ -434,11 +432,11 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
return false;
|
||||
}
|
||||
return getRandomPlant().map(p -> {
|
||||
if (bl.getY() != 0 && p.getPlantGrownOn().map(m -> m.equals(bl.getRelative(BlockFace.DOWN).getType())).orElse(false)) {
|
||||
BlockData dataBottom = p.getPlantMaterial().createBlockData();
|
||||
if (bl.getY() != 0 && Optional.of(p.plantGrownOn()).map(m -> m.equals(bl.getRelative(BlockFace.DOWN).getType())).orElse(false)) {
|
||||
BlockData dataBottom = p.plantMaterial().createBlockData();
|
||||
if (dataBottom instanceof Bisected) {
|
||||
((Bisected) dataBottom).setHalf(Bisected.Half.BOTTOM);
|
||||
BlockData dataTop = p.getPlantMaterial().createBlockData();
|
||||
BlockData dataTop = p.plantMaterial().createBlockData();
|
||||
((Bisected) dataTop).setHalf(Bisected.Half.TOP);
|
||||
if (bl.getRelative(BlockFace.UP).getType().equals(Material.AIR)) {
|
||||
bl.setBlockData(dataBottom, false);
|
||||
|
@ -557,7 +555,7 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
* @return the mob types that may spawn due to this recipe
|
||||
*/
|
||||
public Set<EntityType> getMobTypes() {
|
||||
return mobTree.values().stream().map(GreenhouseMob::getMobType).collect(Collectors.toSet());
|
||||
return mobTree.values().stream().map(GreenhouseMob::mobType).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,41 +2,4 @@ package world.bentobox.greenhouses.greenhouse;
|
|||
|
||||
import org.bukkit.Material;
|
||||
|
||||
class GreenhouseBlockConversions {
|
||||
private final Material oldMaterial;
|
||||
private final Material newMaterial;
|
||||
private final double probability;
|
||||
private final Material localMaterial;
|
||||
|
||||
public GreenhouseBlockConversions(Material oldMaterial, Material newMaterial, double probability, Material localMaterial) {
|
||||
this.oldMaterial = oldMaterial;
|
||||
this.newMaterial = newMaterial;
|
||||
this.probability = probability;
|
||||
this.localMaterial = localMaterial;
|
||||
}
|
||||
/**
|
||||
* @return the oldMaterial
|
||||
*/
|
||||
public Material getOldMaterial() {
|
||||
return oldMaterial;
|
||||
}
|
||||
/**
|
||||
* @return the newMaterial
|
||||
*/
|
||||
public Material getNewMaterial() {
|
||||
return newMaterial;
|
||||
}
|
||||
/**
|
||||
* @return the probability
|
||||
*/
|
||||
public double getProbability() {
|
||||
return probability;
|
||||
}
|
||||
/**
|
||||
* @return the localMaterial
|
||||
*/
|
||||
public Material getLocalMaterial() {
|
||||
return localMaterial;
|
||||
}
|
||||
|
||||
}
|
||||
record GreenhouseBlockConversions (Material oldMaterial, Material newMaterial, double probability, Material localMaterial) { }
|
||||
|
|
|
@ -1,31 +1,6 @@
|
|||
package world.bentobox.greenhouses.greenhouse;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
class GreenhouseMob {
|
||||
private final EntityType mobType;
|
||||
private final Material mobSpawnOn;
|
||||
/**
|
||||
* @param mobType - entity type of mob
|
||||
* @param mobSpawnOn - material on which it much spawn, or null if any
|
||||
*/
|
||||
public GreenhouseMob(EntityType mobType, Material mobSpawnOn) {
|
||||
this.mobType = mobType;
|
||||
this.mobSpawnOn = mobSpawnOn;
|
||||
}
|
||||
/**
|
||||
* @return the mobType
|
||||
*/
|
||||
public EntityType getMobType() {
|
||||
return mobType;
|
||||
}
|
||||
/**
|
||||
* @return the mobSpawnOn
|
||||
*/
|
||||
public Optional<Material> getMobSpawnOn() {
|
||||
return Optional.of(mobSpawnOn);
|
||||
}
|
||||
}
|
||||
record GreenhouseMob(EntityType mobType, Material mobSpawnOn) { }
|
||||
|
|
|
@ -1,32 +1,5 @@
|
|||
package world.bentobox.greenhouses.greenhouse;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
class GreenhousePlant {
|
||||
private final Material plantMaterial;
|
||||
private final Material plantGrownOn;
|
||||
/**
|
||||
* Describes a recipe plant
|
||||
* @param plantMaterial - material
|
||||
* @param plantGrownOn - material on which this grows
|
||||
*/
|
||||
public GreenhousePlant(Material plantMaterial,Material plantGrownOn) {
|
||||
this.plantMaterial = plantMaterial;
|
||||
this.plantGrownOn = plantGrownOn;
|
||||
}
|
||||
/**
|
||||
* @return the plantMaterial
|
||||
*/
|
||||
public Material getPlantMaterial() {
|
||||
return plantMaterial;
|
||||
}
|
||||
/**
|
||||
* @return the plantGrownOn
|
||||
*/
|
||||
public Optional<Material> getPlantGrownOn() {
|
||||
return Optional.ofNullable(plantGrownOn);
|
||||
}
|
||||
|
||||
}
|
||||
record GreenhousePlant(Material plantMaterial,Material plantGrownOn) { }
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package world.bentobox.greenhouses.greenhouse;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -28,13 +26,12 @@ import world.bentobox.greenhouses.world.AsyncWorldCache;
|
|||
public class Roof extends MinMaxXZ {
|
||||
private static final List<Material> ROOF_BLOCKS;
|
||||
static {
|
||||
List<Material> r = Arrays.stream(Material.values())
|
||||
// Roof blocks
|
||||
ROOF_BLOCKS = Arrays.stream(Material.values())
|
||||
.filter(Material::isBlock) // Blocks only, no items
|
||||
.filter(m -> Tag.TRAPDOORS.isTagged(m) // All trapdoors
|
||||
|| (m.name().contains("GLASS") && !m.name().contains("GLASS_PANE")) // All glass blocks
|
||||
|| m.equals(Material.HOPPER)) // Hoppers
|
||||
.collect(Collectors.toList());
|
||||
ROOF_BLOCKS = Collections.unmodifiableList(r);
|
||||
|| m.equals(Material.HOPPER)).toList();
|
||||
}
|
||||
/**
|
||||
* Check if material is a roof material
|
||||
|
@ -56,7 +53,7 @@ public class Roof extends MinMaxXZ {
|
|||
|
||||
/**
|
||||
* Finds a roof from a starting location under the roof and characterizes it
|
||||
* @param cache
|
||||
* @param cache async world cache
|
||||
* @param loc - starting location
|
||||
*/
|
||||
public Roof(AsyncWorldCache cache, Location loc) {
|
||||
|
@ -207,7 +204,6 @@ public class Roof extends MinMaxXZ {
|
|||
|
||||
/**
|
||||
* Get highest roof block
|
||||
* @param v - vector of search block
|
||||
* @param x - x coord of current search
|
||||
* @param startY - starting y coord
|
||||
* @param z - z coord of current search
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package world.bentobox.greenhouses.greenhouse;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -17,14 +15,13 @@ import world.bentobox.greenhouses.world.AsyncWorldCache;
|
|||
public class Walls extends MinMaxXZ {
|
||||
private static final List<Material> WALL_BLOCKS;
|
||||
static {
|
||||
List<Material> w = Arrays.stream(Material.values())
|
||||
// Hoppers
|
||||
WALL_BLOCKS = Arrays.stream(Material.values())
|
||||
.filter(Material::isBlock) // Blocks only, no items
|
||||
.filter(m -> !m.name().contains("TRAPDOOR")) // No trap doors
|
||||
.filter(m -> m.name().contains("DOOR") // All doors
|
||||
|| (m.name().contains("GLASS") && !m.name().contains("GLASS_PANE")) // All glass blocks
|
||||
|| m.equals(Material.HOPPER)) // Hoppers
|
||||
.collect(Collectors.toList());
|
||||
WALL_BLOCKS = Collections.unmodifiableList(w);
|
||||
|| m.equals(Material.HOPPER)).toList();
|
||||
}
|
||||
|
||||
private int floor;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package world.bentobox.greenhouses.listeners;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -34,13 +32,8 @@ public class GreenhouseEvents implements Listener {
|
|||
private static final String BIOME = "[biome]";
|
||||
private static final Set<Biome> NETHER_BIOMES;
|
||||
static {
|
||||
Set<Biome> nb = new HashSet<>();
|
||||
nb.add(Biome.NETHER_WASTES);
|
||||
nb.add(Biome.WARPED_FOREST);
|
||||
nb.add(Biome.CRIMSON_FOREST);
|
||||
nb.add(Biome.SOUL_SAND_VALLEY);
|
||||
nb.add(Biome.BASALT_DELTAS);
|
||||
NETHER_BIOMES = Collections.unmodifiableSet(nb);
|
||||
NETHER_BIOMES = Set.of(Biome.NETHER_WASTES, Biome.WARPED_FOREST, Biome.CRIMSON_FOREST,
|
||||
Biome.SOUL_SAND_VALLEY, Biome.BASALT_DELTAS);
|
||||
}
|
||||
private final Greenhouses addon;
|
||||
|
||||
|
@ -118,7 +111,7 @@ public class GreenhouseEvents implements Listener {
|
|||
private void handleTransition(User user, Location toLoc, Location fromLoc) {
|
||||
Optional<Greenhouse> to = addon.getManager().getMap().getGreenhouse(toLoc);
|
||||
Optional<Greenhouse> from = addon.getManager().getMap().getGreenhouse(fromLoc);
|
||||
if (!to.isPresent() && !from.isPresent()) {
|
||||
if (to.isEmpty() && from.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (to.isPresent() && from.isPresent()) {
|
||||
|
@ -131,12 +124,12 @@ public class GreenhouseEvents implements Listener {
|
|||
return;
|
||||
}
|
||||
// from is a greenhouse
|
||||
if (from.isPresent() && !to.isPresent()) {
|
||||
if (from.isPresent() && to.isEmpty()) {
|
||||
// Exiting
|
||||
user.sendMessage("greenhouses.event.leaving", BIOME, from.get().getBiomeRecipe().getFriendlyName());
|
||||
return;
|
||||
}
|
||||
if (!from.isPresent()) {
|
||||
if (from.isEmpty()) {
|
||||
// Entering
|
||||
user.sendMessage("greenhouses.event.entering", BIOME, to.get().getBiomeRecipe().getFriendlyName());
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class GreenhouseGuard implements Listener {
|
|||
// 1. inside district or outside - always ok
|
||||
// 2. inside to outside - allowFlowOut determines
|
||||
// 3. outside to inside - allowFlowIn determines
|
||||
if (!to.isPresent() && !from.isPresent()) {
|
||||
if (to.isEmpty() && from.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (to.isPresent() && from.isPresent() && to.equals(from)) {
|
||||
|
@ -64,9 +64,7 @@ public class GreenhouseGuard implements Listener {
|
|||
public void onPistonPush(BlockPistonExtendEvent e) {
|
||||
e.setCancelled(e.getBlocks().stream()
|
||||
.map(Block::getLocation)
|
||||
.filter(this::inGreenhouse)
|
||||
.findFirst()
|
||||
.isPresent());
|
||||
.anyMatch(this::inGreenhouse));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,9 +75,7 @@ public class GreenhouseGuard implements Listener {
|
|||
public void onPistonPull(BlockPistonRetractEvent e) {
|
||||
e.setCancelled(e.getBlocks().stream()
|
||||
.map(Block::getLocation)
|
||||
.filter(this::inGreenhouse)
|
||||
.findFirst()
|
||||
.isPresent());
|
||||
.anyMatch(this::inGreenhouse));
|
||||
}
|
||||
|
||||
private boolean inGreenhouse(Location l) {
|
||||
|
|
|
@ -13,10 +13,10 @@ import world.bentobox.greenhouses.Greenhouses;
|
|||
*/
|
||||
public class IslandChangeEvents implements Listener {
|
||||
|
||||
private Greenhouses addon;
|
||||
private final Greenhouses addon;
|
||||
|
||||
/**
|
||||
* @param addon
|
||||
* @param addon greenhouse addon
|
||||
*/
|
||||
public IslandChangeEvents(Greenhouses addon) {
|
||||
this.addon = addon;
|
||||
|
|
|
@ -83,7 +83,7 @@ public class SnowTracker implements Listener {
|
|||
|
||||
/**
|
||||
* TODO finish
|
||||
* @param e
|
||||
* @param e block form event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onBlockFormEvent(final BlockFormEvent e) {
|
||||
|
@ -121,14 +121,12 @@ public class SnowTracker implements Listener {
|
|||
.filter(g -> g.getLocation().getWorld().equals(world))
|
||||
.filter(g -> !g.isBroken())
|
||||
.filter(g -> g.getRoofHopperLocation() != null)
|
||||
.forEach(g -> {
|
||||
Util.getChunkAtAsync(g.getRoofHopperLocation()).thenRun(() -> {
|
||||
if (g.getRoofHopperLocation().getBlock().getType().equals(Material.HOPPER)
|
||||
&& ((Hopper)g.getRoofHopperLocation().getBlock().getState()).getInventory().contains(Material.WATER_BUCKET)) {
|
||||
removeWaterBucketAndShake(g);
|
||||
}
|
||||
});
|
||||
});
|
||||
.forEach(g -> Util.getChunkAtAsync(g.getRoofHopperLocation()).thenRun(() -> {
|
||||
if (g.getRoofHopperLocation().getBlock().getType().equals(Material.HOPPER)
|
||||
&& ((Hopper)g.getRoofHopperLocation().getBlock().getState()).getInventory().contains(Material.WATER_BUCKET)) {
|
||||
removeWaterBucketAndShake(g);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void startSnow(World world) {
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
package world.bentobox.greenhouses.managers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
|
@ -13,14 +21,6 @@ import world.bentobox.greenhouses.Greenhouses;
|
|||
import world.bentobox.greenhouses.data.Greenhouse;
|
||||
import world.bentobox.greenhouses.greenhouse.BiomeRecipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Runs the ecosystem for a greenhouse
|
||||
* @author tastybento
|
||||
|
|
|
@ -80,8 +80,7 @@ public class GreenhouseFinder {
|
|||
|
||||
/**
|
||||
* Check the greenhouse has the right number of everything
|
||||
* @param cache
|
||||
* @param gh2 - greenhouse
|
||||
* @param cache async world cache
|
||||
* @param roof - roof object
|
||||
* @param walls - walls object
|
||||
* @return future set of Greenhouse Results
|
||||
|
@ -94,7 +93,6 @@ public class GreenhouseFinder {
|
|||
|
||||
private Set<GreenhouseResult> checkGHAsync(CompletableFuture<Set<GreenhouseResult>> r, AsyncWorldCache cache,
|
||||
Roof roof, Walls walls) {
|
||||
Set<GreenhouseResult> result = new HashSet<>();
|
||||
cc = new CounterCheck();
|
||||
int y;
|
||||
for (y = roof.getHeight(); y > walls.getFloor(); y--) {
|
||||
|
@ -116,7 +114,7 @@ public class GreenhouseFinder {
|
|||
}
|
||||
}
|
||||
|
||||
result.addAll(checkErrors(roof, y));
|
||||
Set<GreenhouseResult> result = new HashSet<>(checkErrors(roof, y));
|
||||
Bukkit.getScheduler().runTask(BentoBox.getInstance(), () -> r.complete(result));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -185,7 +185,6 @@ public class GreenhouseManager implements Listener {
|
|||
/**
|
||||
* Tries to match the greenhouse to a recipe by going through all of them in order
|
||||
* @param finder - finder object
|
||||
* @param resultSet - result set from find
|
||||
*/
|
||||
private CompletableFuture<Set<GreenhouseResult>> findRecipe(GreenhouseFinder finder) {
|
||||
CompletableFuture<Set<GreenhouseResult>> r = new CompletableFuture<>();
|
||||
|
@ -214,7 +213,6 @@ public class GreenhouseManager implements Listener {
|
|||
|
||||
/**
|
||||
* Checks to see if the greenhouse meets the designated recipe and returns the result
|
||||
* @param r - completable future
|
||||
* @param finder - finder object
|
||||
* @param greenhouseRecipe - recipe requested
|
||||
* @param resultSet - result set from finder
|
||||
|
|
|
@ -123,7 +123,7 @@ public class GreenhouseMap {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param island
|
||||
* @param island island
|
||||
*/
|
||||
public void removeGreenhouses(Island island) {
|
||||
greenhouses.remove(island);
|
||||
|
|
|
@ -218,7 +218,7 @@ public class RecipeManager {
|
|||
ConfigurationSection temp = biomeRecipeConfig.getConfigurationSection("mobs");
|
||||
// Mob EntityType: Probability:Spawn on Material
|
||||
if (temp != null) {
|
||||
((HashMap<String,Object>)temp.getValues(false)).entrySet().forEach(s -> parseMob(s,b));
|
||||
temp.getValues(false).entrySet().forEach(s -> parseMob(s,b));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import world.bentobox.greenhouses.greenhouse.BiomeRecipe;
|
|||
public class Panel {
|
||||
|
||||
private static final String COVERAGE = "[coverage]";
|
||||
private Greenhouses addon;
|
||||
private final Greenhouses addon;
|
||||
|
||||
public Panel(Greenhouses addon) {
|
||||
super();
|
||||
|
|
|
@ -22,8 +22,8 @@ import world.bentobox.greenhouses.managers.GreenhouseManager.GreenhouseResult;
|
|||
*/
|
||||
public class PanelClick implements ClickHandler {
|
||||
|
||||
private Greenhouses addon;
|
||||
private BiomeRecipe br;
|
||||
private final Greenhouses addon;
|
||||
private final BiomeRecipe br;
|
||||
|
||||
public PanelClick(Greenhouses addon, BiomeRecipe br) {
|
||||
this.addon = addon;
|
||||
|
|
|
@ -52,7 +52,7 @@ class MakeCommand extends CompositeCommand {
|
|||
@Override
|
||||
public boolean execute(User user, String label, List<String> args) {
|
||||
if (args.isEmpty()) {
|
||||
new Panel((Greenhouses)this.getAddon()).showPanel(user);
|
||||
new Panel(this.getAddon()).showPanel(user);
|
||||
return true;
|
||||
}
|
||||
// Check recipe given matches
|
||||
|
@ -83,7 +83,7 @@ class MakeCommand extends CompositeCommand {
|
|||
private Map<String, BiomeRecipe> getRecipes(User user) {
|
||||
return ((Greenhouses)getAddon()).getRecipes().getBiomeRecipes().stream()
|
||||
.filter(br -> user.hasPermission(br.getPermission()))
|
||||
.collect(Collectors.toMap(br -> br.getName(), br -> br));
|
||||
.collect(Collectors.toMap(BiomeRecipe::getName, br -> br));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,7 +129,7 @@ class MakeCommand extends CompositeCommand {
|
|||
|
||||
@Override
|
||||
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
|
||||
return Optional.of(new ArrayList<String>(this.getRecipes(user).keySet()));
|
||||
return Optional.of(new ArrayList<>(this.getRecipes(user).keySet()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class RemoveCommand extends CompositeCommand {
|
|||
user.sendMessage("greenhouses.errors.no-rank");
|
||||
return false;
|
||||
}
|
||||
Greenhouses addon = ((Greenhouses)this.getAddon());
|
||||
Greenhouses addon = this.getAddon();
|
||||
// Remove greenhouse if it exists
|
||||
if (!addon.getManager().getMap().getGreenhouse(user.getLocation()).map(gh -> {
|
||||
user.sendMessage("general.success");
|
||||
|
|
|
@ -17,7 +17,7 @@ public class SettingsTest {
|
|||
private Settings s;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
s = new Settings();
|
||||
}
|
||||
|
||||
|
|
|
@ -55,11 +55,8 @@ public class GreenhouseTest {
|
|||
@Mock
|
||||
private BiomeRecipe br;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
// RecipeManager
|
||||
PowerMockito.mockStatic(RecipeManager.class);
|
||||
when(br.getName()).thenReturn("test");
|
||||
|
@ -74,10 +71,9 @@ public class GreenhouseTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
public void tearDown() {
|
||||
Mockito.framework().clearInlineMocks();
|
||||
}
|
||||
|
||||
|
@ -189,7 +185,7 @@ public class GreenhouseTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.data.Greenhouse#setRoofHopperLocation(org.bukkit.Location)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.data.Greenhouse#setRoofHopperLocation(Vector)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetRoofHopperLocation() {
|
||||
|
@ -288,7 +284,7 @@ public class GreenhouseTest {
|
|||
@Test
|
||||
public void testSetMissingBlocks() {
|
||||
gh.setMissingBlocks(Collections.singletonMap(Material.ACACIA_BOAT, 20));
|
||||
assertTrue(gh.getMissingBlocks().get(Material.ACACIA_BOAT) == 20);
|
||||
assertEquals(20, (int) gh.getMissingBlocks().get(Material.ACACIA_BOAT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -61,7 +61,6 @@ public class BiomeRecipeTest {
|
|||
@Mock
|
||||
private Greenhouses addon;
|
||||
|
||||
private Biome type;
|
||||
@Mock
|
||||
private Greenhouse gh;
|
||||
|
||||
|
@ -85,14 +84,11 @@ public class BiomeRecipeTest {
|
|||
@Mock
|
||||
private Settings settings;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
PowerMockito.mockStatic(Bukkit.class);
|
||||
when(Bukkit.createBlockData(any(Material.class))).thenReturn(bd);
|
||||
type = Biome.BADLANDS;
|
||||
Biome type = Biome.BADLANDS;
|
||||
// Greenhouse
|
||||
when(gh.getArea()).thenReturn(100);
|
||||
when(gh.getFloorHeight()).thenReturn(100);
|
||||
|
|
|
@ -46,11 +46,8 @@ public class RoofTest {
|
|||
@Mock
|
||||
private AsyncWorldCache cache;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
PowerMockito.mockStatic(Bukkit.class, Mockito.RETURNS_MOCKS);
|
||||
when(Tag.TRAPDOORS.isTagged(Material.BIRCH_TRAPDOOR)).thenReturn(true);
|
||||
PowerMockito.mockStatic(Greenhouses.class, Mockito.RETURNS_MOCKS);
|
||||
|
|
|
@ -58,11 +58,8 @@ public class WallsTest {
|
|||
private CompletableFuture<Walls> r;
|
||||
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
PowerMockito.mockStatic(Bukkit.class, Mockito.RETURNS_MOCKS);
|
||||
when(Tag.TRAPDOORS.isTagged(Material.BIRCH_TRAPDOOR)).thenReturn(true);
|
||||
// Declare mock after mocking Bukkit
|
||||
|
@ -153,7 +150,7 @@ public class WallsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Walls#lookAtBlockFaces(world.bentobox.greenhouses.greenhouse.Walls.WallFinder, org.bukkit.World, int, int, int)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Walls#lookAtBlockFaces(WallFinder, int, int, int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testLookAtBlockFaces() {
|
||||
|
@ -166,7 +163,7 @@ public class WallsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Walls#lookAtBlockFaces(world.bentobox.greenhouses.greenhouse.Walls.WallFinder, org.bukkit.World, int, int, int)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Walls#lookAtBlockFaces(WallFinder, int, int, int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testLookAtBlockFacesNoGlass() {
|
||||
|
@ -180,7 +177,7 @@ public class WallsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Walls#getFloorY(org.bukkit.World, int, int, int, int, int)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Walls#getFloorY(int, int, int, int, int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetFloorYZeroY() {
|
||||
|
@ -188,7 +185,7 @@ public class WallsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Walls#getFloorY(org.bukkit.World, int, int, int, int, int)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Walls#getFloorY(int, int, int, int, int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetFloorY() {
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
|||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -81,11 +80,8 @@ public class GreenhouseEventsTest {
|
|||
@Mock
|
||||
private ItemStack waterBucket;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
PowerMockito.mockStatic(User.class);
|
||||
when(User.getInstance(any(Player.class))).thenReturn(user);
|
||||
PowerMockito.mockStatic(Bukkit.class, Mockito.RETURNS_MOCKS);
|
||||
|
@ -130,14 +126,7 @@ public class GreenhouseEventsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(org.bukkit.event.player.PlayerInteractEvent)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(PlayerBucketEmptyEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnPlayerInteractInNetherInGreenhouse() {
|
||||
|
@ -154,7 +143,7 @@ public class GreenhouseEventsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(org.bukkit.event.player.PlayerInteractEvent)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(PlayerBucketEmptyEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnPlayerInteractInNetherOutsideOfGreenhouse() {
|
||||
|
@ -171,7 +160,7 @@ public class GreenhouseEventsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(org.bukkit.event.player.PlayerInteractEvent)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(PlayerBucketEmptyEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnPlayerInteractInNetherGreenhouse() {
|
||||
|
@ -187,7 +176,7 @@ public class GreenhouseEventsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(org.bukkit.event.player.PlayerInteractEvent)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(PlayerBucketEmptyEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnPlayerInteractInNetherNotInNether() {
|
||||
|
@ -206,7 +195,7 @@ public class GreenhouseEventsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(org.bukkit.event.player.PlayerInteractEvent)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(PlayerBucketEmptyEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnPlayerInteractInNetherNotWaterBucket() {
|
||||
|
@ -222,7 +211,7 @@ public class GreenhouseEventsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(org.bukkit.event.player.PlayerInteractEvent)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.listeners.GreenhouseEvents#onPlayerInteractInNether(PlayerBucketEmptyEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testOnPlayerInteractInNetherNotInGreenhouse() {
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package world.bentobox.greenhouses.managers;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
@ -17,7 +14,6 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -51,10 +47,9 @@ public class EcoSystemManagerTest {
|
|||
// CUT
|
||||
private EcoSystemManager eco;
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
gh = new Greenhouse();
|
||||
// 4x4x4 greenhouse
|
||||
BoundingBox bb = BoundingBox.of(new Vector(0,0,0), new Vector(6,5,6));
|
||||
|
@ -89,14 +84,7 @@ public class EcoSystemManagerTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(world.bentobox.greenhouses.data.Greenhouse)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(Greenhouse, boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAvailableBlocksAirAboveBlock() {
|
||||
|
@ -106,7 +94,7 @@ public class EcoSystemManagerTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(world.bentobox.greenhouses.data.Greenhouse)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(Greenhouse, boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAvailableBlocksPlantAboveBlock() {
|
||||
|
@ -117,7 +105,7 @@ public class EcoSystemManagerTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(world.bentobox.greenhouses.data.Greenhouse)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(Greenhouse, boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAvailableBlocksAllAir() {
|
||||
|
@ -127,7 +115,7 @@ public class EcoSystemManagerTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(world.bentobox.greenhouses.data.Greenhouse)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(Greenhouse, boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAvailableBlocksAllLiquid() {
|
||||
|
@ -138,7 +126,7 @@ public class EcoSystemManagerTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(world.bentobox.greenhouses.data.Greenhouse)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(Greenhouse, boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAvailableBlocksAllPlant() {
|
||||
|
@ -150,7 +138,7 @@ public class EcoSystemManagerTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(world.bentobox.greenhouses.data.Greenhouse)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(Greenhouse, boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAvailableBlocksLiquidAboveBlockIgnoreLiquids() {
|
||||
|
@ -161,7 +149,7 @@ public class EcoSystemManagerTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(world.bentobox.greenhouses.data.Greenhouse)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(Greenhouse, boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAvailableBlocksAirAboveLiquidNotIgnoreLiquids() {
|
||||
|
@ -173,13 +161,13 @@ public class EcoSystemManagerTest {
|
|||
|
||||
List<Block> result = eco.getAvailableBlocks(gh, false);
|
||||
assertEquals(16, result.size());
|
||||
for (int i = 0; i< result.size(); i++) {
|
||||
assertEquals(air, result.get(i));
|
||||
for (Block value : result) {
|
||||
assertEquals(air, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(world.bentobox.greenhouses.data.Greenhouse)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.EcoSystemManager#getAvailableBlocks(Greenhouse, boolean)}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAvailableBlocksAirAboveLiquidIgnoreLiquids() {
|
||||
|
@ -191,8 +179,8 @@ public class EcoSystemManagerTest {
|
|||
|
||||
List<Block> result = eco.getAvailableBlocks(gh, true);
|
||||
assertEquals(16, result.size());
|
||||
for (int i = 0; i< result.size(); i++) {
|
||||
assertEquals(liquid, result.get(i));
|
||||
for (Block value : result) {
|
||||
assertEquals(liquid, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,10 +64,9 @@ public class GreenhouseFinderTest {
|
|||
private AsyncWorldCache cache;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
public void setUp() {
|
||||
PowerMockito.mockStatic(Bukkit.class, Mockito.RETURNS_MOCKS);
|
||||
when(Tag.TRAPDOORS.isTagged(Material.BIRCH_TRAPDOOR)).thenReturn(true);
|
||||
// Declare mock after mocking Bukkit
|
||||
|
@ -100,7 +99,7 @@ public class GreenhouseFinderTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.GreenhouseFinder#checkGreenhouse(world.bentobox.greenhouses.data.Greenhouse, world.bentobox.greenhouses.greenhouse.Roof, world.bentobox.greenhouses.greenhouse.Walls)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.GreenhouseFinder#checkGreenhouse(AsyncWorldCache, Roof, Walls)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCheckGreenhouse() {
|
||||
|
@ -225,7 +224,7 @@ public class GreenhouseFinderTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.GreenhouseFinder#checkDoorsHoppers(world.bentobox.greenhouses.managers.GreenhouseFinder.CounterCheck, org.bukkit.block.Block)}.
|
||||
* Test method for {@link world.bentobox.greenhouses.managers.GreenhouseFinder#checkDoorsHoppers(CounterCheck, Material, Vector)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCheckDoorsHoppersHopper() {
|
||||
|
|
Loading…
Reference in New Issue