Skip to content

Commit c15c2e5

Browse files
tastybentoBONNe
andauthored
Release 1.12.0 (#24)
* 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]>
1 parent 934c063 commit c15c2e5

File tree

11 files changed

+1084
-209
lines changed

11 files changed

+1084
-209
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,22 @@ jobs:
1111
name: Build
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515
with:
1616
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
17-
- name: Set up JDK 16
18-
uses: actions/setup-java@v1
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v3
1919
with:
20-
java-version: 16
20+
distribution: 'adopt'
21+
java-version: 17
2122
- name: Cache SonarCloud packages
22-
uses: actions/cache@v1
23+
uses: actions/cache@v3
2324
with:
2425
path: ~/.sonar/cache
2526
key: ${{ runner.os }}-sonar
2627
restore-keys: ${{ runner.os }}-sonar
2728
- name: Cache Maven packages
28-
uses: actions/cache@v1
29+
uses: actions/cache@v3
2930
with:
3031
path: ~/.m2
3132
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}

pom.xml

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,18 @@
5555
<properties>
5656
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5757
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
58-
<java.version>8</java.version>
58+
<java.version>17</java.version>
5959
<!-- Non-minecraft related dependencies -->
6060
<powermock.version>2.0.9</powermock.version>
6161
<!-- More visible way how to change dependency versions -->
62-
<spigot.version>1.16.5-R0.1-SNAPSHOT</spigot.version>
63-
<bentobox.version>1.16.2</bentobox.version>
62+
<spigot.version>1.20.3-R0.1-SNAPSHOT</spigot.version>
63+
<bentobox.version>2.0.0-SNAPSHOT</bentobox.version>
6464
<!-- Revision variable removes warning about dynamic version -->
6565
<revision>${build.version}-SNAPSHOT</revision>
6666
<!-- Do not change unless you want different name for local builds. -->
6767
<build.number>-LOCAL</build.number>
6868
<!-- This allows to change between versions. -->
69-
<build.version>1.11.0</build.version>
69+
<build.version>1.12.0</build.version>
7070
<!-- Sonar Cloud -->
7171
<sonar.projectKey>BentoBoxWorld_addon-invSwitcher</sonar.projectKey>
7272
<sonar.organization>bentobox-world</sonar.organization>
@@ -113,30 +113,6 @@
113113
<build.number></build.number>
114114
</properties>
115115
</profile>
116-
<profile>
117-
<id>sonar</id>
118-
<properties>
119-
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
120-
<sonar.organization>bentobox-world</sonar.organization>
121-
</properties>
122-
<build>
123-
<plugins>
124-
<plugin>
125-
<groupId>org.sonarsource.scanner.maven</groupId>
126-
<artifactId>sonar-maven-plugin</artifactId>
127-
<version>3.6.0.1398</version>
128-
<executions>
129-
<execution>
130-
<phase>verify</phase>
131-
<goals>
132-
<goal>sonar</goal>
133-
</goals>
134-
</execution>
135-
</executions>
136-
</plugin>
137-
</plugins>
138-
</build>
139-
</profile>
140116
</profiles>
141117

