Skip to content

Commit

Permalink
Release 1.13 (#14)
Browse files Browse the repository at this point in the history
* Update pom.xml

* Update to Minecraft 1.18 biome changes

* Update pom.xml 1.13.0

* Update to latest Minecraft API

* Added test class

* Add distribution management section to POM

---------

Co-authored-by: BONNe <bonne@bonne.id.lv>
  • Loading branch information
tastybento and BONNe authored Feb 2, 2024
1 parent d042933 commit e4ede61
Show file tree
Hide file tree
Showing 3 changed files with 289 additions and 59 deletions.
162 changes: 116 additions & 46 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,26 @@
<system>GitHub</system>
<url>https://github.com/BentoBoxWorld/ExtraMobs/issues</url>
</issueManagement>

<distributionManagement>
<snapshotRepository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.org/repository/maven-snapshots</url>
</snapshotRepository>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.org/repository/maven-releases</url>
</repository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<powermock.version>1.7.4</powermock.version>
<java.version>17</java.version>
<powermock.version>2.0.9</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.18.1-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.11.0</bentobox.version>
<spigot.version>1.20.4-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>2.0.0-SNAPSHOT</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. -->
Expand All @@ -45,12 +56,16 @@
X.Y.Z -> BentoBox core version
.M -> Addon development iteration.
-->
<build.version>1.12</build.version>
<build.version>1.13</build.version>
<build.number>-LOCAL</build.number>
</properties>

<!-- Profiles will allow to automatically change build version. -->
<profiles>
<profile>
<!-- ci profile is activated if exist environment variable BUILD_NUMBER. -->
<!-- It replaces ${build.number} that is currently '-LOCAL' with
correct build number from JENKINS machine. -->
<id>ci</id>
<activation>
<property>
Expand All @@ -60,10 +75,17 @@
<properties>
<!-- Override only if necessary -->
<build.number>-b${env.BUILD_NUMBER}</build.number>
<!-- GIT_BRANCH -->
</properties>
</profile>
<profile>
<!-- Master profile is activated if exist environment variable
GIT_BRANCH and its value is origin/master. -->
<!-- It will replace 'revision' with '${build.version}' so it
removes '-SNAPSHOT' string at the end. -->
<!-- Also, as this is release build, build number can be set
to empty string. -->
<!-- This profile will be used only if exist environment variable
GIT_BRANCH with value origin/master. -->
<id>master</id>
<activation>
<property>
Expand All @@ -74,45 +96,40 @@
<properties>
<!-- Override only if necessary -->
<revision>${build.version}</revision>
<!-- Empties build number variable.-->
<!-- Empties build number variable. -->
<build.number></build.number>
</properties>
</profile>
</profiles>

<distributionManagement>
<snapshotRepository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.org/repository/maven-snapshots</url>
</snapshotRepository>
<repository>
<id>codemc-releases</id>
<url>https://repo.codemc.org/repository/maven-releases</url>
</repository>
</distributionManagement>

<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
</repository>
<repository>
<id>codemc</id>
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
</repositories>

<dependencies>
<!-- Spigot API -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>${spigot.version}</version>
<scope>provided</scope>
</dependency>
<!-- Mockito (Unit testing) -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<artifactId>mockito-core</artifactId>
<version>3.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -123,7 +140,7 @@
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
Expand All @@ -136,9 +153,18 @@
</dependencies>

<build>
<!-- By default ${revision} is ${build.version}-SNAPSHOT -->
<!-- If GIT_BRANCH variable is set to origin/master, then it will
be only ${build.version}. -->

<!-- By default ${build.number} is -LOCAL. -->
<!-- If the BUILD_NUMBER variable is set, then it will be -b[number]. -->
<!-- If GIT_BRANCH variable is set to origin/master, then it will
be the empty string. -->
<finalName>${project.name}-${revision}${build.number}</finalName>

<defaultGoal>clean package</defaultGoal>

<resources>
<resource>
<directory>src/main/resources</directory>
Expand All @@ -152,6 +178,15 @@
<include>*.yml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources/blueprints</directory>
<targetPath>./blueprints</targetPath>
<filtering>false</filtering>
<includes>
<include>*.blu</include>
<include>*.json</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
Expand All @@ -163,20 +198,57 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>blu</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<release>${java.version}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<version>3.1.2</version>
<!--suppress MavenModelInspection -->
<configuration>
<argLine>
${argLine}
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.math=ALL-UNNAMED
--add-opens java.base/java.io=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens
java.base/java.util.stream=ALL-UNNAMED
--add-opens java.base/java.text=ALL-UNNAMED
--add-opens
java.base/java.util.regex=ALL-UNNAMED
--add-opens
java.base/java.nio.channels.spi=ALL-UNNAMED
--add-opens java.base/sun.nio.ch=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
--add-opens
java.base/java.util.concurrent=ALL-UNNAMED
--add-opens java.base/sun.nio.fs=ALL-UNNAMED
--add-opens java.base/sun.nio.cs=ALL-UNNAMED
--add-opens java.base/java.nio.file=ALL-UNNAMED
--add-opens
java.base/java.nio.charset=ALL-UNNAMED
--add-opens
java.base/java.lang.reflect=ALL-UNNAMED
--add-opens
java.logging/java.util.logging=ALL-UNNAMED
--add-opens java.base/java.lang.ref=ALL-UNNAMED
--add-opens java.base/java.util.jar=ALL-UNNAMED
--add-opens java.base/java.util.zip=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -186,15 +258,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<version>3.3.0</version>
<configuration>
<show>public</show>
<failOnError>false</failOnError>
<additionalJOption>-Xdoclint:none</additionalJOption>
<!-- To compile with Java 11, this tag may be required -->
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>install</phase>
<goals>
<goal>jar</goal>
</goals>
Expand All @@ -214,22 +288,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<minimizeJar>true</minimizeJar>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
Expand All @@ -243,22 +301,34 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.1</version>
<version>0.8.10</version>
<configuration>
<append>true</append>
<excludes>
<!-- This is required to prevent Jacoco from adding
synthetic fields to a JavaBean class (causes errors in testing) -->
<exclude>**/*Names*</exclude>
<!-- Prevents the Material is too large to mock error -->
<exclude>org/bukkit/Material*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>pre-unit-test</id>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
<configuration>
<formats>
<format>XML</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package world.bentobox.extramobs.listeners;


import java.util.Optional;
import java.util.Random;

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fish;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.eclipse.jdt.annotation.NonNull;

import java.util.Optional;
import java.util.Random;

import world.bentobox.bentobox.api.addons.GameModeAddon;
import world.bentobox.extramobs.ExtraMobsAddon;

Expand Down Expand Up @@ -59,23 +60,25 @@ public void onEntitySpawn(CreatureSpawnEvent event)
this.addon.getPlugin().getIWM().getAddon(world);

if (!optionalAddon.isPresent() ||
!this.addon.getSettings().getDisabledGameModes().isEmpty() &&
(!this.addon.getSettings().getDisabledGameModes().isEmpty()
&&
this.addon.getSettings().getDisabledGameModes().contains(
optionalAddon.get().getDescription().getName()))
optionalAddon.get().getDescription().getName())))
{
// GameMode addon is not in enable list.
return;
}


if ((event.getEntityType().name().equals("PIG_ZOMBIE") ||
event.getEntityType().name().equals("ZOMBIFIED_PIGLIN")) &&
this.addon.getPlugin().getIWM().isIslandNether(world))
if ((event.getEntityType().equals(EntityType.ZOMBIFIED_PIGLIN)
|| event.getEntityType().equals(EntityType.PIGLIN))
&& this.addon.getPlugin().getIWM().isIslandNether(world))
{

// replace pigmen with blaze or wither

if (this.isSuitableNetherLocation(event.getLocation()))
{

if (this.spawningRandom.nextDouble() < this.addon.getSettings().getWitherSkeletonChance())
{
// oOo wither skeleton got lucky.
Expand Down Expand Up @@ -104,11 +107,9 @@ else if (event.getEntityType() == EntityType.ENDERMAN &&
}
}
}
else if (world.getEnvironment() == World.Environment.NORMAL &&
(event.getEntityType() == EntityType.COD ||
event.getEntityType() == EntityType.SALMON ||
event.getEntityType() == EntityType.TROPICAL_FISH))
else if (world.getEnvironment() == World.Environment.NORMAL && event.getEntity() instanceof Fish)
{

// Check biome
Biome biome = world.getBiome(
event.getLocation().getBlockX(),
Expand Down
Loading

0 comments on commit e4ede61

Please sign in to comment.