Skip to content

Commit

Permalink
Version 1.18.0 (#56)
Browse files Browse the repository at this point in the history
* Version 1.16.1

* Expose BentoBox 1.16 portal generation mechanics.

BentoBoxWorld/BentoBox#1718

* Adds isCheckForBlocks to false similar to CaveBlock. (#49)

* Revert "Adds isCheckForBlocks to false similar to CaveBlock. (#49)" (#53)

This reverts commit bd36b95.

* Expose BentoBox mobLimitSettings option. (#52)

* Expose BentoBox 1.14 onRespawnCommands (#51)

BentoBoxWorld/BentoBox#1719

* Implements #49

* Update to 1.17

* Improved blocks and items for 1.17

* Update GitHub Action to Java 16

* Make Pladdon

Java 16 code clean up.

* Remove missing blocks/items checking code.

* Correct reference to SkyGrid in settings

* Fix code smells.

* Update to Minecraft 1.17 world gen.

Biomes are made by default now.

* Update to BentoBox 1.21 API

Co-authored-by: BONNe <bonne@bonne.id.lv>
  • Loading branch information
tastybento and BONNe committed Oct 4, 2022
1 parent bc3d69c commit 92859e0
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 131 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 16
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 16
java-version: 17
- name: Cache SonarCloud packages
uses: actions/cache@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target/
/.classpath
/.project
11 changes: 5 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<artifactId>skygrid</artifactId>
<version>${revision}</version>

<name>SkyGrid</name>
<description>Skygrid is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like BSkyBlock or AcidIsland.</description>
<url>https://github.com/BentoBoxWorld/SkyGrid</url>
<inceptionYear>2017</inceptionYear>
Expand Down Expand Up @@ -53,18 +54,18 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>16</java.version>
<java.version>17</java.version>
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.2</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.17.1-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.17.1</bentobox.version>
<spigot.version>1.19.1-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.21.0</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.17.0</build.version>
<build.version>1.18.0</build.version>
<!-- SonarCloud -->
<sonar.projectKey>BentoBoxWorld_SkyGrid</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down Expand Up @@ -315,6 +316,4 @@
</plugin>
</plugins>
</build>

<name>SkyGrid</name>
</project>
62 changes: 34 additions & 28 deletions src/main/java/world/bentobox/skygrid/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import world.bentobox.bentobox.api.configuration.WorldSettings;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.database.objects.adapters.Adapter;
import world.bentobox.bentobox.database.objects.adapters.FlagBooleanSerializer;
import world.bentobox.bentobox.database.objects.adapters.FlagSerializer;
import world.bentobox.bentobox.database.objects.adapters.FlagSerializer2;

Expand Down Expand Up @@ -107,10 +108,6 @@ public class Settings implements WorldSettings {
private boolean makeEndPortals = false;

/* SkyGrid */
@ConfigComment("Biomes - this will affect some block types and tree types.")
@ConfigEntry(path = "world.create-biomes")
private boolean createBiomes = true;

@ConfigComment("The probability of a frame being created in a chunk. Frames are always at y=0.")
@ConfigEntry(path = "world.end-frame-probability")
private double endFrameProb = 0.1;
Expand Down Expand Up @@ -178,13 +175,12 @@ public class Settings implements WorldSettings {
@ConfigComment("The value is the minimum island rank required to do the action")
@ConfigComment("Ranks are: Visitor = 0, Member = 900, Owner = 1000")
@ConfigEntry(path = "world.default-protection-flags")
@Adapter(FlagSerializer.class)
private Map<Flag, Integer> defaultIslandFlags = new HashMap<>();
private Map<String, Integer> defaultIslandFlagNames = new HashMap<>();

@ConfigComment("These are the default settings for new protected areas")
@ConfigEntry(path = "world.default-settings")
@Adapter(FlagSerializer2.class)
private Map<Flag, Integer> defaultIslandSettings = new HashMap<>();
@Adapter(FlagBooleanSerializer.class)
private Map<String, Integer> defaultIslandSettingNames = new HashMap<>();

@ConfigComment("These settings/flags are hidden from users")
@ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings")
Expand Down Expand Up @@ -479,20 +475,6 @@ public void setEndBlocks(Map<Material, Integer> endBlocks) {
this.endBlocks = endBlocks;
}

/**
* @return the createBiomes
*/
public boolean isCreateBiomes() {
return createBiomes;
}

/**
* @param createBiomes the createBiomes to set
*/
public void setCreateBiomes(boolean createBiomes) {
this.createBiomes = createBiomes;
}

/**
* @return the endFrameProb
*/
Expand Down Expand Up @@ -738,32 +720,56 @@ public void setWorldFlags(Map<String, Boolean> worldFlags) {

/**
* @return the defaultIslandFlags
* @deprecated since 1.21
*/
@Override
public Map<Flag, Integer> getDefaultIslandFlags() {
return defaultIslandFlags;
return Collections.emptyMap();
}


/**
* @return defaultIslandFlagNames
*/
@Override
public Map<String, Integer> getDefaultIslandFlagNames()
{
return defaultIslandFlagNames;
}


/**
* @param defaultIslandFlags the defaultIslandFlags to set
*/
public void setDefaultIslandFlags(Map<Flag, Integer> defaultIslandFlags) {
this.defaultIslandFlags = defaultIslandFlags;
public void setDefaultIslandFlagNames(Map<String, Integer> defaultIslandFlags) {
this.defaultIslandFlagNames = defaultIslandFlags;
}

/**
* @return the defaultIslandSettings
* @deprecated since 1.21
*/
@Override
public Map<Flag, Integer> getDefaultIslandSettings() {
return defaultIslandSettings;
return Collections.emptyMap();
}


/**
* @return defaultIslandSettingNames
*/
@Override
public Map<String, Integer> getDefaultIslandSettingNames()
{
return defaultIslandSettingNames;
}


/**
* @param defaultIslandSettings the defaultIslandSettings to set
*/
public void setDefaultIslandSettings(Map<Flag, Integer> defaultIslandSettings) {
this.defaultIslandSettings = defaultIslandSettings;
public void setDefaultIslandSettingNames(Map<String, Integer> defaultIslandSettings) {
this.defaultIslandSettingNames = defaultIslandSettings;
}

/**
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/world/bentobox/skygrid/SkyGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.bukkit.generator.ChunkGenerator;
import org.eclipse.jdt.annotation.NonNull;

Expand Down Expand Up @@ -90,24 +89,21 @@ public void createWorlds() {
getLogger().info("Creating SkyGrid world ...");
}
// Create the world if it does not exist
islandWorld = WorldCreator.name(worldName).type(WorldType.FLAT).environment(World.Environment.NORMAL).generator(gen)
.createWorld();
islandWorld = WorldCreator.name(worldName).environment(World.Environment.NORMAL).generator(gen).createWorld();

// Make the nether if it does not exist
if (settings.isNetherGenerate()) {
if (getServer().getWorld(worldName + NETHER) == null) {
log("Creating SkyGrid's Nether...");
}
netherWorld = WorldCreator.name(worldName + NETHER).type(WorldType.FLAT).generator(gen)
.environment(World.Environment.NETHER).createWorld();
netherWorld = WorldCreator.name(worldName + NETHER).generator(gen).environment(World.Environment.NETHER).createWorld();
}
// Make the end if it does not exist
if (settings.isEndGenerate()) {
if (getServer().getWorld(worldName + THE_END) == null) {
log("Creating SkyGrid's End World...");
}
endWorld = WorldCreator.name(worldName + THE_END).type(WorldType.FLAT).generator(gen)
.environment(World.Environment.THE_END).createWorld();
endWorld = WorldCreator.name(worldName + THE_END).generator(gen).environment(World.Environment.THE_END).createWorld();
}
}

Expand Down

This file was deleted.

6 changes: 2 additions & 4 deletions src/main/java/world/bentobox/skygrid/generators/Biomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@
public enum Biomes {

//We store the biome, the temperature and rainfall for each biome.
SNOWY_TUNDRA(Environment.NORMAL, Biome.SNOWY_TUNDRA, 0, 100),
SNOWY_PLAINS(Environment.NORMAL, Biome.SNOWY_PLAINS, 0, 100),
SNOWY_TAIGA(Environment.NORMAL, Biome.SNOWY_TAIGA, 0, 100),
FROZEN_RIVER(Environment.NORMAL, Biome.FROZEN_RIVER, 0, 10),
SNOWY_BEACH(Environment.NORMAL, Biome.SNOWY_BEACH, 0, 100),
MOUNTAINS(Environment.NORMAL, Biome.MOUNTAINS, 20, 60),
WOODED_MOUNTAINS(Environment.NORMAL, Biome.WOODED_MOUNTAINS, 20, 60),
STONY_PEAKS(Environment.NORMAL, Biome.STONY_PEAKS, 20, 60),
DESERT(Environment.NORMAL, Biome.DESERT, 60, 4),
FOREST(Environment.NORMAL, Biome.FOREST, 50, 60),
PLAINS(Environment.NORMAL, Biome.PLAINS, 40, 30),
SWAMP(Environment.NORMAL, Biome.SWAMP, 40, 70),
JUNGLE(Environment.NORMAL, Biome.JUNGLE, 60, 50),
SAVANNA(Environment.NORMAL, Biome.SAVANNA, 40, 10),
DESERT_HILLS(Environment.NORMAL, Biome.DESERT_HILLS, 60, 5),
TAIGA(Environment.NORMAL, Biome.TAIGA, 30, 5),
// Nether
NETHER_WASTES(Environment.NETHER, Biome.NETHER_WASTES, 40, 30),
Expand Down
34 changes: 6 additions & 28 deletions src/main/java/world/bentobox/skygrid/generators/SkyGridGen.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
package world.bentobox.skygrid.generators;

import java.util.Collections;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.generator.WorldInfo;

import world.bentobox.skygrid.SkyGrid;

public class SkyGridGen extends ChunkGenerator {

private final SkyGrid addon;

private final Map<Environment, BiomeGenerator> biomeGenerator;

private final BlockPopulator populator;

private final SkyGridChunks preMade;

/**
Expand All @@ -32,30 +27,14 @@ public SkyGridGen(SkyGrid addon) {
this.addon = addon;
this.populator = new SkyGridPop(addon);
preMade = new SkyGridChunks(addon);
biomeGenerator = new EnumMap<>(Environment.class);
}

@Override
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, ChunkGenerator.BiomeGrid biomeGrid) {
// The chunk we are making
ChunkData result = createChunkData(world);
preMade.getSkyGridChunk(world.getEnvironment()).forEach(b -> result.setBlock(b.getX(), b.getY(), b.getZ(), b.getBd()));
// Set biome
if (addon.getSettings().isCreateBiomes()) {
for (int x = 0; x < 16; x +=4) {
for (int z = 0; z < 16; z +=4) {
int realX = x + chunkX * 16; //used so that the noise function gives us
int realZ = z + chunkZ * 16; //different values each chunk
Biome b = biomeGenerator.computeIfAbsent(world.getEnvironment(), k -> new BiomeGenerator(world)).getDominantBiome(realX, realZ);
for (int y = 0; y < world.getMaxHeight(); y+=4) {
biomeGrid.setBiome(x, y, z, b);
}
}
}
}
return result;
}
public void generateNoise(WorldInfo worldInfo, Random r, int x, int z, ChunkData result) {
result.setRegion(0, worldInfo.getMinHeight(), 0, 16, worldInfo.getMaxHeight(), 16, Material.AIR);
preMade.getSkyGridChunk(worldInfo.getEnvironment()).forEach(b -> result.setBlock(b.getX(), b.getY(), b.getZ(), b.getBd()));

}

@Override
public List<BlockPopulator> getDefaultPopulators(World world) {
Expand All @@ -68,5 +47,4 @@ public Location getFixedSpawnLocation(World world, Random random) {
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void setSaplingType(Block b) {
break;
case SWAMP:
break;
case DESERT, DESERT_HILLS:
case DESERT:
b.setType(Material.DEAD_BUSH, false);
break;
case SAVANNA:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/addon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: ${version}${build.number}
metrics: true
repository: "BentoBoxWorld/SkyGrid"
icon: "COBWEB"
api-version: 1.14
api-version: 1.21

authors: tastybento

Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1030,8 +1030,6 @@ world:
# when player enters the end world.
# Added since 1.16.
create-obsidian-platform: false
# Biomes - this will affect some block types and tree types.
create-biomes: true
# The probability of a frame being created in a chunk. Frames are always at y=0.
end-frame-probability: 0.1
# Friendly name for this world. Used in admin commands. Must be a single word
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Pladdon
main: world.bentobox.skygrid.SkyGrid
version: ${version}
api-version: 1.17
api-version: 1.19
description: SkyGrid
author: tastybento
depend: [BentoBox]

0 comments on commit 92859e0

Please sign in to comment.