Skip to content

Commit

Permalink
Add support for Minecraft 1.18
Browse files Browse the repository at this point in the history
Took 1 hour 52 minutes
  • Loading branch information
DerFrZocker committed Dec 5, 2021
1 parent c80d96c commit 999a499
Show file tree
Hide file tree
Showing 34 changed files with 2,315 additions and 9 deletions.
6 changes: 6 additions & 0 deletions custom-ore-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>de.derfrzocker</groupId>
<artifactId>custom-ore-generator-impl-v1_18_R1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.oregenerator.MinableGenerator_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.WorldHandler_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.oregenerator.MinableGenerator_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.WorldHandler_v1_18_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.oregenerator.MinableGenerator_v1_18_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R1.CustomOreBlockPopulator_v1_8_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R1.oregenerator.MinableGenerator_v1_8_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R2.CustomOreBlockPopulator_v1_8_R2;
Expand Down Expand Up @@ -128,8 +130,8 @@ public void onLoad() {
getLogger().warning("The Server version which you are running is unsupported, you are running version '" + version + "'");
getLogger().warning("The plugin supports following versions " + combineVersions(Version.v1_8_R1, Version.v1_8_R2, Version.v1_8_R3,
Version.v1_9_R1, Version.v1_9_R2, Version.v1_10_R1, Version.v1_11_R1, Version.v1_12_R1, Version.v1_13_R1, Version.v1_13_R2,
Version.v1_14_R1, Version.v1_15_R1, Version.v1_16_R1, Version.v1_16_R2, Version.v1_16_R3, Version.v1_17_R1));
getLogger().warning("(Spigot / Paper version 1.8 - 1.17.1), if you are running such a Minecraft version, than your bukkit implementation is unsupported, in this case please contact the developer, so he can resolve this Issue");
Version.v1_14_R1, Version.v1_15_R1, Version.v1_16_R1, Version.v1_16_R2, Version.v1_16_R3, Version.v1_17_R1, Version.v1_18_R1));
getLogger().warning("(Spigot / Paper version 1.8 - 1.18), if you are running such a Minecraft version, than your bukkit implementation is unsupported, in this case please contact the developer, so he can resolve this Issue");

