|
@@ -1,5 +1,6 @@
|
|
|
package me.hammerle.snuviscript;
|
|
|
|
|
|
+import me.hammerle.code.ISnuviLogger;
|
|
|
import me.hammerle.code.Script;
|
|
|
import me.hammerle.code.SnuviParser;
|
|
|
import me.hammerle.exceptions.SnuviException;
|
|
@@ -10,17 +11,35 @@ public class SnuviScript
|
|
|
{
|
|
|
public static void main(String[] args)
|
|
|
{
|
|
|
- SnuviParser parser = new SnuviParser((SnuviException ex) ->
|
|
|
+ SnuviParser parser = new SnuviParser(new ISnuviLogger()
|
|
|
{
|
|
|
- System.out.println("Exception " + ex);
|
|
|
- System.out.println(ex.getOriginalException());
|
|
|
- System.out.println(ex.getCode());
|
|
|
- if(ex instanceof PreScriptException)
|
|
|
+ @Override
|
|
|
+ public void printException(SnuviException ex, Script s)
|
|
|
+ {
|
|
|
+ System.out.println("Exception " + ex);
|
|
|
+ System.out.println(ex.getOriginalException());
|
|
|
+ System.out.println(ex.getCode());
|
|
|
+ if(ex instanceof PreScriptException)
|
|
|
+ {
|
|
|
+ System.out.println(((PreScriptException) ex).getException());
|
|
|
+ }
|
|
|
+ System.out.println(ex.getLine());
|
|
|
+ System.out.println(ex.getScriptName());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void printException(SnuviException ex)
|
|
|
{
|
|
|
- System.out.println(((PreScriptException) ex).getException());
|
|
|
+ System.out.println("Exception " + ex);
|
|
|
+ System.out.println(ex.getOriginalException());
|
|
|
+ System.out.println(ex.getCode());
|
|
|
+ if(ex instanceof PreScriptException)
|
|
|
+ {
|
|
|
+ System.out.println(((PreScriptException) ex).getException());
|
|
|
+ }
|
|
|
+ System.out.println(ex.getLine());
|
|
|
+ System.out.println(ex.getScriptName());
|
|
|
}
|
|
|
- System.out.println(ex.getLine());
|
|
|
- System.out.println(ex.getScriptName());
|
|
|
}, new ISnuviScheduler()
|
|
|
{
|
|
|
@Override
|
|
@@ -39,8 +58,9 @@ public class SnuviScript
|
|
|
});
|
|
|
parser.registerConsumer("debug", (o, sc) -> System.out.println(o[0]));
|
|
|
parser.registerFunction("ggv", (o, sc) -> o[0]);
|
|
|
+ parser.registerFunction("read.item", (o, sc) -> o[0]);
|
|
|
|
|
|
- StringBuilder sb = new StringBuilder("wusi = 1;\n");
|
|
|
+ /*StringBuilder sb = new StringBuilder("wusi = 1;\n");
|
|
|
int counter = 0;
|
|
|
for(int i = 0; i < 1000; i++)
|
|
|
{
|
|
@@ -58,23 +78,16 @@ public class SnuviScript
|
|
|
counter = 0;
|
|
|
}
|
|
|
}
|
|
|
- sb.append("debug(wusi);");
|
|
|
+ sb.append("debug(wusi);");*/
|
|
|
|
|
|
- /*String s = "i = 3;\n" +
|
|
|
-"while(i < 10)\n" +
|
|
|
-"{\n" +
|
|
|
-" j = 5;\n" +
|
|
|
-" debug(i);\n" +
|
|
|
-" while(j < 10)\n" +
|
|
|
-" {\n" +
|
|
|
-" debug(j);\n" +
|
|
|
-" j += 1;\n" +
|
|
|
-" }\n" +
|
|
|
-" i += 1;\n" +
|
|
|
-"}";*/
|
|
|
+ String s = "setVar(\"kürbis\",read.item(\"{id:'minecraft:pumpki"
|
|
|
+ + "n_pie',Count:64b,tag:{display:{Lore:[0:'Ein fast ganze"
|
|
|
+ + "r Kürbiskuchen,',1:'bestehend aus sieben Achteln.'],Nam"
|
|
|
+ + "e:'KürbisMinusEinAchtelKuchen'}},Damage:0s}\")); debug(kürbis);";
|
|
|
//System.out.println(s);
|
|
|
//System.out.println("___________");
|
|
|
- parser.startScript(Script.class, "test", sb.toString(), true);
|
|
|
- //parser.startScript(Script.class, "test", s, true);
|
|
|
+ //parser.startScript(Script.class, "test", sb.toString(), true);
|
|
|
+ parser.startScript(Script.class, "test", s, true);
|
|
|
+ //parser.getScript(0).runCode();
|
|
|
}
|
|
|
}
|