Skip to content

Commit a92df39

Browse files
authored
Merge pull request #358 from BentoBoxWorld/develop
Updated release
2 parents 4438c36 + 6c52618 commit a92df39

File tree

14 files changed

+1368
-770
lines changed

14 files changed

+1368
-770
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
- 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 17
17+
- name: Set up JDK 21
1818
uses: actions/setup-java@v3
1919
with:
2020
distribution: 'adopt'
21-
java-version: 17
21+
java-version: 21
2222
- name: Cache SonarCloud packages
2323
uses: actions/cache@v3
2424
with:

pom.xml

+16-16
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,30 @@
2828
<system>GitHub</system>
2929
<url>https://github.com/BentoBoxWorld/Challenges/issues</url>
3030
</issueManagement>
31+
32+
<distributionManagement>
33+
<repository>
34+
<id>bentoboxworld</id>
35+
<url>https://repo.codemc.org/repository/bentoboxworld/</url>
36+
</repository>
37+
</distributionManagement>
3138

3239
<properties>
3340
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3441
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
35-
<java.version>17</java.version>
42+
<java.version>21</java.version>
3643
<powermock.version>2.0.9</powermock.version>
3744
<!-- More visible way how to change dependency versions -->
38-
<spigot.version>1.20.4-R0.1-SNAPSHOT</spigot.version>
45+
<spigot.version>1.21.3-R0.1-SNAPSHOT</spigot.version>
3946
<spigot-annotations.version>1.2.3-SNAPSHOT</spigot-annotations.version>
40-
<bentobox.version>2.1.0</bentobox.version>
47+
<bentobox.version>2.7.1-SNAPSHOT</bentobox.version>
4148
<level.version>2.6.3</level.version>
4249
<vault.version>1.7</vault.version>
4350
<panelutils.version>1.2.0</panelutils.version>
4451
<!-- Revision variable removes warning about dynamic version -->
4552
<revision>${build.version}-SNAPSHOT</revision>
4653
<!-- This allows to change between versions and snapshots. -->
47-
<build.version>1.3.1</build.version>
54+
<build.version>1.4.0</build.version>
4855
<build.number>-LOCAL</build.number>
4956
<!-- Sonar Cloud -->
5057
<sonar.projectKey>BentoBoxWorld_Challenges</sonar.projectKey>
@@ -83,17 +90,6 @@
8390
</profile>
8491
</profiles>
8592

86-
<distributionManagement>
87-
<snapshotRepository>
88-
<id>codemc-snapshots</id>
89-
<url>https://repo.codemc.org/repository/maven-snapshots</url>
90-
</snapshotRepository>
91-
<repository>
92-
<id>codemc-releases</id>
93-
<url>https://repo.codemc.org/repository/maven-releases</url>
94-
</repository>
95-
</distributionManagement>
96-
9793
<pluginRepositories>
9894
<pluginRepository>
9995
<id>apache.snapshots</id>
@@ -108,6 +104,10 @@
108104
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
109105
</repository>
110106
<!-- CodeMC Repo for BentoBox -->
107+
<repository>
108+
<id>bentoboxworld</id>
109+
<url>https://repo.codemc.io/repository/bentoboxworld/</url>
110+
</repository>
111111
<repository>
112112
<id>codemc-repo</id>
113113
<url>https://repo.codemc.io/repository/maven-public</url>
@@ -231,7 +231,7 @@
231231
<plugin>
232232
<groupId>org.apache.maven.plugins</groupId>
233233
<artifactId>maven-shade-plugin</artifactId>
234-
<version>3.3.1-SNAPSHOT</version>
234+
<version>3.6.0</version>
235235
<configuration>
236236
<minimizeJar>true</minimizeJar>
237237
<artifactSet>

src/main/java/world/bentobox/challenges/commands/admin/ChallengesAdminCommand.java

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public boolean execute(User user, String label, List<String> args)
6363