142118
<repositories>
@@ -237,7 +213,34 @@
237213
<version>3.0.0-M5</version>
238214
<configuration>
239215
<argLine>
240-
--illegal-access=permit
216+
${argLine}
217+
--add-opens java.base/java.lang=ALL-UNNAMED
218+
--add-opens java.base/java.math=ALL-UNNAMED
219+
--add-opens java.base/java.io=ALL-UNNAMED
220+
--add-opens java.base/java.util=ALL-UNNAMED
221+
--add-opens
222+
java.base/java.util.stream=ALL-UNNAMED
223+
--add-opens java.base/java.text=ALL-UNNAMED
224+
--add-opens
225+
java.base/java.util.regex=ALL-UNNAMED
226+
--add-opens
227+
java.base/java.nio.channels.spi=ALL-UNNAMED
228+
--add-opens java.base/sun.nio.ch=ALL-UNNAMED
229+
--add-opens java.base/java.net=ALL-UNNAMED
230+
--add-opens
231+
java.base/java.util.concurrent=ALL-UNNAMED
232+
--add-opens java.base/sun.nio.fs=ALL-UNNAMED
233+
--add-opens java.base/sun.nio.cs=ALL-UNNAMED
234+
--add-opens java.base/java.nio.file=ALL-UNNAMED
235+
--add-opens
236+
java.base/java.nio.charset=ALL-UNNAMED
237+
--add-opens
238+
java.base/java.lang.reflect=ALL-UNNAMED
239+
--add-opens
240+
java.logging/java.util.logging=ALL-UNNAMED
241+
--add-opens java.base/java.lang.ref=ALL-UNNAMED
242+
--add-opens java.base/java.util.jar=ALL-UNNAMED
243+
--add-opens java.base/java.util.zip=ALL-UNNAMED
241244
</argLine>
242245
</configuration>
243246
</plugin>
@@ -280,30 +283,36 @@
280283
<plugin>
281284
<groupId>org.jacoco</groupId>
282285
<artifactId>jacoco-maven-plugin</artifactId>
283-
<version>0.8.3</version>
286+
<version>0.8.10</version>
284287
<configuration>
285288
<append>true</append>
286289
<excludes>
287290
<!-- This is required to prevent Jacoco from adding
288291
synthetic fields to a JavaBean class (causes errors in testing) -->
289292
<exclude>**/*Names*</exclude>
293+
<exclude>org/bukkit/Material*</exclude>
290294
</excludes>
291295
</configuration>
292296
<executions>
293297
<execution>
294-
<id>pre-unit-test</id>
298+
<id>prepare-agent</id>
295299
<goals>
296300
<goal>prepare-agent</goal>
297301
</goals>
298302
</execution>
299303
<execution>
300-
<id>post-unit-test</id>
304+
<id>report</id>
301305
<goals>
302306
<goal>report</goal>
303307
</goals>
308+
<configuration>
309+
<formats>
310+
<format>XML</format>
311+
</formats>
312+
</configuration>
304313
</execution>
305314
</executions>
306315
</plugin>
307316
</plugins>
308317
</build>
309-
</project>
318+
</project>

src/main/java/com/wasteofplastic/invswitcher/InvSwitcher.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,19 @@
1515
import world.bentobox.bentobox.api.configuration.Config;
1616
import world.bentobox.bentobox.database.DatabaseSetup.DatabaseType;
1717

18+
/**
19+
* Inventory switcher for worlds. Switches advancements too.
20+
*
21+
* @author tastybento
22+
*
23+
*/
1824
public class InvSwitcher extends Addon {
25+
1926
private Store store;
2027

2128
private Settings settings;
2229

23-
private Config<Settings> config = new Config<>(this, Settings.class);
30+
private final Config<Settings> config = new Config<>(this, Settings.class);
2431

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

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

src/main/java/com/wasteofplastic/invswitcher/Settings.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ public class Settings implements ConfigObject {
3030
private boolean gamemode = true;
3131
@ConfigEntry(path = "options.experience")
3232
private boolean experience = true;
33-
@ConfigEntry(path = "options.location")
34-
private boolean location = true;
3533
@ConfigEntry(path = "options.ender-chest")
3634
private boolean enderChest = true;
3735
@ConfigEntry(path = "options.statistics")
3836
private boolean statistics = true;
39-
37+
4038
/**
4139
* @return the worlds
4240
*/
@@ -121,18 +119,6 @@ public boolean isExperience() {
121119
public void setExperience(boolean experience) {
122120
this.experience = experience;
123121
}
124-
/**
125-
* @return the location
126-
*/
127-
public boolean isLocation() {
128-
return location;
129-
}
130-
/**
131-
* @param location the location to set
132-
*/
133-
public void setLocation(boolean location) {
134-
this.location = location;
135-
}
136122
/**
137123
* @return the enderChest
138124
*/

0 commit comments

Comments
 (0)