Skip to content

Commit 92859e0

Browse files
tastybentoBONNe
andauthored
Version 1.18.0 (#56)
* 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>
1 parent bc3d69c commit 92859e0

File tree

12 files changed

+58
-131
lines changed

12 files changed

+58
-131
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
- uses: actions/checkout@v2
1515
with:
1616
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
17-
- name: Set up JDK 16
17+
- name: Set up JDK 17
1818
uses: actions/setup-java@v2
1919
with:
2020
distribution: 'adopt'
21-
java-version: 16
21+
java-version: 17
2222
- name: Cache SonarCloud packages
2323
uses: actions/cache@v2
2424
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target/
2+
/.classpath
3+
/.project

pom.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<artifactId>skygrid</artifactId>
99
<version>${revision}</version>
1010

11+
<name>SkyGrid</name>
1112
<description>Skygrid is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like BSkyBlock or AcidIsland.</description>
1213
<url>https://github.com/BentoBoxWorld/SkyGrid</url>
1314
<inceptionYear>2017</inceptionYear>
@@ -53,18 +54,18 @@
5354
<properties>
5455
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5556
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
56-
<java.version>16</java.version>
57+
<java.version>17</java.version>
5758
<!-- Non-minecraft related dependencies -->
5859
<powermock.version>2.0.2</powermock.version>
5960
<!-- More visible way how to change dependency versions -->
60-
<spigot.version>1.17.1-R0.1-SNAPSHOT</spigot.version>
61-
<bentobox.version>1.17.1</bentobox.version>
61+
<spigot.version>1.19.1-R0.1-SNAPSHOT</spigot.version>
62+
<bentobox.version>1.21.0</bentobox.version>
6263
<!-- Revision variable removes warning about dynamic version -->
6364
<revision>${build.version}-SNAPSHOT</revision>
6465
<!-- Do not change unless you want different name for local builds. -->
6566
<build.number>-LOCAL</build.number>
6667
<!-- This allows to change between versions. -->
67-
<build.version>1.17.0</build.version>
68+
<build.version>1.18.0</build.version>
6869
<!-- SonarCloud -->
6970
<sonar.projectKey>BentoBoxWorld_SkyGrid</sonar.projectKey>
7071
<sonar.organization>bentobox-world</sonar.organization>
@@ -315,6 +316,4 @@
315316
</plugin>
316317
</plugins>
317318
</build>
318-
319-
<name>SkyGrid</name>
320319
</project>

src/main/java/world/bentobox/skygrid/Settings.java

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import world.bentobox.bentobox.api.configuration.WorldSettings;
1414
import world.bentobox.bentobox.api.flags.Flag;
1515
import world.bentobox.bentobox.database.objects.adapters.Adapter;
16+
import world.bentobox.bentobox.database.objects.adapters.FlagBooleanSerializer;
1617
import world.bentobox.bentobox.database.objects.adapters.FlagSerializer;
1718
import world.bentobox.bentobox.database.objects.adapters.FlagSerializer2;
1819

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

109110
/* SkyGrid */
110-
@ConfigComment("Biomes - this will affect some block types and tree types.")
111-
@ConfigEntry(path = "world.create-biomes")
112-
private boolean createBiomes = true;
113-
114111
@ConfigComment("The probability of a frame being created in a chunk. Frames are always at y=0.")
115112
@ConfigEntry(path = "world.end-frame-probability")
116113
private double endFrameProb = 0.1;
@@ -178,13 +175,12 @@ public class Settings implements WorldSettings {
178175
@ConfigComment("The value is the minimum island rank required to do the action")
179176
@ConfigComment("Ranks are: Visitor = 0, Member = 900, Owner = 1000")
180177
@ConfigEntry(path = "world.default-protection-flags")
181-
@Adapter(FlagSerializer.class)
182-
private Map<Flag, Integer> defaultIslandFlags = new HashMap<>();
178+
private Map<String, Integer> defaultIslandFlagNames = new HashMap<>();
183179

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

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

482-
/**
483-
* @return the createBiomes
484-
*/
485-
public boolean isCreateBiomes() {
486-
return createBiomes;
487-
}
488-
489-
/**
490-
* @param createBiomes the createBiomes to set
491-
*/
492-
public void setCreateBiomes(boolean createBiomes) {
493-
this.createBiomes = createBiomes;
494-
}
495-
496478
/**
497479
* @return the endFrameProb
498480
*/
@@ -738,32 +720,56 @@ public void setWorldFlags(Map<String, Boolean> worldFlags) {
738720

739721
/**
740722
* @return the defaultIslandFlags
723+
* @deprecated since 1.21
741724
*/
742725
@Override
743726
public Map<Flag, Integer> getDefaultIslandFlags() {
744-
return defaultIslandFlags;
727+
return Collections.emptyMap();
745728
}
746729

730+
731+
/**
732+
* @return defaultIslandFlagNames
733+
*/
734+
@Override
735+
public Map<String, Integer> getDefaultIslandFlagNames()
736+
{
737+
return defaultIslandFlagNames;
738+
}
739+
740+
747741
/**
748742
* @param defaultIslandFlags the defaultIslandFlags to set
749743
*/
750-
public void setDefaultIslandFlags(Map<Flag, Integer> defaultIslandFlags) {
751-
this.defaultIslandFlags = defaultIslandFlags;
744+
public void setDefaultIslandFlagNames(Map<String, Integer> defaultIslandFlags) {
745+
this.defaultIslandFlagNames = defaultIslandFlags;
752746
}
753747

754748
/**
755749
* @return the defaultIslandSettings
750+
* @deprecated since 1.21
756751
*/
757752
@Override
758753
public Map<Flag, Integer> getDefaultIslandSettings() {
759-
return defaultIslandSettings;
754+
return Collections.emptyMap();
755+
}
756+
757+
758+
/**
759+
* @return defaultIslandSettingNames
760+
*/
761+
@Override
762+
public Map<String, Integer> getDefaultIslandSettingNames()
763+
{
764+
return defaultIslandSettingNames;
760765
}
761766

767+
762768
/**
763769
* @param defaultIslandSettings the defaultIslandSettings to set
764770
*/
765-
public void setDefaultIslandSettings(Map<Flag, Integer> defaultIslandSettings) {
766-
this.defaultIslandSettings = defaultIslandSettings;
771+
public void setDefaultIslandSettingNames(Map<String, Integer> defaultIslandSettings) {
772+
this.defaultIslandSettingNames = defaultIslandSettings;
767773
}
768774

769775
/**

src/main/java/world/bentobox/skygrid/SkyGrid.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import org.bukkit.World;
44
import org.bukkit.WorldCreator;
5-
import org.bukkit.WorldType;
65
import org.bukkit.generator.ChunkGenerator;
76
import org.eclipse.jdt.annotation.NonNull;
87

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

9694
// Make the nether if it does not exist
9795
if (settings.isNetherGenerate()) {
9896
if (getServer().getWorld(worldName + NETHER) == null) {
9997
log("Creating SkyGrid's Nether...");
10098
}
101-
netherWorld = WorldCreator.name(worldName + NETHER).type(WorldType.FLAT).generator(gen)
102-
.environment(World.Environment.NETHER).createWorld();
99+
netherWorld = WorldCreator.name(worldName + NETHER).generator(gen).environment(World.Environment.NETHER).createWorld();
103100
}
104101
// Make the end if it does not exist
105102
if (settings.isEndGenerate()) {
106103
if (getServer().getWorld(worldName + THE_END) == null) {
107104
log("Creating SkyGrid's End World...");
108105
}
109-
endWorld = WorldCreator.name(worldName + THE_END).type(WorldType.FLAT).generator(gen)
110-
.environment(World.Environment.THE_END).createWorld();
106+
endWorld = WorldCreator.name(worldName + THE_END).generator(gen).environment(World.Environment.THE_END).createWorld();
111107
}
112108
}
113109

src/main/java/world/bentobox/skygrid/generators/BiomeGenerator.java

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/main/java/world/bentobox/skygrid/generators/Biomes.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@
2020
public enum Biomes {
2121

2222
//We store the biome, the temperature and rainfall for each biome.
23-
SNOWY_TUNDRA(Environment.NORMAL, Biome.SNOWY_TUNDRA, 0, 100),
23+
SNOWY_PLAINS(Environment.NORMAL, Biome.SNOWY_PLAINS, 0, 100),
2424
SNOWY_TAIGA(Environment.NORMAL, Biome.SNOWY_TAIGA, 0, 100),
2525
FROZEN_RIVER(Environment.NORMAL, Biome.FROZEN_RIVER, 0, 10),
2626
SNOWY_BEACH(Environment.NORMAL, Biome.SNOWY_BEACH, 0, 100),
27-
MOUNTAINS(Environment.NORMAL, Biome.MOUNTAINS, 20, 60),
28-
WOODED_MOUNTAINS(Environment.NORMAL, Biome.WOODED_MOUNTAINS, 20, 60),
27+
STONY_PEAKS(Environment.NORMAL, Biome.STONY_PEAKS, 20, 60),
2928
DESERT(Environment.NORMAL, Biome.DESERT, 60, 4),
3029
FOREST(Environment.NORMAL, Biome.FOREST, 50, 60),
3130
PLAINS(Environment.NORMAL, Biome.PLAINS, 40, 30),
3231
SWAMP(Environment.NORMAL, Biome.SWAMP, 40, 70),
3332
JUNGLE(Environment.NORMAL, Biome.JUNGLE, 60, 50),
3433
SAVANNA(Environment.NORMAL, Biome.SAVANNA, 40, 10),
35-
DESERT_HILLS(Environment.NORMAL, Biome.DESERT_HILLS, 60, 5),
3634
TAIGA(Environment.NORMAL, Biome.TAIGA, 30, 5),
3735
// Nether
3836
NETHER_WASTES(Environment.NETHER, Biome.NETHER_WASTES, 40, 30),
Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
package world.bentobox.skygrid.generators;
22

33
import java.util.Collections;
4-
import java.util.EnumMap;
54
import java.util.List;
6-
import java.util.Map;
75
import java.util.Random;
86

97
import org.bukkit.Location;
8+
import org.bukkit.Material;
109
import org.bukkit.World;
11-
import org.bukkit.World.Environment;
12-
import org.bukkit.block.Biome;
1310
import org.bukkit.generator.BlockPopulator;
1411
import org.bukkit.generator.ChunkGenerator;
12+
import org.bukkit.generator.WorldInfo;
1513

1614
import world.bentobox.skygrid.SkyGrid;
1715

1816
public class SkyGridGen extends ChunkGenerator {
1917

2018
private final SkyGrid addon;
2119

22-
private final Map<Environment, BiomeGenerator> biomeGenerator;
23-
2420
private final BlockPopulator populator;
25-
2621
private final SkyGridChunks preMade;
2722

2823
/**
@@ -32,30 +27,14 @@ public SkyGridGen(SkyGrid addon) {
3227
this.addon = addon;
3328
this.populator = new SkyGridPop(addon);
3429
preMade = new SkyGridChunks(addon);
35-
biomeGenerator = new EnumMap<>(Environment.class);
3630
}
3731

3832
@Override
39-
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, ChunkGenerator.BiomeGrid biomeGrid) {
40-
// The chunk we are making
41-
ChunkData result = createChunkData(world);
42-
preMade.getSkyGridChunk(world.getEnvironment()).forEach(b -> result.setBlock(b.getX(), b.getY(), b.getZ(), b.getBd()));
43-
// Set biome
44-
if (addon.getSettings().isCreateBiomes()) {
45-
for (int x = 0; x < 16; x +=4) {
46-
for (int z = 0; z < 16; z +=4) {
47-
int realX = x + chunkX * 16; //used so that the noise function gives us
48-
int realZ = z + chunkZ * 16; //different values each chunk
49-
Biome b = biomeGenerator.computeIfAbsent(world.getEnvironment(), k -> new BiomeGenerator(world)).getDominantBiome(realX, realZ);
50-
for (int y = 0; y < world.getMaxHeight(); y+=4) {
51-
biomeGrid.setBiome(x, y, z, b);
52-
}
53-
}
54-
}
55-
}
56-
return result;
57-
}
33+
public void generateNoise(WorldInfo worldInfo, Random r, int x, int z, ChunkData result) {
34+
result.setRegion(0, worldInfo.getMinHeight(), 0, 16, worldInfo.getMaxHeight(), 16, Material.AIR);
35+
preMade.getSkyGridChunk(worldInfo.getEnvironment()).forEach(b -> result.setBlock(b.getX(), b.getY(), b.getZ(), b.getBd()));
5836

37+
}
5938

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

7049

71-
7250
}

src/main/java/world/bentobox/skygrid/generators/SkyGridPop.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private void setSaplingType(Block b) {
152152
break;
153153
case SWAMP:
154154
break;
155-
case DESERT, DESERT_HILLS:
155+
case DESERT:
156156
b.setType(Material.DEAD_BUSH, false);
157157
break;
158158
case SAVANNA:

src/main/resources/addon.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: ${version}${build.number}
44
metrics: true
55
repository: "BentoBoxWorld/SkyGrid"
66
icon: "COBWEB"
7-
api-version: 1.14
7+
api-version: 1.21
88

99
authors: tastybento
1010

0 commit comments

Comments
 (0)