This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch NLPCRAFT-91-WORK
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/NLPCRAFT-91-WORK by this push:
     new da6ce96  WIP.
da6ce96 is described below

commit da6ce961c45f9e52c97a304aeac7d725710d4d2b
Author: Sergey Kamov <[email protected]>
AuthorDate: Mon Apr 26 14:25:54 2021 +0300

    WIP.
---
 nlpcraft-examples/minecraft-mod/build.gradle       |   2 +-
 .../nplcraft/example/minecraft/ExampleMod.java     | 192 ----------------
 .../nplcraft/example/minecraft/NCExampleMod.java   | 243 +++++++++++++++++++++
 .../minecraft/{ => utils}/GameFilesDump.java       |  50 +++--
 .../src/main/resources/nlpcraft-settings.json      |   0
 .../example/minecraft/FIllMatchProcessor.kt        |  20 +-
 .../nlpcraft/example/minecraft/ValueLoaders.kt     |  48 ++--
 .../apache/nlpcraft/server/rest/NCRestSpec.scala   |   2 -
 8 files changed, 307 insertions(+), 250 deletions(-)

diff --git a/nlpcraft-examples/minecraft-mod/build.gradle 
b/nlpcraft-examples/minecraft-mod/build.gradle
index 1c2d692..988b757 100644
--- a/nlpcraft-examples/minecraft-mod/build.gradle
+++ b/nlpcraft-examples/minecraft-mod/build.gradle
@@ -85,4 +85,4 @@ task dumpItems(type: JavaExec) {
     args "block", minecraftVersion
 }
 
-jar.finalizedBy('reobfJar')
+jar.finalizedBy('reobfJar')
\ No newline at end of file
diff --git 
a/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/ExampleMod.java
 
