Merge development branch into master

This commit is contained in:
BONNe 2019-03-28 23:49:23 +02:00
commit 2216db970e
7 changed files with 47 additions and 32 deletions

16
pom.xml
View File

@ -46,16 +46,19 @@
<java.version>1.8</java.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.13.2-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.3.0</bentobox.version>
<bentobox.version>1.4.0</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}</revision>
<revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. -->
<build.version>1.3.0</build.version>
<build.version>1.4.0</build.version>
<build.number>0</build.number>
</properties>
<profiles>
<!-- Build profile is activated by BUILD_NUMBER variable. It replaces 0 with correct build number. -->
<!-- This profile will be used only if BUILD_NUMBER environment variable exists. -->
<profile>
<id>develop</id>
<id>ci</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
@ -63,10 +66,13 @@
</activation>
<properties>
<!-- Override only if necessary -->
<revision>${build.version}-SNAPSHOT-${env.BUILD_NUMBER}</revision>
<build.number>${env.BUILD_NUMBER}</build.number>
<!-- GIT_BRANCH -->
</properties>
</profile>
<!-- master profile is activated by GIT_BRANCH variable. It removes '-SNAPSHOT' at the end of -->
<!-- ${build.version} -->
<!-- This profile will be used only if environment variable GIT_BRANCH is origin/master. -->
<profile>
<id>master</id>
<activation>

View File

@ -29,6 +29,7 @@ public class CaveBlock extends GameModeAddon
this.saveDefaultConfig();
this.loadSettings();
this.saveWorldSettings();
}
@ -61,10 +62,7 @@ public class CaveBlock extends GameModeAddon
@Override
public void onDisable()
{
if (this.settings != null)
{
new Config<>(this, Settings.class).saveConfigObject(this.settings);
}
// Do nothing
}
@ -204,6 +202,13 @@ public class CaveBlock extends GameModeAddon
return this.settings;
}
@Override
public void saveWorldSettings() {
if (settings != null) {
new Config<>(this, Settings.class).saveConfigObject(settings);
}
}
// ---------------------------------------------------------------------
// Section: Variables
@ -235,4 +240,5 @@ public class CaveBlock extends GameModeAddon
* String for the end world.
*/
private static final String THE_END = "_the_end";
}

View File

@ -358,13 +358,13 @@ public class Settings implements DataObject, WorldSettings
/**
* This method returns the visibleSettings object.
* @return the visibleSettings object.
* This method returns the hiddenFlags object.
* @return the hiddenFlags object.
*/
@Override
public List<String> getVisibleSettings()
public List<String> getHiddenFlags()
{
return visibleSettings;
return hiddenFlags;
}
@ -1131,13 +1131,13 @@ public class Settings implements DataObject, WorldSettings
/**
* This method sets the visibleSettings object value.
* @param visibleSettings the visibleSettings object new value.
* This method sets the hiddenFlags object value.
* @param hiddenFlags the hiddenFlags object new value.
*
*/
public void setVisibleSettings(List<String> visibleSettings)
public void setHiddenFlags(List<String> hiddenFlags)
{
this.visibleSettings = visibleSettings;
this.hiddenFlags = hiddenFlags;
}
@ -1858,9 +1858,10 @@ public class Settings implements DataObject, WorldSettings
@Adapter(FlagSerializer2.class)
private Map<Flag, Integer> defaultIslandSettings = new HashMap<>();
@ConfigComment("These are the settings visible to users. (Not implemented yet)")
@ConfigEntry(path = "world.visible-settings", experimental = true)
private List<String> visibleSettings = new ArrayList<>();
@ConfigComment("These settings/flags are hidden from users")
@ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings")
@ConfigEntry(path = "world.hidden-flags")
private List<String> hiddenFlags = new ArrayList<>();
@ConfigComment("Visitor banned commands - Visitors to islands cannot use these commands in this world")
@ConfigEntry(path = "world.visitor-banned-commands")

View File

@ -44,6 +44,10 @@ public class IslandCommand extends CompositeCommand {
new IslandBanCommand(this);
new IslandUnbanCommand(this);
new IslandBanlistCommand(this);
// Expel command
new IslandExpelCommand(this);
// Team commands
new IslandTeamCommand(this);
}

View File

@ -62,7 +62,9 @@ public class MaterialPopulator extends BlockPopulator
@Override
public void populate(World world, Random random, Chunk chunk)
{
for (Map.Entry<Material, Pair<Double, Integer>> entry : chances.get(world.getEnvironment()).materialChanceMap.entrySet())
Chances chances = this.chances.get(world.getEnvironment());
for (Map.Entry<Material, Pair<Double, Integer>> entry : chances.materialChanceMap.entrySet())
{
for (int subY = 1; subY < worldHeight; subY += 16)
{
@ -81,7 +83,7 @@ public class MaterialPopulator extends BlockPopulator
*/
Block block = chunk.getBlock(x, y, z);
if (block.getType().equals(chances.get(world.getEnvironment()).mainMaterial))
if (block.getType().equals(chances.mainMaterial))
{
int packSize = random.nextInt(entry.getValue().z);
@ -120,9 +122,8 @@ public class MaterialPopulator extends BlockPopulator
block = chunk.getBlock(x, y, z);
continuePlacing = packSize > 0 &&
(block.getType().equals(chances.get(world.getEnvironment()).mainMaterial) ||
block.getType().equals(entry.getKey()));
continuePlacing = packSize > 0 && (block.getType().equals(chances.mainMaterial) ||
block.getType().equals(entry.getKey()));
}
}
}

View File

@ -1,6 +1,6 @@
name: CaveBlock
main: world.bentobox.caveblock.CaveBlock
version: ${version}
version: ${version}-#${build.number}
authors: BONNe
@ -14,9 +14,6 @@ permissions:
caveblock.island.home:
description: Allow teleporting to player cave
default: true
caveblock.island.sethome:
description: Let the player use the sethome command
default: true
caveblock.island.info:
description: Let the player check their cave level
default: true

View File

@ -266,9 +266,9 @@ world:
MONSTER_SPAWN: true
FIRE_SPREAD: true
PVP_OVERWORLD: false
# These are the settings visible to users. (Not implemented yet)
# /!\ This feature is experimental and might not work as expected or might not work at all.
visible-settings: []
# These settings/flags are hidden from users
# Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings
hidden-flags: []
# Visitor banned commands - Visitors to islands cannot use these commands in this world
visitor-banned-commands:
- spawner