6464
return true;
6565
}
66+
this.showHelp(this, user);
6667
return false;
6768
}
6869
}

src/main/java/world/bentobox/challenges/database/object/ChallengeLevel.java

+3
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ public String getFriendlyName()
153153
*/
154154
public ItemStack getIcon()
155155
{
156+
if (icon == null) {
157+
icon = new ItemStack(Material.PAPER);
158+
}
156159
return icon.clone();
157160
}
158161

src/main/java/world/bentobox/challenges/managers/ChallengesManager.java

+18-14
Original file line numberDiff line numberDiff line change
@@ -113,32 +113,36 @@ public class ChallengesManager
113113
* This comparator orders challenges by their level, order and name.
114114
*/
115115
private final Comparator<Challenge> challengeComparator = (o1, o2) -> {
116+
// Get the levels
116117
ChallengeLevel o1Level = this.getLevel(o1.getLevel());
117118
ChallengeLevel o2Level = this.getLevel(o2.getLevel());
118119

119-
if (o1Level == null && o2Level == null)
120-
{
120+
// Handle null levels consistently
121+
if (o1Level == null && o2Level == null) {
122+
// Both levels are null, compare by order
121123
return Integer.compare(o1.getOrder(), o2.getOrder());
122-
}
123-
else if (o1Level == null)
124-
{
124+
} else if (o1Level == null) {
125+
// If o1 level is null, it should be ordered lower
125126
return -1;
126-
}
127-
else if (o2Level == null)
128-
{
127+
} else if (o2Level == null) {
128+
// If o2 level is null, it should be ordered lower
129129
return 1;
130130
}
131-
else if (o1Level.equals(o2Level))
132-
{
131+
132+
// If both levels are non-null, compare their orders
133+
int levelComparison = Integer.compare(o1Level.getOrder(), o2Level.getOrder());
134+
135+
// If levels are the same, compare by challenge order
136+
if (levelComparison == 0) {
133137
return Integer.compare(o1.getOrder(), o2.getOrder());
134138
}
135-
else
136-
{
137-
return Integer.compare(o1Level.getOrder(), o2Level.getOrder());
138-
}
139+
140+
// Return the level comparison result
141+
return levelComparison;
139142
};
140143

141144

145+
142146
// ---------------------------------------------------------------------
143147
// Section: Constructor
144148
// ---------------------------------------------------------------------

src/main/java/world/bentobox/challenges/panel/ConversationUtils.java

+3
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ public String getPromptText(@NotNull ConversationContext conversationContext)
119119
withFirstPrompt(confirmationPrompt).
120120
withLocalEcho(false).
121121
withTimeout(90).
122+
// Use null value in consumer to detect if user has abandoned conversation.
123+
addConversationAbandonedListener(ConversationUtils.getAbandonListener(consumer, user))
124+
.
122125
buildConversation(user.getPlayer()).
123126
begin();
124127
}

src/main/java/world/bentobox/challenges/web/WebManager.java

+5
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ public void requestEntryGitHubData(User user, World world, LibraryEntry entry)
151151
if (this.plugin.getSettings().isLogGithubDownloadData())
152152
{
153153
this.plugin.log("Could not connect to GitHub.");
154+
this.plugin.log(
155+
"JSON files can be found at https://github.com/BentoBoxWorld/weblink/tree/master/challenges/library");
156+
user.sendRawMessage("Could not connect to GitHub.");
157+
user.sendRawMessage(
158+
"JSON files can be found at https://github.com/BentoBoxWorld/weblink/tree/master/challenges/library");
154159
}
155160
}
156161
catch (Exception e)

src/main/resources/addon.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Challenges
22
main: world.bentobox.challenges.ChallengesAddon
33
version: ${version}${build.number}
4-
api-version: 1.17
4+
api-version: 2.7.1
55
repository: 'BentoBoxWorld/Challenges'
66
metrics: true
77

0 commit comments

Comments
 (0)