You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JsScripts.displayChat(Text.literal("/jsscripts disable - Remove a script from the auto-enable list.").formatted(Formatting.AQUA));
36
37
JsScripts.displayChat(Text.literal("/jsscripts upload - Upload a script to jspm.").formatted(Formatting.AQUA));
37
38
JsScripts.displayChat(Text.literal("/jsscripts download - Download a script from jspm.").formatted(Formatting.AQUA));
39
+
JsScripts.displayChat(Text.literal("/jsscripts update - Check for script updates from jspm.").formatted(Formatting.AQUA));
38
40
return1;
39
41
})
40
42
.then(literal("reload")
@@ -219,6 +221,7 @@ public void register() {
219
221
MinecraftVersion.CURRENT.getName()
220
222
));
221
223
JsScripts.displayChat(Text.literal("Please update the newly created jspm.json file in the script if necessary, then retry.").formatted(Formatting.AQUA));
224
+
JsScripts.displayChat(Text.literal("It is also recommended to have a README.md and LICENSE file, as the code will be made public.").formatted(Formatting.AQUA));
222
225
return;
223
226
}
224
227
@@ -272,8 +275,14 @@ public void register() {
272
275
}
273
276
274
277
if (root.toFile().exists()) {
275
-
JsScripts.displayChat(Text.literal("Script already found locally! Delete it to re-download.").formatted(Formatting.RED));
276
-
return;
278
+
FileUtilsfu = FileUtils.getInstance();
279
+
if (fu.hasTrash()) {
280
+
fu.moveToTrash(root.toFile());
281
+
JsScripts.displayChat(Text.literal("Moved previous script version to the trash.").formatted(Formatting.AQUA));
282
+
} else {
283
+
JsScripts.displayChat(Text.literal("Script already found locally! Delete it to re-download.").formatted(Formatting.RED));
284
+
return;
285
+
}
277
286
}
278
287
279
288
JsScripts.displayChat(Text.literal("Downloading script from JSPM...").formatted(Formatting.AQUA));
@@ -290,6 +299,42 @@ public void register() {
290
299
})
291
300
)
292
301
)
302
+
.then(literal("update")
303
+
.executes((e) -> {
304
+
newThread(() -> {
305
+
intupdates = 0;
306
+
for (Filef : ScriptManager.modDir.resolve("scripts").toFile().listFiles()) {
307
+
try {
308
+
Pathp = f.toPath().resolve("jspm.json");
309
+
if (!Files.exists(p)) {
310
+
JsScripts.displayChat(Text.literal(f.getName() + ": No jspm.json").formatted(Formatting.AQUA));
0 commit comments