Skip to content

Commit 7563a9e

Browse files
committed
v2.1.0
1 parent ebff316 commit 7563a9e

File tree

10 files changed

+106
-41
lines changed

10 files changed

+106
-41
lines changed

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Automatically build the project and run any configured tests for every push
2+
# and submitted pull request. This can help catch issues that only occur on
3+
# certain platforms or Java versions, and provides a first line of defence
4+
# against bad commits.
5+
6+
name: build
7+
on: [pull_request, push]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
# Use these Java versions
14+
java: [
15+
21, # Current Java LTS
16+
]
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- name: checkout repository
20+
uses: actions/checkout@v4
21+
- name: validate gradle wrapper
22+
uses: gradle/actions/wrapper-validation@v4
23+
- name: setup jdk ${{ matrix.java }}
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: ${{ matrix.java }}
27+
distribution: 'microsoft'
28+
- name: make gradle wrapper executable
29+
run: chmod +x ./gradlew
30+
- name: build
31+
run: ./gradlew build
32+
- name: capture build artifacts
33+
if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: Artifacts
37+
path: build/libs/

.gitignore

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
1-
.gradle
2-
**/build/
3-
!src/**/build/
1+
# gradle
42

5-
# Ignore Gradle GUI config
6-
gradle-app.setting
3+
.gradle/
4+
build/
5+
out/
6+
classes/
77

8-
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
9-
!gradle-wrapper.jar
8+
# eclipse
109

11-
# Avoid ignore Gradle wrappper properties
12-
!gradle-wrapper.properties
10+
*.launch
1311

14-
# Cache of project
15-
.gradletasknamecache
12+
# idea
1613

17-
# Eclipse Gradle plugin generated files
18-
# Eclipse Core
19-
.project
20-
# JDT-specific (Eclipse Java Development Tools)
14+
.idea/
15+
*.iml
16+
*.ipr
17+
*.iws
18+
19+
# vscode
20+
21+
.settings/
22+
.vscode/
23+
bin/
2124
.classpath
25+
.project
26+
27+
# macos
28+
29+
*.DS_Store
30+
31+
# fabric
32+
33+
run/
2234

23-
run
24-
.idea
35+
# java
2536

37+
hs_err_*.log
38+
replay_*.log
39+
*.hprof
40+
*.jfr

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//file:noinspection GroovyAssignabilityCheck
22
plugins {
3-
id 'fabric-loom' version '1.7-SNAPSHOT'
3+
id 'fabric-loom' version '1.10-SNAPSHOT'
44
id 'maven-publish'
55
}
66

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ minecraft_version=1.21.3
88
loader_version=0.16.9
99

1010
# Mod Properties
11-
mod_version=2.0.0
12-
maven_group=io.github.qwerty770
13-
archives_base_name=AdvancementHelper
11+
mod_version=2.1.0
12+
maven_group=io.github.qwerty770.advhelper
13+
archives_base_name=advancement-helper
1414

1515
# Dependencies
1616
fabric_version=0.109.0+1.21.3
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