b/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/ExampleMod.java
deleted file mode 100644
index 9b72aee..0000000
--- 
a/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/ExampleMod.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.nplcraft.example.minecraft;
-
-import com.google.gson.Gson;
-import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.NoSuchFileException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Optional;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.util.FileUtil;
-import net.minecraft.util.math.vector.Vector2f;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.event.CommandEvent;
-import net.minecraftforge.eventbus.api.SubscribeEvent;
-import net.minecraftforge.fml.common.Mod;
-import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-@Mod("nlpcraft_mod")
-public class ExampleMod {
-    private static final Logger LOGGER = LogManager.getLogger();
-    private static final String MODEL_ID = "nlpcraft.minecraft.ex";
-    private final Gson gson = new Gson();
-    private NCSignIn creds;
-    private String baseUrl;
-    private MinecraftServer server;
-    private Optional<String> token = Optional.empty();
-    private boolean inRecursion = false;
-
-    public ExampleMod() {
-        MinecraftForge.EVENT_BUS.register(this);
-    }
-
-    @SubscribeEvent
-    public void onServerStarting(FMLServerStartingEvent event) {
-        this.server = event.getServer();
-    }
-
-    @SubscribeEvent
-    public void onCommandEvent(CommandEvent event) {
-        if (inRecursion) {
-            inRecursion = false;
-            return;
-        }
-        String command = event.getParseResults().getReader().getString();
-        Vector2f rotation = 
event.getParseResults().getContext().getSource().getRotation();
-        askProbe(command).map(r -> r.state)
-                .filter(s -> s.errorCode == null)
-                .map(s -> s.resBody)
-                .ifPresent(s -> {
-                    LOGGER.info("Command {} was converted to {}", command, s);
-                    event.setCanceled(true);
-                    inRecursion = true;
-                    
server.getCommandManager().handleCommand(server.getCommandSource(), "/" + s);
-                });
-    }
-
-    private Optional<NCResponse> askProbe(String txt) {
-        AskParams params = new AskParams();
-        params.txt = txt.startsWith("/") ? txt.substring(1) : txt;
-
-        Optional<String> optional = getToken();
-        if (!optional.isPresent()) {
-            return Optional.empty();
-        }
-        params.acsTok = optional.get();
-
-        return post("ask/sync", gson.toJson(params), NCResponse.class);
-    }
-
-    private Optional<String> getToken() {
-        loadSettings();
-
-        token = post("signin", gson.toJson(creds), NCSignResponse.class).map(x 
-> x.acsTok);
-
-        return token;
-    }
-
-    private <T> Optional<T> post(String url, String postJson, Class<T> clazz) {
-        try {
-            String str = baseUrl + url;
-
-            HttpURLConnection http = (HttpURLConnection) new 
URL(str).openConnection();
-            http.setRequestMethod("POST"); // PUT is another valid option
-            http.setRequestProperty("Content-Type", "application/json; 
charset=UTF-8");
-            http.setConnectTimeout(1_000);
-            http.setReadTimeout(5_000);
-
-            http.setDoOutput(true);
-            DataOutputStream wr = new DataOutputStream(http.getOutputStream());
-            wr.writeBytes(postJson);
-            wr.flush();
-            wr.close();
-
-            LOGGER.debug("Command sent to NC server");
-
-            BufferedReader in = new BufferedReader(new 
InputStreamReader(http.getInputStream()));
-
-            T response = gson.fromJson(in, clazz);
-
-            return Optional.of(response);
-        } catch (Exception e) {
-            LOGGER.error(e);
-        }
-
-        return Optional.empty();
-    }
-
-    private void loadSettings() {
-        creds = new NCSignIn();
-        creds.email = "[email protected]";
-        creds.passwd = "admin";
-        String host = "0.0.0.0";
-        String port = "8081";
-
-        Path configDir = Paths.get("config");
-
-        Path jsonPath = FileUtil.resolveResourcePath(configDir, 
"nlpcraft-settings", ".json");
-
-        try {
-            Reader reader = Files.newBufferedReader(jsonPath);
-
-            NCSettings settings = gson.fromJson(reader, NCSettings.class);
-            creds.email = settings.email;
-            creds.passwd = settings.passwd;
-            host = settings.host;
-            port = settings.port;
-        } catch (NoSuchFileException e) {
-            LOGGER.info("Credentials were not found");
-        } catch (IOException e) {
-            LOGGER.error(e);
-        }
-
-        baseUrl = "http://"; + host + ":" + port + "/api/v1/";
-    }
-
-    private class AskParams {
-        private final String mdlId = MODEL_ID;
-        private String acsTok;
-        private String txt;
-    }
-
-    private class NCResponse {
-        private String status;
-        private NCState state;
-    }
-
-    private class NCState {
-        private Integer errorCode;
-        private String error;
-        private String status;
-        private String resBody;
-    }
-
-    private class NCSignIn {
-        private String email;
-        private String passwd;
-    }
-
-    private class NCSignResponse {
-        private String acsTok;
-    }
-
-    private class NCSettings {
-        private String email;
-        private String passwd;
-        private String host;
-        private String port;
-    }
-}
diff --git 
a/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/NCExampleMod.java
 
b/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/NCExampleMod.java
new file mode 100644
index 0000000..6a5b3c8
--- /dev/null
+++ 
b/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/NCExampleMod.java
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.nplcraft.example.minecraft;
+
+import com.google.gson.Gson;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.util.FileUtil;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.CommandEvent;
+import net.minecraftforge.eventbus.api.SubscribeEvent;
+import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Paths;
+import java.util.HashSet;
+import java.util.Set;
+
+@Mod("nlpcraft_mod")
+public class NCExampleMod {
+    private static final String DFLT_EMAIL = "[email protected]";
+    private static final String DFLT_PSWD = "admin";
+    private static final String DFLT_HOST = "0.0.0.0";
+    private static final int DFLT_PORT = 8081;
+
+    private static final Logger LOGGER = LogManager.getLogger();
+    private static final String MODEL_ID = "nlpcraft.minecraft.ex";
+    private static final Gson GSON = new Gson();
+
+    private final Set<String> convCmds = new HashSet<>();
+
+    private NCSignIn creds;
+    private String baseUrl;
+    private MinecraftServer server;
+    private String token;
+
+    private static class AskParams {
+        private String mdlId;
+        private String acsTok;
+        private String txt;
+    }
+
+    private static class NCResponse {
+        private String status;
+        private NCState state;
+    }
+
+    private static class NCState {
+        private Integer errorCode;
+        private String error;
+        private String status;
+        private String resBody;
+    }
+
+    private static class NCSignIn {
+        private String email;
+        private String passwd;
+    }
+
+    private static class NCSignResponse {
+        private String acsTok;
+    }
+
+    private static class NCSettings {
+        private String email;
+        private String passwd;
+        private String host;
+        private int port;
+    }
+
+    private static class UnauthorizedException extends Exception {
+        // No-op.
+    }
+
+    public NCExampleMod() {
+        MinecraftForge.EVENT_BUS.register(this);
+    }
+
+    @SubscribeEvent
+    public void onServerStarting(FMLServerStartingEvent event) {
+        this.server = event.getServer();
+
+        loadSettings();
+    }
+
+    @SubscribeEvent
+    public void onCommandEvent(CommandEvent event) {
+        String cmd = event.getParseResults().getReader().getString();
+
+        // Converted command skipped.
+        if (convCmds.remove(cmd)) {
+            return;
+        }
+
+        try {
+            String convCmd = '/' + askProbe(cmd).state.resBody;
+
+            LOGGER.info("Command '{}' was converted to '{}'", cmd, convCmd);
+
+            event.setCanceled(true);
+
+            // This command should be skipped in this 'mod'.
+            convCmds.add(convCmd);
+
+            
server.getCommandManager().handleCommand(server.getCommandSource(), convCmd);
+        }
+        catch (Exception e) {
+            LOGGER.error("Execution command unexpected error [cmd=" + cmd + 
']', e);
+        }
+    }
+
+    private static NCSignIn mkSignin(String email, String passwd) {
+        NCSignIn s = new NCSignIn();
+
+        s.email = email;
+        s.passwd = passwd;
+
+        return s;
+    }
+
+    private NCResponse askProbe(String txt) throws Exception {
+        assert baseUrl != null;
+
+        AskParams params = new AskParams();
+
+        params.mdlId = MODEL_ID;
+        params.txt = txt.startsWith("/") ? txt.substring(1) : txt;
+
+        if (token == null) {
+            this.token = signin();
+        }
+
+        params.acsTok = this.token;
+
+        NCResponse resp;
+
+        try {
+            resp = post("ask/sync", GSON.toJson(params), NCResponse.class);
+        }
+        catch (UnauthorizedException e) {
+            // Token can be expired.
+            this.token = signin();
+
+            params.acsTok = this.token;
+
+            resp = post("ask/sync", GSON.toJson(params), NCResponse.class);
+        }
+
+        if (resp.state.error != null) {
+            throw new Exception("Invalid response [error=" + resp.state.error 
+ ']');
+        }
+        else if (resp.state.resBody == null) {
+            throw new Exception("Invalid empty response");
+        }
+
+        return resp;
+    }
+
+    private String signin() throws Exception {
+        return post("signin", GSON.toJson(creds), NCSignResponse.class).acsTok;
+    }
+
+    private <T> T post(String url, String postJson, Class<T> clazz) throws 
Exception {
+        assert baseUrl != null;
+
+        HttpURLConnection conn = (HttpURLConnection) new URL(baseUrl + 
url).openConnection();
+
+        conn.setRequestMethod("POST");
+        conn.setRequestProperty("Content-Type", "application/json; 
charset=UTF-8");
+        conn.setConnectTimeout(1_000);
+        conn.setReadTimeout(5_000);
+
+        conn.setDoOutput(true);
+
+        try (DataOutputStream out = new 
DataOutputStream(conn.getOutputStream())) {
+            out.writeBytes(postJson);
+
+            out.flush();
+        }
+
+        int code = conn.getResponseCode();
+
+        if (code == 401) {
+            throw new UnauthorizedException();
+        }
+
+        try (BufferedReader in = new BufferedReader(new 
InputStreamReader(conn.getInputStream()))) {
+            return GSON.fromJson(in, clazz);
+        }
+    }
+
+    private void loadSettings() {
+        try (
+            Reader reader =
+                Files.newBufferedReader(
+                    FileUtil.resolveResourcePath(Paths.get("config"), 
"nlpcraft-settings", ".json")
+                )
+        ) {
+            NCSettings settings = GSON.fromJson(reader, NCSettings.class);
+
+            LOGGER.info("Credentials file read.");
+
+            this.creds = mkSignin(settings.email, settings.passwd);
+            this.baseUrl = "http://"; + settings.host + ":" + settings.port + 
"/api/v1/";
+
+            return;
+        }
+        catch (NoSuchFileException e) {
+            LOGGER.info("Credentials were not found, default configuration 
used.");
+        }
+        catch (Exception e) {
+            LOGGER.error("Setting loading unexpected error", e);
+        }
+
+        this.creds = mkSignin(DFLT_EMAIL, DFLT_PSWD);
+        this.baseUrl = "http://"; + DFLT_HOST + ":" + DFLT_PORT + "/api/v1/";
+    }
+}
diff --git 
a/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/GameFilesDump.java
 
b/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/utils/GameFilesDump.java
similarity index 73%
rename from 
nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/GameFilesDump.java
rename to 
nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/utils/GameFilesDump.java
index dfd9c31..b2e06a2 100644
--- 
a/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/GameFilesDump.java
+++ 
b/nlpcraft-examples/minecraft-mod/src/main/java/org/apache/nplcraft/example/minecraft/utils/GameFilesDump.java
@@ -16,7 +16,7 @@
  *
  */
 
-package org.apache.nplcraft.example.minecraft;
+package org.apache.nplcraft.example.minecraft.utils;
 
 import com.google.gson.Gson;
 import java.util.Map;
@@ -25,46 +25,56 @@ import net.minecraft.util.registry.DefaultedRegistry;
 import net.minecraft.util.registry.Registry;
 import net.minecraftforge.registries.ForgeRegistryEntry;
 
+/**
+ * Utility for getting data from minecraft.
+ */
 public class GameFilesDump {
-    private final static Gson gson = new Gson();
+    private final static Gson GSON = new Gson();
+
+    private static class Dump {
+        private String version;
+        private Map<String, String> data;
+    }
 
     private static <T extends ForgeRegistryEntry<?>> void 
dumpRegistry(DefaultedRegistry<T> registry, String version) {
         Dump dump = new Dump();
+
         dump.version = version;
+
         // regular name -> registry name
-        dump.data = registry.stream().filter(x -> x.getRegistryName() != 
null).collect(Collectors.toMap(
-                x -> transformPath(x.getRegistryName().getPath()),
-                x -> x.getRegistryName().toString())
-        );
+        dump.data =
+            registry.stream().filter(x -> x.getRegistryName() != null).
+                collect(Collectors.toMap(
+                    x -> transformPath(x.getRegistryName().getPath()),
+                    x -> x.getRegistryName().toString())
+                );
         // add matching like grass -> grass_block
         dump.data.putAll(registry.stream()
-                .filter(x -> x.getRegistryName() != null && 
x.getRegistryName().getPath().endsWith("_block"))
-                .collect(Collectors.toMap(
-                        x -> 
transformPath(x.getRegistryName().getPath().replace("_block", "")),
-                        x -> x.getRegistryName().toString())
-                )
+            .filter(x -> x.getRegistryName() != null && 
x.getRegistryName().getPath().endsWith("_block"))
+            .collect(Collectors.toMap(
+                x -> 
transformPath(x.getRegistryName().getPath().replace("_block", "")),
+                x -> x.getRegistryName().toString())
+            )
         );
-        System.out.println(gson.toJson(dump));
+
+        System.out.println(GSON.toJson(dump));
     }
 
-    // Move to util
     private static String transformPath(String path) {
         return path.replaceAll("_", " ");
     }
 
-    private static class Dump {
-        private String version;
-        private Map<String, String> data;
-    }
-
     public static void main(String[] args) {
         String type = args[0];
         String version = args[1];
+
         if (type.equals("block")) {
             dumpRegistry(Registry.BLOCK, version);
-        } else if (type.equals("item")) {
+        }
+        else if (type.equals("item")) {
             dumpRegistry(Registry.ITEM, version);
-        } else {
+        }
+        else {
             System.err.println("Unknown type");
         }
     }
diff --git 
a/nlpcraft-examples/minecraft/src/main/resources/nlpcraft-settings.json 
b/nlpcraft-examples/minecraft-mod/src/main/resources/nlpcraft-settings.json
similarity index 100%
rename from 
nlpcraft-examples/minecraft/src/main/resources/nlpcraft-settings.json
rename to 
nlpcraft-examples/minecraft-mod/src/main/resources/nlpcraft-settings.json
diff --git 
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/FIllMatchProcessor.kt
 
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/FIllMatchProcessor.kt
index c8eff65..f576a52 100644
--- 
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/FIllMatchProcessor.kt
+++ 
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/FIllMatchProcessor.kt
@@ -36,35 +36,29 @@ class FIllMatchProcessor {
             val player = findPlayer(position)
             val positionCoordinate = positionCoordinate(position)
 
-            // TODO: Use user rotation
-            // TODO: handle y coordinate for cube
             return NCResult.text(
                 "execute at $player positioned 
${positionCoordinate.relative()} rotated 0 0 run " +
-                        "fill ${from.relativeRotated()} 
${to.relativeRotated()} $block"
+                    "fill ${from.relativeRotated()} ${to.relativeRotated()} 
$block"
             )
         }
 
         private fun resultCoordinates(length: Int, shape: String): 
Pair<Coordinate, Coordinate> {
             return when (shape) {
                 "line" -> Coordinate(-length / 2) to
-                        Coordinate((length - 1) / 2)
+                    Coordinate((length - 1) / 2)
                 "square" -> Coordinate(-length / 2, 0, -length / 2) to
-                        Coordinate((length - 1) / 2, 0, (length - 1) / 2)
+                    Coordinate((length - 1) / 2, 0, (length - 1) / 2)
                 "cube" -> Coordinate(-length / 2, -length / 2, -length / 2) to
-                        Coordinate((length - 1) / 2, (length - 1) / 2, (length 
- 1) / 2)
-                else -> {
-                    throw NCRejection("Unsupported shape")
-                }
+                    Coordinate((length - 1) / 2, (length - 1) / 2, (length - 
1) / 2)
+                else -> throw NCRejection("Unsupported shape")
             }
         }
 
         private fun positionCoordinate(position: NCToken): Coordinate {
-            return when (position.id ) {
+            return when (position.id) {
                 "position:player" -> Coordinate()
                 "position:front" -> Coordinate(0, 0, 
transformLength(Optional.of(position), 10))
-                else -> {
-                    throw NCRejection("Unsupported position")
-                }
+                else -> throw NCRejection("Unsupported position")
             }
         }
 
diff --git 
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/ValueLoaders.kt
 
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/ValueLoaders.kt
index 6342bf1..89b44e3 100644
--- 
a/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/ValueLoaders.kt
+++ 
b/nlpcraft-examples/minecraft/src/main/kotlin/org/apache/nlpcraft/example/minecraft/ValueLoaders.kt
@@ -27,6 +27,22 @@ import org.apache.nlpcraft.model.NCValue
 import org.apache.nlpcraft.model.NCValueLoader
 
 class MinecraftObjectValueLoader : NCValueLoader {
+    private data class Dump(val version: String, val data: Map<String, String>)
+
+    private class NCMinecraftValue(private var name: String, private var 
registry: String) : NCValue {
+        override fun getName(): String {
+            return name
+        }
+
+        override fun getSynonyms(): MutableList<String> {
+            return mutableListOf(name)
+        }
+
+        override fun toString(): String {
+            return registry
+        }
+    }
+
     private val mapper = 
jacksonObjectMapper().enable(JsonParser.Feature.ALLOW_COMMENTS)
 
     companion object {
@@ -36,14 +52,17 @@ class MinecraftObjectValueLoader : NCValueLoader {
     override fun load(owner: NCElement?): MutableSet<NCValue> {
         val type = owner!!.metax<String>("mc:type")
 
-        val inputStream = 
NCModelFileAdapter::class.java.classLoader.getResourceAsStream("${type}.json")
-            ?: throw NCException("Minecraft object dump not found: 
${type}.json")
+        val inputStream =
+            
NCModelFileAdapter::class.java.classLoader.getResourceAsStream("${type}.json") 
?:
+            throw NCException("Minecraft object dump not found: ${type}.json")
 
-        val dump = try {
-            mapper.readValue(inputStream, Dump::class.java)
-        } catch (e: Exception) {
-            throw NCException("Failed to read file: ${type}.json", e)
-        }
+        val dump =
+            try {
+                mapper.readValue(inputStream, Dump::class.java)
+            }
+            catch (e: Exception) {
+                throw NCException("Failed to read file: ${type}.json", e)
+            }
 
         dumps[type] = dump.data
 
@@ -51,18 +70,3 @@ class MinecraftObjectValueLoader : NCValueLoader {
     }
 }
 
-private class NCMinecraftValue(private var name: String, private var registry: 
String) : NCValue {
-    override fun getName(): String {
-        return name
-    }
-
-    override fun getSynonyms(): MutableList<String> {
-        return mutableListOf(name)
-    }
-
-    override fun toString(): String {
-        return registry
-    }
-}
-
-private data class Dump(val version: String, val data: Map<String, String>)
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestSpec.scala 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestSpec.scala
index 9aaba98..effd908 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/rest/NCRestSpec.scala
@@ -128,7 +128,6 @@ class NCRestSpec extends NCTestContext {
     type JList[T] = java.util.List[T]
 
     protected var tkn: String = _
-
     /**
       *
       */
@@ -147,7 +146,6 @@ class NCRestSpec extends NCTestContext {
 
         tkn
     }
-
     /**
       *
       */

Reply via email to