Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
update
  • Loading branch information
cooffeeRequired committed Jan 25, 2025
2 parents ddea517 + dc1d3ad commit 7bcc6e0
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 51 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/skript-test.yml

This file was deleted.

86 changes: 86 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<<<<<<< HEAD:.github/workflows/skript-test.yml
name: Build and test

on:
- push
- pull_request

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 21
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew shadow -Penv=TEST
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
path: build/libs/*.jar
test:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: extra-plugins/
merge-multiple: true
- name: Run tests
uses: SkriptLang/skript-test-action@feature/performance
with:
test_script_directory: src/test/scripts/
extra_plugins_directory: extra-plugins/
=======
name: SkJson Tests

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v1
with:
java-version: 21
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew shadow
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
path: build/libs/*.jar
test:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: extra-plugins/
merge-multiple: true
- name: Run tests
uses: SkriptLang/[email protected]
with:
run_vanilla_tests: false
test_script_directory: src/test/scripts
extra_plugins_directory: extra-plugins/
>>>>>>> origin/main:.github/workflows/tests.yml
4 changes: 2 additions & 2 deletions src/main/java/cz/coffeerequired/SkJson.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void onLoad() {

@SuppressWarnings("UnstableApiUsage")
private BiConsumer<CommandSender, String[]> aboutAddon() {
return (sender, _) -> {
return (sender, s) -> {
var plMeta = this.getPluginMeta();

@SuppressWarnings("unchecked") ArrayList<String> list = (ArrayList<String>) pluginConfig.get("soft-depend");
Expand Down Expand Up @@ -95,7 +95,7 @@ public void onEnable() {
Commands.add("about|?", aboutAddon(), Commands.emptyCompleter());
Commands.add(
"reload",
(sender, _) -> {
(sender, s) -> {
sender.sendMessage(logger().colorize(CustomLogger.getGRADIENT_PREFIX() + " 🟠 &econfig reloading..."));
try {
final WeakHashMap<String, ?> before = new WeakHashMap<>(Map.ofEntries(
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cz/coffeerequired/api/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public static void registerCommand(final JavaPlugin plugin) {
else cmd.setExecutor(new CommandManager());
}
public static BiFunction<CommandSender, String[], List<String>> emptyCompleter() {
return (_, _) -> List.of();
return (a, b) -> List.of();
}

@SuppressWarnings("ResultOfMethodCallIgnored")
public static BiConsumer<CommandSender, String[]> emptyCommand() {
return (_, _) -> List.of();
return (c, s) -> List.of();
}

private record CommandHandler(BiConsumer<CommandSender, String[]> commandExecutor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void addValue(S id, J jsonElement, F file) {
CompletableFuture.runAsync(() -> {
lock.writeLock().lock();
try {
computeIfAbsent(id, _ -> new ConcurrentHashMap<>()).put(jsonElement, file);
computeIfAbsent(id, s-> new ConcurrentHashMap<>()).put(jsonElement, file);
} finally {
lock.writeLock().unlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected void execute(Event event) {
CompletableFuture.runAsync(() -> {
if (cache.containsKey(id)) {
File[] file = new File[1];
cache.get(id).forEach((_, f) -> file[0] = f);
cache.get(id).forEach((j, f) -> file[0] = f);
if (isBindingMode) {
if (!CacheStorageWatcher.Extern.hasRegistered(file[0])) {
CacheStorageWatcher.Extern.register(id, file[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void saveStorage(String id, ConcurrentHashMap<JsonElement, File> map) {
return;
}

FileHandler.write(f.toString(), j, new String[]{"replace=true"}).whenComplete((_, error) -> {
FileHandler.write(f.toString(), j, new String[]{"replace=true"}).whenComplete((b, error) -> {
if (error != null) {
SkJson.logger().exception("Cannot save storage id " + id, error);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected void execute(Event event) {
var file = new File[1];

if (cache.containsKey(id)) {
cache.get(id).forEach((_, v) -> file[0] = v);
cache.get(id).forEach((j, v) -> file[0] = v);

SkJson.logger().debug("is storage bound: " + CacheStorageWatcher.Extern.hasRegistered(file[0]));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public boolean check(Event event) {
var cache = Api.getCache();
if (cache.containsKey(id)) {
File[] tempFile = new File[1];
cache.get(id).forEach((_, file) -> tempFile[0] = file);
cache.get(id).forEach((j, file) -> tempFile[0] = file);
return (line == 0) == CacheStorageWatcher.Extern.hasRegistered(tempFile[0]);
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public class ExprGetCacheStorage extends SimpleExpression<JsonElement> {
if (line == 0) {
if (cache.containsKey(storedKey)) {
JsonElement[] json = new JsonElement[1];
cache.get(storedKey).forEach((json_, _) -> json[0] = json_);
cache.get(storedKey).forEach((json_, f) -> json[0] = json_);
return json;
}
} else {
ArrayList<JsonElement> elements = new ArrayList<>();
cache.forEach((_, m) -> m.forEach((json, _) -> elements.add(json)));
cache.forEach((s, m) -> m.forEach((json, f) -> elements.add(json)));
return elements.toArray(new JsonElement[0]);
}
return new JsonElement[0];
Expand Down
File renamed without changes.

0 comments on commit 7bcc6e0

Please sign in to comment.