Bug fixes

This commit is contained in:
tastybento 2019-03-02 10:53:15 -08:00
parent dfd2d03d36
commit 2cc5dd8e1f
8 changed files with 42 additions and 21 deletions

View File

@ -5,7 +5,7 @@
<groupId>world.bentobox</groupId>
<artifactId>Greenhouses</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.2-SNAPSHOT</version>
<name>Greenhouses</name>
<description>Greenhouses is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like ASkyBlock or AcidIsland.</description>

View File

@ -187,10 +187,11 @@ public class Greenhouse implements DataObject {
}
/**
* @return area of greenhouse
*
* @return internal area of greenhouse
*/
public int getArea() {
return this.footprint.height * this.footprint.width;
return (this.footprint.height - 2) * (this.footprint.width - 2);
}
/**

View File

@ -1,6 +1,7 @@
package world.bentobox.greenhouses.greenhouse;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@ -432,13 +433,13 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
* @return true if this recipe has no mobs that may spawn
*/
public boolean noMobs() {
return mobTree.isEmpty();
return mobTree == null ? false : mobTree.isEmpty();
}
/**
* @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 == null ? Collections.emptySet() : mobTree.values().stream().map(GreenhouseMob::getMobType).collect(Collectors.toSet());
}
}

View File

@ -1,5 +1,5 @@
/**
*
*
*/
package world.bentobox.greenhouses.ui.panel;
@ -37,6 +37,7 @@ public class PanelClick implements ClickHandler {
@Override
public boolean onClick(Panel panel, User user, ClickType clickType, int slot) {
if (user.hasPermission(br.getPermission())) {
user.closeInventory();
makeGreenhouse(user, br);
}
return true;

View File

@ -51,7 +51,7 @@ class MakeCommand extends CompositeCommand {
}
return makeGreenhouse(user, null);
}
private boolean makeGreenhouse(User user, BiomeRecipe br) {
// Check flag
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.isAllowed(user, Greenhouses.GREENHOUSES)).orElse(false)) {
@ -80,5 +80,5 @@ class MakeCommand extends CompositeCommand {
}
return true;
}
}

View File

@ -1,5 +1,6 @@
package world.bentobox.greenhouses.ui.user;
import java.util.ArrayList;
import java.util.List;
import world.bentobox.bentobox.api.commands.CompositeCommand;
@ -44,8 +45,10 @@ public class UserCommand extends CompositeCommand {
*/
@Override
public boolean execute(User user, String label, List<String> args) {
this.showHelp(this, user);
return true;
if (args.isEmpty() && getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) != null) {
return getSubCommand("make").map(c -> c.execute(user, c.getLabel(), new ArrayList<>())).orElse(false);
}
return showHelp(this, user);
}
/**

View File

@ -47,15 +47,15 @@ greenhouses:
FAIL_NO_LAVA: "&cLava is required to make this recipe"
FAIL_NO_WATER: "&cWater is required to make this recipe"
success: "&2You successfully made a [biome] biome greenhouse! Biome will sync at next teleport or login."
info:
title: "&A[How To Build A Greenhouse]"
instructions: |
&EMake a box out of out of glass with 4 walls and a flat glass
&Eroof and add up to &F4 doors &Ein the walls.
&EPlace &F1 hopper &Ein a wall or roof and add water buckets.
&Eto make snow and/or bonemeal to grow plants automatically.
&ECheck the biome recipes for what blocks must be inside a
&Egreenhouse to make one successfully."
info:
title: "&A[How To Build A Greenhouse]"
instructions: |
&EMake a box out of out of glass with 4 walls and a flat glass
&Eroof and add up to &F4 doors &Ein the walls.
&EPlace &F1 hopper &Ein a wall or roof and add water buckets.
&Eto make snow and/or bonemeal to grow plants automatically.
&ECheck the biome recipes for what blocks must be inside a
&Egreenhouse to make one successfully.
general:

View File

@ -1,5 +1,5 @@
/**
*
*
*/
package world.bentobox.greenhouses.greenhouse;
@ -12,6 +12,7 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
@ -41,12 +42,13 @@ public class RoofTest {
when(location.getBlockX()).thenReturn(10);
when(location.getBlockY()).thenReturn(10);
when(location.getBlockZ()).thenReturn(10);
}
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#Roof(org.bukkit.Location)}.
*/
@Ignore
@Test
public void testRoof() {
//roof = new Roof(location);
@ -55,6 +57,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getMinX()}.
*/
@Ignore
@Test
public void testGetMinX() {
fail("Not yet implemented"); // TODO
@ -63,6 +66,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#setMinX(int)}.
*/
@Ignore
@Test
public void testSetMinX() {
fail("Not yet implemented"); // TODO
@ -71,6 +75,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getMaxX()}.
*/
@Ignore
@Test
public void testGetMaxX() {
fail("Not yet implemented"); // TODO
@ -79,6 +84,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#setMaxX(int)}.
*/
@Ignore
@Test
public void testSetMaxX() {
fail("Not yet implemented"); // TODO
@ -87,6 +93,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getMinZ()}.
*/
@Ignore
@Test
public void testGetMinZ() {
fail("Not yet implemented"); // TODO
@ -95,6 +102,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#setMinZ(int)}.
*/
@Ignore
@Test
public void testSetMinZ() {
fail("Not yet implemented"); // TODO
@ -103,6 +111,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getMaxZ()}.
*/
@Ignore
@Test
public void testGetMaxZ() {
fail("Not yet implemented"); // TODO
@ -111,6 +120,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#setMaxZ(int)}.
*/
@Ignore
@Test
public void testSetMaxZ() {
fail("Not yet implemented"); // TODO
@ -119,6 +129,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getArea()}.
*/
@Ignore
@Test
public void testGetArea() {
fail("Not yet implemented"); // TODO
@ -127,6 +138,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#isRoofFound()}.
*/
@Ignore
@Test
public void testIsRoofFound() {
fail("Not yet implemented"); // TODO
@ -135,6 +147,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getHeight()}.
*/
@Ignore
@Test
public void testGetHeight() {
fail("Not yet implemented"); // TODO
@ -143,6 +156,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getLocation()}.
*/
@Ignore
@Test
public void testGetLocation() {
fail("Not yet implemented"); // TODO
@ -151,6 +165,7 @@ public class RoofTest {
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#toString()}.
*/
@Ignore
@Test
public void testToString() {
fail("Not yet implemented"); // TODO