if (version == Version.UNKNOWN) {
getLogger().warning("The Version '" + version + "' can indicate, that you are using a newer Minecraft version than currently supported.");
Expand Down Expand Up @@ -225,6 +227,7 @@ private void registerStandardOreGenerators(@NotNull final RegisterUtil registerU
registerUtil.register(Version.v1_16_R2, Version.v1_16_R2, () -> new MinableGenerator_v1_16_R2(infoFunction, oreSettingInfoBiFunction), true);
registerUtil.register(Version.v1_16_R3, Version.v1_16_R3, () -> new MinableGenerator_v1_16_R3(infoFunction, oreSettingInfoBiFunction), true);
registerUtil.register(Version.v1_17_R1, Version.v1_17_R1, () -> new MinableGenerator_v1_17_R1(infoFunction, oreSettingInfoBiFunction), true);
registerUtil.register(Version.v1_18_R1, Version.v1_18_R1, () -> new MinableGenerator_v1_18_R1(infoFunction, oreSettingInfoBiFunction), true);
}

private void registerStandardBlockSelector(@NotNull final RegisterUtil registerUtil) {
Expand Down Expand Up @@ -259,6 +262,9 @@ private void registerStandardCustomDatas(@NotNull final RegisterUtil registerUti

private void initWorldHandler() {
switch (version) {
case v1_18_R1:
new WorldHandler_v1_18_R1(this, CustomOreGeneratorServiceSupplier.INSTANCE);
return;
case v1_17_R1:
new WorldHandler_v1_17_R1(this, CustomOreGeneratorServiceSupplier.INSTANCE);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,21 @@
import java.util.function.Supplier;

public class BiomeGuiSettings extends PageSettings {
private final Plugin plugin;

public BiomeGuiSettings(@NotNull final Plugin plugin, @NotNull final String file) {
super(plugin, file);
this.plugin = plugin;
}

public BiomeGuiSettings(@NotNull final Plugin plugin, @NotNull final String file, final boolean copy) {
super(plugin, file, copy);
this.plugin = plugin;
}

public BiomeGuiSettings(@NotNull final Plugin plugin, @NotNull final Supplier<ConfigurationSection> configurationSectionSupplier) {
super(plugin, configurationSectionSupplier);
this.plugin = plugin;
}

@NotNull
Expand Down Expand Up @@ -81,7 +85,8 @@ public Material getBiomeMaterial(@NotNull final String biome) {
String value = getSection().getString("biomes." + biome);

if (value == null) {
throw new IllegalStateException("There is no material for the biome " + biome);
plugin.getLogger().warning("There is no material for the biome " + biome + " using default Material " + Material.STONE);
return Material.STONE;
}

return Material.valueOf(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R2.customdata.AutoApplier_v1_16_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.customdata.AutoApplier_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.customdata.AutoApplier_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.customdata.AutoApplier_v1_18_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_9_R1.customdata.AutoApplier_v1_9_R1;
import de.derfrzocker.custom.ore.generator.impl.v_1_9_R2.customdata.AutoApplier_v1_9_R2;
import de.derfrzocker.spigot.utils.Version;
Expand All @@ -57,6 +58,7 @@ public class AutoCustomData extends AbstractAutoCustomData {

static {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
case v1_17_R1:
case v1_16_R3:
case v1_16_R2:
Expand Down Expand Up @@ -101,6 +103,8 @@ public boolean hasCustomData(@NotNull final BlockState blockState) {
@Override
protected AutoApplier getCustomDataApplier0() {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
return new AutoApplier_v1_18_R1(this);
case v1_17_R1:
return new AutoApplier_v1_17_R1(this);
case v1_16_R3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R2.customdata.BlockStateApplier_v1_16_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.customdata.BlockStateApplier_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.customdata.BlockStateApplier_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.customdata.BlockStateApplier_v1_18_R1;
import de.derfrzocker.spigot.utils.Version;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
Expand All @@ -63,6 +64,8 @@ public BlockStateCustomData(@NotNull final Supplier<CustomOreGeneratorService> s
@Override
protected AbstractBlockStateCustomData.BlockStateApplier getCustomDataApplier0() {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
return new BlockStateApplier_v1_18_R1(this.serviceSupplier, this);
case v1_17_R1:
return new BlockStateApplier_v1_17_R1(this.serviceSupplier, this);
case v1_16_R3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R2.customdata.CommandApplier_v1_16_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.customdata.CommandApplier_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.customdata.CommandApplier_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.customdata.CommandApplier_v1_18_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R1.customdata.CommandApplier_v1_8_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R2.customdata.CommandApplier_v1_8_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R3.customdata.CommandApplier_v1_8_R3;
Expand All @@ -63,6 +64,7 @@ public class CommandCustomData extends AbstractCustomData<CustomDataApplier> {

static {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
case v1_17_R1:
case v1_16_R3:
case v1_16_R2:
Expand Down Expand Up @@ -131,6 +133,8 @@ public String getCustomData(@NotNull final BlockState blockState) {
@Override
protected CustomDataApplier getCustomDataApplier0() {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
return new CommandApplier_v1_18_R1(this);
case v1_17_R1:
return new CommandApplier_v1_17_R1(this);
case v1_16_R3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R2.customdata.DirectionApplier_v1_16_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.customdata.DirectionApplier_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.customdata.DirectionApplier_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.customdata.DirectionApplier_v1_18_R1;
import de.derfrzocker.spigot.utils.Version;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -120,6 +121,8 @@ public Boolean getCustomData(@NotNull final BlockState blockState) {
@Override
protected CustomDataApplier getCustomDataApplier0() {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
return new DirectionApplier_v1_18_R1(this, blockFace);
case v1_17_R1:
return new DirectionApplier_v1_17_R1(this, blockFace);
case v1_16_R3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R2.customdata.FacingApplier_v1_16_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.customdata.FacingApplier_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.customdata.FacingApplier_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.customdata.FacingApplier_v1_18_R1;
import de.derfrzocker.spigot.utils.Version;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -105,6 +106,8 @@ public BlockFace getCustomData(@NotNull final BlockState blockState) {
@Override
protected CustomDataApplier getCustomDataApplier0() {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
return new FacingApplier_v1_18_R1(this);
case v1_17_R1:
return new FacingApplier_v1_17_R1(this);
case v1_16_R3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R2.customdata.ItemModsApplier_v1_16_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.customdata.ItemModsApplier_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.customdata.ItemModsApplier_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.customdata.ItemModsApplier_v1_18_R1;
import de.derfrzocker.spigot.utils.Version;
import dev.linwood.itemmods.ItemMods;
import dev.linwood.itemmods.api.block.CustomBlock;
Expand Down Expand Up @@ -102,6 +103,8 @@ public String getCustomData(@NotNull final BlockState blockState) {
@Override
protected CustomDataApplier getCustomDataApplier0() {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
return new ItemModsApplier_v1_18_R1(this);
case v1_17_R1:
return new ItemModsApplier_v1_17_R1(this);
case v1_16_R3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R2.customdata.NBTTagApplier_v1_16_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.customdata.NBTTagApplier_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.customdata.NBTTagApplier_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.customdata.NBTTagApplier_v1_18_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R1.customdata.NBTTagApplier_v1_8_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R2.customdata.NBTTagApplier_v1_8_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R3.customdata.NBTTagApplier_v1_8_R3;
Expand All @@ -59,6 +60,8 @@ public NBTTagCustomData(@NotNull final Function<String, Info> infoFunction, @Not
@Override
protected NBTTagApplier getCustomDataApplier0() {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
return new NBTTagApplier_v1_18_R1(this);
case v1_17_R1:
return new NBTTagApplier_v1_17_R1(this);
case v1_16_R3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R2.customdata.OraxenApplier_v1_16_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.customdata.OraxenApplier_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.customdata.OraxenApplier_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.customdata.OraxenApplier_v1_18_R1;
import de.derfrzocker.spigot.utils.Version;
import io.th0rgal.oraxen.items.OraxenItems;
import io.th0rgal.oraxen.mechanics.provided.block.BlockMechanic;
Expand Down Expand Up @@ -108,6 +109,8 @@ public Object getCustomData(@NotNull BlockState blockState) {
@Override
protected CustomDataApplier getCustomDataApplier0() {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
return new OraxenApplier_v1_18_R1(this);
case v1_17_R1:
return new OraxenApplier_v1_17_R1(this);
case v1_16_R3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R2.customdata.SkullTextureApplier_v1_16_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.customdata.SkullTextureApplier_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.customdata.SkullTextureApplier_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.customdata.SkullTextureApplier_v1_18_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R1.customdata.SkullTextureApplier_v1_8_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R2.customdata.SkullTextureApplier_v1_8_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_8_R3.customdata.SkullTextureApplier_v1_8_R3;
Expand All @@ -58,6 +59,7 @@ public class SkullTextureCustomData extends AbstractSkullTextureCustomData {

static {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
case v1_17_R1:
case v1_16_R3:
case v1_16_R2:
Expand Down Expand Up @@ -96,6 +98,8 @@ public boolean canApply(@NotNull final OreConfig oreConfig) {
@Override
protected SkullTextureApplier getCustomDataApplier0() {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
return new SkullTextureApplier_v1_18_R1(this);
case v1_17_R1:
return new SkullTextureApplier_v1_17_R1(this);
case v1_16_R3:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import de.derfrzocker.custom.ore.generator.impl.v1_16_R2.customdata.TickBlockApplier_v1_16_R2;
import de.derfrzocker.custom.ore.generator.impl.v1_16_R3.customdata.TickBlockApplier_v1_16_R3;
import de.derfrzocker.custom.ore.generator.impl.v1_17_R1.customdata.TickBlockApplier_v1_17_R1;
import de.derfrzocker.custom.ore.generator.impl.v1_18_R1.customdata.TickBlockApplier_v1_18_R1;
import de.derfrzocker.spigot.utils.Version;
import org.bukkit.Bukkit;
import org.bukkit.Material;
Expand Down Expand Up @@ -84,6 +85,8 @@ public Boolean getCustomData(@NotNull final BlockState blockState) {
@Override
protected CustomDataApplier getCustomDataApplier0() {
switch (Version.getServerVersion(Bukkit.getServer())) {
case v1_18_R1:
return new TickBlockApplier_v1_18_R1(this);
case v1_17_R1:
return new TickBlockApplier_v1_17_R1(this);
case v1_16_R3:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2
version: 3
name: '%%translation:[ore-config.factory.gui.biome.name]%'
rows: 5
gap: 1
Expand Down Expand Up @@ -192,3 +192,20 @@ biomes:
DRIPSTONE_CAVES: POINTED_DRIPSTONE
LUSH_CAVES: GLOW_BERRIES
CUSTOM: COMMAND_BLOCK
WINDSWEPT_HILLS: STONE
SNOWY_PLAINS: "SNOW"
SPARSE_JUNGLE: "JUNGLE_SAPLING"
STONY_SHORE: "STONE"
OLD_GROWTH_PINE_TAIGA: "SPRUCE_SAPLING"
WINDSWEPT_FOREST: "OAK_SAPLING"
WOODED_BADLANDS: "RED_SAND"
WINDSWEPT_GRAVELLY_HILLS: "GRAVEL"
OLD_GROWTH_BIRCH_FOREST: "BIRCH_SAPLING"
OLD_GROWTH_SPRUCE_TAIGA: "SPRUCE_SAPLING"
WINDSWEPT_SAVANNA: "ACACIA_SAPLING"
MEADOW: "SPRUCE_SAPLING"
GROVE: "STONE"
SNOWY_SLOPES: "SNOW"
FROZEN_PEAKS: "ICE"
JAGGED_PEAKS: "SNOW"
STONY_PEAKS: "STONE"
1 change: 1 addition & 0 deletions impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<module>v1_16_R2</module>
<module>v1_16_R3</module>
<module>v1_17_R1</module>
<module>v1_18_R1</module>
</modules>

<artifactId>custom-ore-generator-impl</artifactId>
Expand Down
Loading

0 comments on commit 999a499

Please sign in to comment.