src/client/java/io/github/qwerty770/advhelper/AdvancementCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private static void exportAllAdvancements(CommandContext<FabricClientCommandSour
9191
for (FileWriter writer : fileWriterMap.values()){
9292
writer.close();
9393
}
94-
AdvancementHelper.LOGGER.info("Advancement Helper exported {} advancements", advancements.size());
94+
AdvancementHelper.LOGGER.info("Advancement Helper exported {} advancements.", advancements.size());
9595
context.getSource().sendFeedback(Component.translatable("commands.advhelper.export.success"));
9696
}
9797
catch (IOException exception){
@@ -110,7 +110,7 @@ private static void exportProgress(String namespace, CommandContext<FabricClient
110110
FileWriter fileWriter = createFile(namespace, "progress");
111111
writeJson(fileWriter, json);
112112
fileWriter.close();
113-
AdvancementHelper.LOGGER.info("Advancement Helper exported the advancements' progress of namespace {}", namespace);
113+
AdvancementHelper.LOGGER.info("Advancement Helper exported the advancements' progress of namespace {}.", namespace);
114114
context.getSource().sendFeedback(Component.translatable("commands.advhelper.export.success"));
115115
}
116116
catch (IOException exception){
@@ -140,7 +140,7 @@ private static void exportAllProgress(CommandContext<FabricClientCommandSource>
140140
for (FileWriter writer : fileWriterMap.values()){
141141
writer.close();
142142
}
143-
AdvancementHelper.LOGGER.info("Advancement Helper exported {} advancements' progress", progress.size());
143+
AdvancementHelper.LOGGER.info("Advancement Helper exported {} advancements' progress.", progress.size());
144144
context.getSource().sendFeedback(Component.translatable("commands.advhelper.export.success"));
145145
}
146146
catch (IOException exception){
@@ -163,7 +163,7 @@ private static FileWriter createFile(String namespace, String type) throws IOExc
163163
}
164164

165165
private static void sendFailure(IOException exception, CommandContext<FabricClientCommandSource> context){
166-
AdvancementHelper.LOGGER.error("Failed to export to a file");
166+
AdvancementHelper.LOGGER.error("Failed to export to a file!");
167167
AdvancementHelper.LOGGER.error(exception.getMessage());
168168
context.getSource().sendFeedback(Component.translatable("commands.advhelper.export.fail"));
169169
}

src/client/java/io/github/qwerty770/advhelper/AdvancementHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@SuppressWarnings("unused")
99
public class AdvancementHelper implements ClientModInitializer {
1010
public static final Logger LOGGER = LoggerFactory.getLogger("advhelper");
11-
public static final String version = "2.0.0";
11+
public static final String version = "2.1.0";
1212
@Override
1313
public void onInitializeClient() {
1414
ClientCommandRegistrationCallback.EVENT.register(((dispatcher, registryAccess) -> AdvancementCommand.register(dispatcher)));

src/client/java/io/github/qwerty770/advhelper/AdvancementTool.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,10 @@ public static JsonElement getJson(AdvancementHolder holder, AdvancementTree tree
4949
}
5050
try {
5151
return Advancement.CODEC.encodeStart(JsonOps.INSTANCE, builder.build(holder.id()).value()).getOrThrow();
52-
} catch (IllegalStateException e) {
53-
AdvancementHelper.LOGGER.error("Failed to encode the advancement {}", holder.id());
54-
AdvancementHelper.LOGGER.error(e.getMessage());
55-
JsonObject fail = new JsonObject();
56-
fail.addProperty("error", e.getMessage());
57-
return fail;
52+
} catch (IllegalStateException | IllegalArgumentException e) {
53+
return error(e, "Failed to encode the advancement {}!", holder.id().toString());
54+
} catch (Exception e){
55+
return error(e, "Failed to encode the advancement {} due to an unexpected error!", holder.id().toString());
5856
}
5957
}
6058

@@ -72,12 +70,18 @@ public static JsonElement getJson(AdvancementProgress progress) {
7270
result.add("remaining", remaining);
7371
result.addProperty("done_percent", progress.getPercent());
7472
return result;
75-
} catch (IllegalStateException e) {
76-
AdvancementHelper.LOGGER.error("Failed to encode the progress of the advancement {}", progress.toString());
77-
AdvancementHelper.LOGGER.error(e.getMessage());
78-
JsonObject fail = new JsonObject();
79-
fail.addProperty("error", e.getMessage());
80-
return fail;
73+
} catch (IllegalStateException | IllegalArgumentException e) {
74+
return error(e, "Failed to encode the progress of the advancement {}!", progress.toString());
75+
} catch (Exception e){
76+
return error(e, "Failed to encode the progress of the advancement {} due to an unexpected error!", progress.toString());
8177
}
8278
}
79+
80+
private static JsonElement error(Exception exception, String str1, String str2) {
81+
AdvancementHelper.LOGGER.error(str1, str2);
82+
AdvancementHelper.LOGGER.error(exception.getMessage());
83+
JsonObject fail = new JsonObject();
84+
fail.addProperty("error", exception.getMessage());
85+
return fail;
86+
}
8387
}

src/client/resources/fabric.mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"schemaVersion": 1,
33
"id": "advhelper",
4-
"version": "2.0.0",
4+
"version": "${version}",
55
"name": "Advancement Helper",
66
"description": "Useful tools for advancements",
77
"authors": [
@@ -23,7 +23,7 @@
2323
],
2424
"depends": {
2525
"fabricloader": ">=0.15.0",
26-
"minecraft": ">=1.20.3",
26+
"minecraft": ">=1.20.2",
2727
"java": ">=17",
2828
"fabric-api": "*"
2929
},

0 commit comments

Comments
 (0)