Removes recipe log spam.
Fixes https://github.com/BentoBoxWorld/Greenhouses/issues/44
This commit is contained in:
parent
85befc62db
commit
be5f40b9c0
|
@ -22,6 +22,10 @@ public class Settings implements ConfigObject {
|
|||
@ConfigComment("BentoBox GameModes that will use Greenhouses")
|
||||
@ConfigEntry(path = "greenhouses.game-modes")
|
||||
private List<String> gameModes = new ArrayList<>();
|
||||
|
||||
@ConfigComment("Show loaded recipe details during startup of server")
|
||||
@ConfigEntry(path = "greenhouses.startup-log")
|
||||
private boolean startupLog = false;
|
||||
|
||||
@ConfigComment("Weather and ecosystem settings")
|
||||
@ConfigComment("How often it should snow in the g/h when the weather is raining, in seconds")
|
||||
|
@ -108,6 +112,18 @@ public class Settings implements ConfigObject {
|
|||
public int getMobTick() {
|
||||
return mobTick;
|
||||
}
|
||||
/**
|
||||
* @return the startupLog
|
||||
*/
|
||||
public boolean isStartupLog() {
|
||||
return startupLog;
|
||||
}
|
||||
/**
|
||||
* @param startupLog the startupLog to set
|
||||
*/
|
||||
public void setStartupLog(boolean startupLog) {
|
||||
this.startupLog = startupLog;
|
||||
}
|
||||
/**
|
||||
* @return the allowFlowOut
|
||||
*/
|
||||
|
|
|
@ -75,6 +75,10 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
this.priority = priority;
|
||||
mobLimit = 9; // Default
|
||||
}
|
||||
|
||||
private void startupLog(String message) {
|
||||
if (addon.getSettings().isStartupLog()) addon.log(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param oldMaterial - material that will convert
|
||||
|
@ -85,7 +89,7 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
public void addConvBlocks(Material oldMaterial, Material newMaterial, double convChance, Material localMaterial) {
|
||||
double probability = Math.min(convChance/100 , 1D);
|
||||
conversionBlocks.put(oldMaterial, new GreenhouseBlockConversions(oldMaterial, newMaterial, probability, localMaterial));
|
||||
addon.log(" " + convChance + CHANCE_FOR + Util.prettifyText(oldMaterial.toString()) + " to convert to " + Util.prettifyText(newMaterial.toString()));
|
||||
startupLog(" " + convChance + CHANCE_FOR + Util.prettifyText(oldMaterial.toString()) + " to convert to " + Util.prettifyText(newMaterial.toString()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,7 +100,7 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
* @return true if add is successful
|
||||
*/
|
||||
public boolean addMobs(EntityType mobType, int mobProbability, Material mobSpawnOn) {
|
||||
addon.log(" " + mobProbability + CHANCE_FOR + Util.prettifyText(mobType.toString()) + " to spawn on " + Util.prettifyText(mobSpawnOn.toString())+ ".");
|
||||
startupLog(" " + mobProbability + CHANCE_FOR + Util.prettifyText(mobType.toString()) + " to spawn on " + Util.prettifyText(mobSpawnOn.toString())+ ".");
|
||||
double probability = ((double)mobProbability/100);
|
||||
double lastProb = mobTree.isEmpty() ? 0D : mobTree.lastKey();
|
||||
// Add up all the probabilities in the list so far
|
||||
|
@ -129,7 +133,7 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
addon.logError("Plant chances add up to > 100% in " + type.toString() + " biome recipe! Skipping " + plantMaterial.toString());
|
||||
return false;
|
||||
}
|
||||
addon.log(" " + plantProbability + CHANCE_FOR + Util.prettifyText(plantMaterial.toString()) + " to grow on " + Util.prettifyText(plantGrowOn.toString()));
|
||||
startupLog(" " + plantProbability + CHANCE_FOR + Util.prettifyText(plantMaterial.toString()) + " to grow on " + Util.prettifyText(plantGrowOn.toString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -139,7 +143,7 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
*/
|
||||
public void addReqBlocks(Material blockMaterial, int blockQty) {
|
||||
requiredBlocks.put(blockMaterial, blockQty);
|
||||
addon.log(" " + blockMaterial + " x " + blockQty);
|
||||
startupLog(" " + blockMaterial + " x " + blockQty);
|
||||
}
|
||||
|
||||
// Check required blocks
|
||||
|
@ -398,9 +402,9 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
*/
|
||||
public void setIcecoverage(int iceCoverage) {
|
||||
if (iceCoverage == 0) {
|
||||
addon.log(" No Ice Allowed");
|
||||
startupLog(" No Ice Allowed");
|
||||
} else if (iceCoverage > 0) {
|
||||
addon.log(" Ice > " + iceCoverage + "%");
|
||||
startupLog(" Ice > " + iceCoverage + "%");
|
||||
}
|
||||
this.iceCoverage = iceCoverage;
|
||||
}
|
||||
|
@ -417,9 +421,9 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
*/
|
||||
public void setLavacoverage(int lavaCoverage) {
|
||||
if (lavaCoverage == 0) {
|
||||
addon.log(" No Lava Allowed");
|
||||
startupLog(" No Lava Allowed");
|
||||
} else if (lavaCoverage > 0) {
|
||||
addon.log(" Lava > " + lavaCoverage + "%");
|
||||
startupLog(" Lava > " + lavaCoverage + "%");
|
||||
}
|
||||
this.lavaCoverage = lavaCoverage;
|
||||
}
|
||||
|
@ -464,9 +468,9 @@ public class BiomeRecipe implements Comparable<BiomeRecipe> {
|
|||
*/
|
||||
public void setWatercoverage(int waterCoverage) {
|
||||
if (waterCoverage == 0) {
|
||||
addon.log(" No Water Allowed");
|
||||
startupLog(" No Water Allowed");
|
||||
} else if (waterCoverage > 0) {
|
||||
addon.log(" Water > " + waterCoverage + "%");
|
||||
startupLog(" Water > " + waterCoverage + "%");
|
||||
}
|
||||
this.waterCoverage = waterCoverage;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class RecipeManager {
|
|||
BiomeRecipe b = new BiomeRecipe(addon, thisBiome, priority);
|
||||
// Set the name
|
||||
b.setName(biomeType);
|
||||
addon.log("Adding biome recipe for " + biomeType);
|
||||
if (addon.getSettings().isStartupLog()) addon.log("Adding biome recipe for " + biomeType);
|
||||
// Set the permission
|
||||
b.setPermission(biomeRecipeConfig.getString("permission",""));
|
||||
// Set the icon
|
||||
|
|
|
@ -1,51 +1,33 @@
|
|||
# Greenhouses Configuration
|
||||
#
|
||||
greenhouses:
|
||||
# BentoBox GameModes that will use Greenhouses
|
||||
game-modes:
|
||||
- BSkyBlock
|
||||
- AcidIsland
|
||||
- SkyGrid
|
||||
|
||||
# Console message level.
|
||||
# List the levels of debug or messages you want.
|
||||
# 0 = no messages except for warnings or severe errors
|
||||
# 1 = normal messages (default)
|
||||
# 2 and higher - debug levels - no need to use these unless you want to try debug
|
||||
debug:
|
||||
- 1
|
||||
|
||||
### Permissions limits
|
||||
# Set the maximum number of greenhouses a player can build
|
||||
# using greenhouses.limit.<number>
|
||||
# This is the default max. -1 is unlimited
|
||||
maxgreenhouses: -1
|
||||
# To have extra greenhouses deleted upon login set the following to true
|
||||
deleteextras: false
|
||||
|
||||
### Weather and ecosystem settings
|
||||
|
||||
# How often it should snow in the g/h when the weather is raining, in seconds
|
||||
snowspeed: 30
|
||||
# Chance of any snow falling in a greenhouse when the snow tick occurs
|
||||
# (1.0 = always, 0.0 = never)
|
||||
snowchance: 1
|
||||
# How many blocks should get snow 1 = all of them, 0 = none, 0.1 = 1 in 10
|
||||
snowdensity: 0.1
|
||||
|
||||
# Biome activity
|
||||
# How often should greenhouse biomes be checked to make sure they are still valid
|
||||
ecotick: 5
|
||||
# How often should plants potentially grow in minutes if bonemeal is in the hopper
|
||||
planttick: 1
|
||||
# How often should blocks potentially convert, in minutes
|
||||
# Example: dirt-> sand in desert greenhouse
|
||||
blocktick: 2
|
||||
# How often should mobs be potentially spawned in a greenhouse, in minutes
|
||||
mobtick: 5
|
||||
|
||||
|
||||
### Default settings for greenhouse actions
|
||||
# Allow lava or water to flow out of a greenhouse, e.g. through the door, floor
|
||||
allowflowout: false
|
||||
# Allow lava or water to flow into a greenhouse, e.g., through the door
|
||||
allowflowin: false
|
||||
|
||||
# BentoBox GameModes that will use Greenhouses
|
||||
game-modes:
|
||||
- BSkyBlock
|
||||
- AcidIsland
|
||||
- SkyGrid
|
||||
# Show loaded recipe details during startup of server
|
||||
startup-log: false
|
||||
# Weather and ecosystem settings
|
||||
# How often it should snow in the g/h when the weather is raining, in seconds
|
||||
snowspeed: 30.0
|
||||
# Chance of any snow falling in a greenhouse when the snow tick occurs
|
||||
# (1.0 = always, 0.0 = never)
|
||||
snowchance: 1.0
|
||||
# How many blocks should get snow 1 = all of them, 0 = none, 0.1 = 1 in 10
|
||||
snowdensity: 0.1
|
||||
# Biome activity
|
||||
# How often should greenhouse biomes be checked to make sure they are still valid
|
||||
ecotick: 5
|
||||
# How often should plants potentially grow in minutes if bonemeal is in the hopper
|
||||
planttick: 1
|
||||
# How often should blocks potentially convert, in minutes
|
||||
# Example: dirt-> sand in desert greenhouse
|
||||
blocktick: 2
|
||||
# How often should mobs be potentially spawned in a greenhouse, in minutes
|
||||
mobtick: 5
|
||||
# Default settings for greenhouse actions
|
||||
# Allow lava or water to flow out of a greenhouse, e.g. through the door, floor
|
||||
allowflowout: false
|
||||
# Allow lava or water to flow into a greenhouse, e.g., through the door
|
||||
allowflowin: false
|
||||
|
|
|
@ -42,6 +42,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
|||
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.greenhouses.Greenhouses;
|
||||
import world.bentobox.greenhouses.Settings;
|
||||
import world.bentobox.greenhouses.data.Greenhouse;
|
||||
import world.bentobox.greenhouses.managers.GreenhouseManager;
|
||||
import world.bentobox.greenhouses.managers.GreenhouseManager.GreenhouseResult;
|
||||
|
@ -80,6 +81,8 @@ public class BiomeRecipeTest {
|
|||
private GreenhouseMap map;
|
||||
@Mock
|
||||
private BukkitScheduler scheduler;
|
||||
@Mock
|
||||
private Settings settings;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
|
@ -108,16 +111,7 @@ public class BiomeRecipeTest {
|
|||
when(block.getLocation()).thenReturn(location);
|
||||
when(location.clone()).thenReturn(location);
|
||||
when(location.add(any(Vector.class))).thenReturn(location);
|
||||
// Set up default recipe
|
||||
br = new BiomeRecipe(addon, type, 0);
|
||||
br.setIcecoverage(2); // 1%
|
||||
br.setLavacoverage(1); // 1%
|
||||
br.setWatercoverage(1); // 1%
|
||||
br.addReqBlocks(Material.GRASS_BLOCK, 2);
|
||||
br.setFriendlyName("name");
|
||||
br.setName("name2");
|
||||
br.setIcon(Material.ACACIA_BOAT);
|
||||
br.setPermission("perm");
|
||||
|
||||
// Plugin
|
||||
when(addon.getPlugin()).thenReturn(plugin);
|
||||
// Manager
|
||||
|
@ -128,7 +122,20 @@ public class BiomeRecipeTest {
|
|||
when(map.getGreenhouse(any(Location.class))).thenReturn(optionalGh);
|
||||
// Bukkit Scheduler
|
||||
when(Bukkit.getScheduler()).thenReturn(scheduler);
|
||||
|
||||
// Settings
|
||||
when(addon.getSettings()).thenReturn(settings);
|
||||
when(settings.isStartupLog()).thenReturn(true);
|
||||
|
||||
// Set up default recipe
|
||||
br = new BiomeRecipe(addon, type, 0);
|
||||
br.setIcecoverage(2); // 1%
|
||||
br.setLavacoverage(1); // 1%
|
||||
br.setWatercoverage(1); // 1%
|
||||
br.addReqBlocks(Material.GRASS_BLOCK, 2);
|
||||
br.setFriendlyName("name");
|
||||
br.setName("name2");
|
||||
br.setIcon(Material.ACACIA_BOAT);
|
||||
br.setPermission("perm");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue