Skip to content

Commit

Permalink
Release 1.12.0 (#24)
Browse files Browse the repository at this point in the history
* Version 1.11.1

* Remove unused location setting

* Clean up code.

* Fixed test.

* Build against BentoBox 1.18 API

* Not allow null.

* Remove useless eq invocation

* Fixes major bug in InvSwitcher addon (#22)

There was a huge bug that always cleared a separated value, even if that is disabled in the config file. 
The most important bug: if `inventory` or `ender-chest` separation is disabled, player inventories and ender chests would still be cleared without the ability to restore them.

* Remove unused method

* Version up

Switch to Java 17

* Added InventoryStorage test class.

* Update github script

* Added PlayerListener test class

* Added InvSwitcher test

* Clean up test class

* Chnaged package name and fixed onDisable() test

* Minor refactor to reduce complexity.

* Refactored to reduce complexity

* Remove unneeded default

* Code clean up from IntelliJ

* Remove unused default

* Remove nesting.

* Even less complexity!

* Redid Store test class

* Completed cache test.

* Updated dependencies

* Update Github Action build script

* Added distribution required for Github Action

* Update Jacoco

* Update pom.xml

* Update to BentoBox 2.0.0

* Update to 1.20.3

Also fixes test issue with Material being too big.

---------

Co-authored-by: BONNe <[email protected]>
  • Loading branch information
tastybento and BONNe authored Jan 11, 2024
1 parent 934c063 commit c15c2e5
Show file tree
Hide file tree
Showing 11 changed files with 1,084 additions and 209 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@ jobs:
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 16
uses: actions/setup-java@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 16
distribution: 'adopt'
java-version: 17
- 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 Down
75 changes: 42 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>8</java.version>
<java.version>17</java.version>
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.9</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.16.5-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.16.2</bentobox.version>
<spigot.version>1.20.3-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>
<!-- 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.11.0</build.version>
<build.version>1.12.0</build.version>
<!-- Sonar Cloud -->
<sonar.projectKey>BentoBoxWorld_addon-invSwitcher</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down Expand Up @@ -113,30 +113,6 @@
<build.number></build.number>
</properties>
</profile>
<profile>
<id>sonar</id>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>bentobox-world</sonar.organization>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<repositories>
Expand Down Expand Up @@ -237,7 +213,34 @@
<version>3.0.0-M5</version>
<configuration>
<argLine>
--illegal-access=permit
${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>
Expand Down Expand Up @@ -280,30 +283,36 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</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>
<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>
</plugins>
</build>
</project>
</project>
10 changes: 8 additions & 2 deletions src/main/java/com/wasteofplastic/invswitcher/InvSwitcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,19 @@
import world.bentobox.bentobox.api.configuration.Config;
import world.bentobox.bentobox.database.DatabaseSetup.DatabaseType;

/**
* Inventory switcher for worlds. Switches advancements too.
*
* @author tastybento
*
*/
public class InvSwitcher extends Addon {

private Store store;

private Settings settings;

private Config<Settings> config = new Config<>(this, Settings.class);
private final Config<Settings> config = new Config<>(this, Settings.class);

private Set<World> worlds = new HashSet<>();

Expand Down Expand Up @@ -75,7 +82,6 @@ public void onEnable() {
if (this.getPlugin().getSettings().getDatabaseType().equals(DatabaseType.YAML)) {
this.setState(State.DISABLED);
this.logError("This addon is incompatible with YAML database. Please use another type, like JSON.");
return;
}
}

Expand Down
16 changes: 1 addition & 15 deletions src/main/java/com/wasteofplastic/invswitcher/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ public class Settings implements ConfigObject {
private boolean gamemode = true;
@ConfigEntry(path = "options.experience")
private boolean experience = true;
@ConfigEntry(path = "options.location")
private boolean location = true;
@ConfigEntry(path = "options.ender-chest")
private boolean enderChest = true;
@ConfigEntry(path = "options.statistics")
private boolean statistics = true;

/**
* @return the worlds
*/
Expand Down Expand Up @@ -121,18 +119,6 @@ public boolean isExperience() {
public void setExperience(boolean experience) {
this.experience = experience;
}
/**
* @return the location
*/
public boolean isLocation() {
return location;
}
/**
* @param location the location to set
*/
public void setLocation(boolean location) {
this.location = location;
}
/**
* @return the enderChest
*/
Expand Down
Loading

0 comments on commit c15c2e5

Please sign in to comment.