Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.6.0 #129

Merged
merged 21 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@ on:
push:
branches:
- develop
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v1
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'adopt'
java-version: '21'
- name: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
Expand All @@ -32,4 +34,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=BentoBoxWorld_MagicCobblestoneGenerator
- run: mvn --batch-mode clean org.jacoco:jacoco-maven-plugin:prepare-agent install
- run: mkdir staging && cp target/*.jar staging
- name: Save artifacts
uses: actions/upload-artifact@v3
with:
name: Package
path: staging
134 changes: 57 additions & 77 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
<java.version>21</java.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.18-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.20.0</bentobox.version>
<spigot.version>1.21.3-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>2.7.1-SNAPSHOT</bentobox.version>
<level.version>2.5.0</level.version>
<bank.version>1.4.0</bank.version>
<!-- Mocks -->
<powermock.version>2.0.9</powermock.version>
<!-- Panel Utils version -->
<panelutils.version>1.0.0</panelutils.version>
<panelutils.version>1.2.0</panelutils.version>
<!-- Vault API version -->
<vault.version>1.7</vault.version>
<!-- Revision variable removes warning about dynamic version -->
Expand Down Expand Up @@ -85,13 +87,9 @@
</profiles>

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

Expand All @@ -108,14 +106,14 @@
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.io/repository/maven-public/</url>
<id>bentoboxworld</id>
<url>https://repo.codemc.io/repository/bentoboxworld/</url>
</repository>
<!--Vault Repo is down. -->
<repository>
<id>vault-repo</id>
<url>https://nexus.hc.to/content/repositories/pub_releases</url>
<id>codemc-repo</id>
<url>https://repo.codemc.io/repository/maven-public/</url>
</repository>
<!--Vault Repo -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
Expand Down Expand Up @@ -163,9 +161,36 @@
<artifactId>panelutils</artifactId>
<version>${panelutils.version}</version>
</dependency>
<!-- Mockito (Unit testing) -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.11.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
</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>
Expand All @@ -178,34 +203,32 @@
<directory>src/main/resources/locales</directory>
<targetPath>./locales</targetPath>
<filtering>false</filtering>
<includes>
<include>*.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.13.0</version>
<configuration>
<release>${java.version}</release>
<!-- <source>${java.version}</source> <target>${java.version}</target> -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.5.2</version>
<configuration>
<argLine>
${argLine}
Expand Down Expand Up @@ -242,24 +265,21 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<version>3.4.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.0</version>
<version>3.11.1</version>
<configuration>
<source>16</source>
<show>private</show>
<doclint>none</doclint> <!-- Turnoff all checks -->
<failOnError>false</failOnError>
<additionalJOption>-Xdoclint:none</additionalJOption>
<!-- To compile with Java 11, this tag may be required -->
<!-- <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable> -->
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
<source>17</source>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>install</phase>
<goals>
<goal>jar</goal>
</goals>
Expand All @@ -269,7 +289,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -279,67 +299,28 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.1-SNAPSHOT</version>
<configuration>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>lv.id.bonne:panelutils:*</include>
</includes>
</artifactSet>
<transformers>
<!-- Add a transformer to exclude any other manifest files (possibly from dependencies). -->
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
<resource>MANIFEST.MF</resource>
</transformer>
<!-- Add a transformer to include your custom manifest file. -->
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/MANIFEST.MF</resource>
<file>src/main/resources/META-INF/MANIFEST.MF</file>
</transformer>
</transformers>
</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>
<version>2.5.2</version>
<version>3.1.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<version>3.1.3</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</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>
Expand All @@ -364,5 +345,4 @@
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ private void setupAddon()
//this.registerListener(new MagicGeneratorListener(this));

this.registerListener(new JoinLeaveListener(this));
this.registerListener(new IslandLevelListener(this));
if(this.getAddonByName("Level").isPresent())
this.registerListener(new IslandLevelListener(this));

// Register Flags
this.registerFlag(MAGIC_COBBLESTONE_GENERATOR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
*/
public class StoneGeneratorPladdon extends Pladdon
{
private Addon addon;

@Override
public Addon getAddon()
{
return new StoneGeneratorAddon();
if (addon == null) {
addon = new StoneGeneratorAddon();
}
return addon;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,10 @@ public void setDeployed(boolean deployed)


/**
* Method GeneratorTierObject#getBlockChanceMap returns the blockChanceMap of this object.
* Returns the blockChanceMap of this object.
*
* @return the blockChanceMap (type Map<Double, Material>) of this object.
* @return a {@code TreeMap} where the keys are {@code Double} values representing chances,
* and the values are {@code Material} objects.
*/
public TreeMap<Double, Material> getBlockChanceMap()
{
Expand All @@ -264,9 +265,10 @@ public void setBlockChanceMap(TreeMap<Double, Material> blockChanceMap)


/**
* Method GeneratorTierObject#getTreasureChanceMap returns the treasureChanceMap of this object.
* Returns the treasureChanceMap of this object.
*
* @return the treasureChanceMap (type Map<Double, Material>) of this object.
* @return a {@code TreeMap} where the keys are {@code Double} values representing chances,
* and the values are {@code Material} objects.
*/
public TreeMap<Double, Material> getTreasureChanceMap()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected void playEffects(Block block)
// This spawns 8 large smoke particles.
for (int counter = 0; counter < 8; ++counter)
{
block.getWorld().spawnParticle(Particle.SMOKE_LARGE,
block.getWorld().spawnParticle(Particle.SMOKE,
blockX + Math.random(),
blockY + 1 + Math.random(),
blockZ + Math.random(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import world.bentobox.bentobox.api.events.island.IslandDeleteEvent;
import world.bentobox.bentobox.api.events.island.IslandRegisteredEvent;
import world.bentobox.bentobox.api.events.island.IslandResettedEvent;
import world.bentobox.bentobox.api.events.team.TeamSetownerEvent;
import world.bentobox.magiccobblestonegenerator.StoneGeneratorAddon;


Expand Down Expand Up @@ -82,6 +83,18 @@ public void onIslandCreated(IslandRegisteredEvent event)
}


/**
* This method handles Team Owner Change event
*
* @param event Event that must be handled.
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onTeamOwnerChange(TeamSetownerEvent event)
{
this.addon.getAddonManager().validateIslandData(event.getIsland());
}


/**
* This method handles island deletion. On island deletion it should remove generator data too.
*
Expand All @@ -98,4 +111,4 @@ public void onIslandDelete(IslandDeleteEvent event)
* stores addon instance
*/
private final StoneGeneratorAddon addon;
}
}
Loading
Loading