From c2e681bbde4b4fedafebc01e83b861e0ba31f918 Mon Sep 17 00:00:00 2001 From: LadyCailin Date: Wed, 18 Feb 2026 13:50:00 +0100 Subject: [PATCH 1/2] Add GenericParameters to exec signature. This change adds GenericParameters to Function.exec. This is currently unused, but will be used once the genericsTake2 branch is merged in. This is a backwards incompatible change in general, and extensions will not be able to recompile with this change in. However, the call sites for all uses of general exec have been updated to use reflection to fall back to the old 3 argument version if the new method call fails. All core classes have been updated, which also necessitated changes to caller sites in some places as well. --- src/main/java/com/laytonsmith/core/Main.java | 8 +- .../core/MethodScriptCompiler.java | 2 +- .../java/com/laytonsmith/core/Script.java | 2 +- .../java/com/laytonsmith/core/Updater.java | 2 +- .../com/laytonsmith/core/asm/AsmCompiler.java | 2 +- .../laytonsmith/core/asm/LLVMFunction.java | 6 +- .../laytonsmith/core/constructs/CArray.java | 10 +- .../core/constructs/CResource.java | 2 +- .../laytonsmith/core/constructs/CSlice.java | 2 +- .../core/events/drivers/PlayerEvents.java | 4 +- .../core/functions/ArrayHandling.java | 111 ++++----- .../core/functions/BasicLogic.java | 79 +++--- .../laytonsmith/core/functions/BossBar.java | 17 +- .../core/functions/BukkitMetadata.java | 9 +- .../core/functions/ByteArrays.java | 47 ++-- .../laytonsmith/core/functions/Clipboard.java | 5 +- .../laytonsmith/core/functions/Cmdline.java | 61 ++--- .../laytonsmith/core/functions/Commands.java | 13 +- .../laytonsmith/core/functions/Compiler.java | 27 ++- .../core/functions/CompositeFunction.java | 3 +- .../core/functions/ControlFlow.java | 45 ++-- .../laytonsmith/core/functions/Crypto.java | 25 +- .../core/functions/DataHandling.java | 83 +++---- .../core/functions/DataTransformations.java | 17 +- .../com/laytonsmith/core/functions/Debug.java | 21 +- .../laytonsmith/core/functions/Easings.java | 5 +- .../laytonsmith/core/functions/Echoes.java | 25 +- .../core/functions/Enchantments.java | 17 +- .../core/functions/EntityManagement.java | 147 +++++------ .../core/functions/Environment.java | 93 +++---- .../core/functions/EventBinding.java | 27 ++- .../core/functions/Exceptions.java | 11 +- .../core/functions/ExecutionQueue.java | 17 +- .../core/functions/ExtensionMeta.java | 13 +- .../core/functions/FileHandling.java | 21 +- .../laytonsmith/core/functions/Function.java | 50 +++- .../core/functions/InventoryManagement.java | 69 +++--- .../laytonsmith/core/functions/ItemMeta.java | 11 +- .../laytonsmith/core/functions/Marquee.java | 5 +- .../com/laytonsmith/core/functions/Math.java | 87 +++---- .../core/functions/MatrixHandling.java | 39 +-- .../com/laytonsmith/core/functions/Meta.java | 69 +++--- .../laytonsmith/core/functions/Minecraft.java | 37 +-- .../core/functions/MobManagement.java | 103 ++++---- .../com/laytonsmith/core/functions/OAuth.java | 15 +- .../com/laytonsmith/core/functions/OS.java | 3 +- .../core/functions/ObjectManagement.java | 11 +- .../core/functions/Performance.java | 3 +- .../core/functions/Permissions.java | 3 +- .../core/functions/Persistence.java | 11 +- .../core/functions/PlayerManagement.java | 229 +++++++++--------- .../core/functions/PluginMeta.java | 13 +- .../laytonsmith/core/functions/Recipes.java | 13 +- .../core/functions/Reflection.java | 23 +- .../com/laytonsmith/core/functions/Regex.java | 13 +- .../core/functions/ResourceManager.java | 5 +- .../com/laytonsmith/core/functions/SQL.java | 7 +- .../laytonsmith/core/functions/Sandbox.java | 17 +- .../core/functions/Scheduling.java | 23 +- .../core/functions/Scoreboards.java | 43 ++-- .../core/functions/Statistics.java | 13 +- .../core/functions/StringHandling.java | 59 ++--- .../core/functions/TaskHandling.java | 5 +- .../laytonsmith/core/functions/Threading.java | 25 +- .../laytonsmith/core/functions/Trades.java | 15 +- .../laytonsmith/core/functions/Weather.java | 11 +- .../com/laytonsmith/core/functions/Web.java | 11 +- .../com/laytonsmith/core/functions/World.java | 79 +++--- .../com/laytonsmith/core/functions/XGUI.java | 9 +- .../core/functions/asm/Cmdline.java | 5 +- .../core/functions/asm/Compiler.java | 5 +- .../core/functions/asm/DataHandling.java | 3 +- .../laytonsmith/core/functions/asm/Math.java | 3 +- .../laytonsmith/core/functions/asm/Meta.java | 3 +- .../com/laytonsmith/tools/Interpreter.java | 8 +- .../tools/docgen/DocGenTemplates.java | 4 +- .../laytonsmith/tools/pnviewer/PNViewer.java | 2 +- .../core/functions/ArrayHandlingTest.java | 26 +- .../core/functions/BasicLogicTest.java | 44 ++-- .../core/functions/EchoesTest.java | 8 +- .../laytonsmith/core/functions/MathTest.java | 84 +++---- .../core/functions/StringHandlingTest.java | 36 +-- .../com/laytonsmith/testing/RandomTests.java | 2 +- .../com/laytonsmith/testing/StaticTest.java | 6 +- 84 files changed, 1228 insertions(+), 1119 deletions(-) diff --git a/src/main/java/com/laytonsmith/core/Main.java b/src/main/java/com/laytonsmith/core/Main.java index cced2bcd21..ee7b328594 100644 --- a/src/main/java/com/laytonsmith/core/Main.java +++ b/src/main/java/com/laytonsmith/core/Main.java @@ -335,9 +335,9 @@ public ArgumentParser getArgumentParser() { @Override public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exception { - String buildYear = new Scheduling.simple_date().exec(Target.UNKNOWN, null, + String buildYear = new Scheduling.simple_date().exec(Target.UNKNOWN, null, null, new CString("yyyy", Target.UNKNOWN), - new Meta.engine_build_date().exec(Target.UNKNOWN, null)).val(); + new Meta.engine_build_date().exec(Target.UNKNOWN, null, null)).val(); StreamUtils.GetSystemOut().println("The MIT License (MIT)\n" + "\n" + "Copyright (c) 2012-" + buildYear + " Methodscript Contributors\n" @@ -594,7 +594,7 @@ public static void CreateNewFiles(List files, boolean force) throws IOEx + "\tstrict;" + li + "\tname: " + f.getName() + ";" + li + "\tauthor: " + System.getProperty("user.name") + ";" + li - + "\tcreated: " + new Scheduling.simple_date().exec(Target.UNKNOWN, null, new CString("yyyy-MM-dd", Target.UNKNOWN)).val() + ";" + li + + "\tcreated: " + new Scheduling.simple_date().exec(Target.UNKNOWN, null, null, new CString("yyyy-MM-dd", Target.UNKNOWN)).val() + ";" + li + "\tdescription: " + ";" + li + ">" + li + li, f, true); } @@ -641,7 +641,7 @@ public void execute(ArgumentParser.ArgumentParserResults parsedArgs) throws Exce classSimpleName = split[split.length - 1]; String author = System.getProperty("user.name"); - String created = new Scheduling.simple_date().exec(Target.UNKNOWN, null, + String created = new Scheduling.simple_date().exec(Target.UNKNOWN, null, null, new CString("yyyy-MM-dd", Target.UNKNOWN)).val(); File file = new File(clazz.replace(".", "/") + ".ms"); if(file.exists()) { diff --git a/src/main/java/com/laytonsmith/core/MethodScriptCompiler.java b/src/main/java/com/laytonsmith/core/MethodScriptCompiler.java index 8858208ec7..1016308acb 100644 --- a/src/main/java/com/laytonsmith/core/MethodScriptCompiler.java +++ b/src/main/java/com/laytonsmith/core/MethodScriptCompiler.java @@ -2699,7 +2699,7 @@ private static void optimize(ParseTree tree, Environment env, + tree.getData().val(), tree.getData().getTarget())); result = null; } else { - result = func.exec(tree.getData().getTarget(), env, constructs); + result = Function.ExecuteFunction(func, tree.getData().getTarget(), env, constructs); } } else if(isValidNumArgs(func, constructs.length)) { result = ((Optimizable) func).optimize(tree.getData().getTarget(), env, constructs); diff --git a/src/main/java/com/laytonsmith/core/Script.java b/src/main/java/com/laytonsmith/core/Script.java index e57f6af57d..c73e3e6cc4 100644 --- a/src/main/java/com/laytonsmith/core/Script.java +++ b/src/main/java/com/laytonsmith/core/Script.java @@ -427,7 +427,7 @@ public Mixed eval(ParseTree c, final Environment env) throws CancelCommandExcept } Mixed ret; try { - ret = f.exec(m.getTarget(), env, args); + ret = Function.ExecuteFunction(f, m.getTarget(), env, args); } finally { if(p != null) { p.stop(); diff --git a/src/main/java/com/laytonsmith/core/Updater.java b/src/main/java/com/laytonsmith/core/Updater.java index a4f07111de..9c58fbbf40 100644 --- a/src/main/java/com/laytonsmith/core/Updater.java +++ b/src/main/java/com/laytonsmith/core/Updater.java @@ -43,7 +43,7 @@ public static BuildArtifact getLatestVersionInfo() throws ApiException, ParseExc } public static Boolean isUpdateAvailable() { - Mixed buildDate = new Meta.engine_build_date().exec(null, null, (Mixed[]) null); + Mixed buildDate = new Meta.engine_build_date().exec(null, null, null, (Mixed[]) null); if(buildDate instanceof CNull) { return null; } diff --git a/src/main/java/com/laytonsmith/core/asm/AsmCompiler.java b/src/main/java/com/laytonsmith/core/asm/AsmCompiler.java index 5595fbe768..891f8be1ed 100644 --- a/src/main/java/com/laytonsmith/core/asm/AsmCompiler.java +++ b/src/main/java/com/laytonsmith/core/asm/AsmCompiler.java @@ -554,7 +554,7 @@ public static IRData getIR(IRBuilder builder, ParseTree node, Environment env) t if(fb instanceof LLVMFunction f) { builder.functionsUsed.add(f); return f.buildIR(builder, node.getTarget(), env, - node.getChildren().toArray(new ParseTree[node.getChildren().size()])); + null, node.getChildren().toArray(new ParseTree[node.getChildren().size()])); } else { throw new Error("Unexpected function type"); } diff --git a/src/main/java/com/laytonsmith/core/asm/LLVMFunction.java b/src/main/java/com/laytonsmith/core/asm/LLVMFunction.java index bf25a3f810..f74d46f15b 100644 --- a/src/main/java/com/laytonsmith/core/asm/LLVMFunction.java +++ b/src/main/java/com/laytonsmith/core/asm/LLVMFunction.java @@ -15,6 +15,7 @@ import com.laytonsmith.core.constructs.CClassType; import com.laytonsmith.core.constructs.CFunction; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.ConfigCompileException; import com.laytonsmith.core.exceptions.ConfigRuntimeException; @@ -106,7 +107,7 @@ public Boolean runAsync() { } @Override - public final Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public final Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { throw new UnsupportedOperationException("Not supported."); } @@ -228,12 +229,13 @@ public int compareTo(Function o) { * @param builder The ongoing builder. Functions should append to this as needed. * @param t The code target this node comes from. * @param env The Environment + * @param parameters Generic parameters passed to this function call. * @param nodes The children passed to this function, could be empty array. * @return Information on the returned value, including things like type (if known) and how to reference the * output value. * @throws com.laytonsmith.core.exceptions.ConfigCompileException If there is a compilation error. */ - public abstract IRData buildIR(IRBuilder builder, Target t, Environment env, ParseTree... nodes) throws ConfigCompileException; + public abstract IRData buildIR(IRBuilder builder, Target t, Environment env, GenericParameters parameters, ParseTree... nodes) throws ConfigCompileException; @Override public final boolean useSpecialExec() { diff --git a/src/main/java/com/laytonsmith/core/constructs/CArray.java b/src/main/java/com/laytonsmith/core/constructs/CArray.java index 07a05ad31b..3e603f41ef 100644 --- a/src/main/java/com/laytonsmith/core/constructs/CArray.java +++ b/src/main/java/com/laytonsmith/core/constructs/CArray.java @@ -823,7 +823,7 @@ public boolean canBeAssociative() { @Override public Mixed slice(int begin, int end, Target t) { - return new ArrayHandling.array_get().exec(t, null, new CSlice(begin, end, t)); + return new ArrayHandling.array_get().exec(t, null, null, new CSlice(begin, end, t)); } @Override @@ -923,13 +923,13 @@ public int compare(Mixed o1, Mixed o2) { } public int compareRegular(Mixed o1, Mixed o2) { - if(ArgumentValidation.getBooleanObject(new DataHandling.is_numeric().exec(Target.UNKNOWN, null, o1), Target.UNKNOWN) - && ArgumentValidation.getBooleanObject(new DataHandling.is_numeric().exec(Target.UNKNOWN, null, o2), Target.UNKNOWN)) { + if(ArgumentValidation.getBooleanObject(new DataHandling.is_numeric().exec(Target.UNKNOWN, null, null, o1), Target.UNKNOWN) + && ArgumentValidation.getBooleanObject(new DataHandling.is_numeric().exec(Target.UNKNOWN, null, null, o2), Target.UNKNOWN)) { return compareNumeric(o1, o2); - } else if(ArgumentValidation.getBooleanObject(new DataHandling.is_numeric().exec(Target.UNKNOWN, null, o1), Target.UNKNOWN)) { + } else if(ArgumentValidation.getBooleanObject(new DataHandling.is_numeric().exec(Target.UNKNOWN, null, null, o1), Target.UNKNOWN)) { //The first is a number, the second is a string return -1; - } else if(ArgumentValidation.getBooleanObject(new DataHandling.is_numeric().exec(Target.UNKNOWN, null, o2), Target.UNKNOWN)) { + } else if(ArgumentValidation.getBooleanObject(new DataHandling.is_numeric().exec(Target.UNKNOWN, null, null, o2), Target.UNKNOWN)) { //The second is a number, the first is a string return 1; } else { diff --git a/src/main/java/com/laytonsmith/core/constructs/CResource.java b/src/main/java/com/laytonsmith/core/constructs/CResource.java index 4806972cc8..7967b75a1c 100644 --- a/src/main/java/com/laytonsmith/core/constructs/CResource.java +++ b/src/main/java/com/laytonsmith/core/constructs/CResource.java @@ -106,7 +106,7 @@ public Version since() { @Override public void msFinalize() { - new res_free_resource().exec(new Target(0, new File("/Finalizer"), 0), null, this); + new res_free_resource().exec(new Target(0, new File("/Finalizer"), 0), null, null, this); } public static interface ResourceToString { diff --git a/src/main/java/com/laytonsmith/core/constructs/CSlice.java b/src/main/java/com/laytonsmith/core/constructs/CSlice.java index 26a539f7b3..67c682c3fd 100644 --- a/src/main/java/com/laytonsmith/core/constructs/CSlice.java +++ b/src/main/java/com/laytonsmith/core/constructs/CSlice.java @@ -69,7 +69,7 @@ public CSlice(long from, long to, Target t) { @Override public List asList() { - CArray ca = new ArrayHandling.range().exec(Target.UNKNOWN, null, new CInt(start, Target.UNKNOWN), new CInt(finish, Target.UNKNOWN)); + CArray ca = new ArrayHandling.range().exec(Target.UNKNOWN, null, null, new CInt(start, Target.UNKNOWN), new CInt(finish, Target.UNKNOWN)); return ca.asList(); } diff --git a/src/main/java/com/laytonsmith/core/events/drivers/PlayerEvents.java b/src/main/java/com/laytonsmith/core/events/drivers/PlayerEvents.java index f813248389..76fc82986b 100644 --- a/src/main/java/com/laytonsmith/core/events/drivers/PlayerEvents.java +++ b/src/main/java/com/laytonsmith/core/events/drivers/PlayerEvents.java @@ -1793,7 +1793,7 @@ public boolean matches(String key, Mixed value, MCPlayerCommandEvent event, Targ String command = event.getCommand(); String prefilter = value.val(); StringHandling.parse_args pa = new StringHandling.parse_args(); - CArray ca = (CArray) pa.exec(Target.UNKNOWN, null, new CString(command, Target.UNKNOWN)); + CArray ca = (CArray) pa.exec(Target.UNKNOWN, null, null, new CString(command, Target.UNKNOWN)); if(ca.size() > 0) { if(!ca.get(0, Target.UNKNOWN).val().equals(prefilter)) { return false; @@ -1831,7 +1831,7 @@ public Map evaluate(BindableEvent e) throws EventException { map.put("command", new CString(event.getCommand(), Target.UNKNOWN)); StringHandling.parse_args pa = new StringHandling.parse_args(); - CArray ca = (CArray) pa.exec(Target.UNKNOWN, null, new CString(event.getCommand(), Target.UNKNOWN)); + CArray ca = (CArray) pa.exec(Target.UNKNOWN, null, null, new CString(event.getCommand(), Target.UNKNOWN)); map.put("prefix", new CString(ca.get(0, Target.UNKNOWN).val(), Target.UNKNOWN)); return map; diff --git a/src/main/java/com/laytonsmith/core/functions/ArrayHandling.java b/src/main/java/com/laytonsmith/core/functions/ArrayHandling.java index 2cdd7bf802..a4923e7303 100644 --- a/src/main/java/com/laytonsmith/core/functions/ArrayHandling.java +++ b/src/main/java/com/laytonsmith/core/functions/ArrayHandling.java @@ -33,6 +33,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.environments.StaticRuntimeEnv; @@ -90,7 +91,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { // TODO: It's far too late to deprecate this, but this method and length() are aliases, so // we should at least harmonize the implementations. if(args[0] instanceof Sizeable s) { @@ -166,7 +167,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed index; Mixed defaultConstruct = null; if(args.length >= 2) { @@ -429,7 +430,7 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CArray.TYPE)) { try { ((CArray) args[0]).set(args[1], args[2], t); @@ -514,7 +515,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length < 2) { throw new CREInsufficientArgumentsException( "At least 2 arguments must be provided to " + this.getName(), t); @@ -616,7 +617,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); Mixed value = args[1]; int index = ArgumentValidation.getInt32(args[2], t); @@ -709,7 +710,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { ArrayAccess aa; if(args[0] instanceof ArrayAccess) { aa = (ArrayAccess) args[0]; @@ -718,7 +719,7 @@ public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommand aa = ca; } for(Mixed key : aa.keySet()) { - if(new equals().exec(t, env, aa.get(key, t), args[1]).getBoolean()) { + if(new equals().exec(t, env, null, aa.get(key, t), args[1]).getBoolean()) { return CBoolean.TRUE; } } @@ -820,7 +821,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { ArrayAccess aa; if(args[0] instanceof ArrayAccess a) { aa = a; @@ -828,7 +829,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi aa = ArgumentValidation.getArray(args[0], t); } for(Mixed key : aa.keySet()) { - if(new equals_ic().exec(t, environment, aa.get(key, t), args[1]).getBoolean()) { + if(new equals_ic().exec(t, environment, null, aa.get(key, t), args[1]).getBoolean()) { return CBoolean.TRUE; } } @@ -874,7 +875,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { ArrayAccess aa; if(args[0] instanceof ArrayAccess a) { aa = a; @@ -882,7 +883,7 @@ public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommand aa = ArgumentValidation.getArray(args[0], t); } for(Mixed key : aa.keySet()) { - if(new sequals().exec(t, env, aa.get(key, t), args[1]).getBoolean()) { + if(new sequals().exec(t, env, null, aa.get(key, t), args[1]).getBoolean()) { return CBoolean.TRUE; } } @@ -990,7 +991,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CArray.TYPE)) { Mixed m = args[0]; for(int i = 1; i < args.length; i++) { @@ -1109,7 +1110,7 @@ public Boolean runAsync() { } @Override - public CArray exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public CArray exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CArray.TYPE) && args[1].isInstanceOf(CInt.TYPE)) { CArray original = (CArray) args[0]; int size = (int) ((CInt) args[1]).getInt(); @@ -1198,7 +1199,7 @@ public Boolean runAsync() { } @Override - public CArray exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public CArray exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { long start = 0; long finish = 0; long increment = 1; @@ -1279,7 +1280,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { // As an exception, strings aren't supported here. There's no reason to do this for a string that isn't accidental. if(args[0].isInstanceOf(ArrayAccess.TYPE) && !(args[0].isInstanceOf(CString.TYPE))) { ArrayAccess ca = (ArrayAccess) args[0]; @@ -1346,7 +1347,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CArray.TYPE)) { CArray ca = ArgumentValidation.getArray(args[0], t); CArray ca2 = new CArray(t); @@ -1414,7 +1415,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray newArray = new CArray(t); if(args.length < 2) { throw new CREInsufficientArgumentsException("array_merge must be called with at least two parameters", t); @@ -1500,7 +1501,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); if(array.isAssociative()) { return array.remove(args[1]); @@ -1564,7 +1565,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!(args[0].isInstanceOf(ArrayAccess.TYPE))) { throw new CRECastException("Expecting argument 1 to be an ArrayAccess type object", t); } @@ -1620,7 +1621,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); String innerGlue = ArgumentValidation.getString(args[1], t); String outerGlue = ArgumentValidation.getString(args[2], t); @@ -1713,7 +1714,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CSlice(ArgumentValidation.getInt(args[0], t), ArgumentValidation.getInt(args[1], t), t); } @@ -1754,7 +1755,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!(args[0].isInstanceOf(CArray.TYPE))) { throw new CRECastException("The first parameter to array_sort must be an array", t); } @@ -1991,7 +1992,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { startup(); final CArray array = ArgumentValidation.getArray(args[0], t); final CString sortType = new CString(args.length > 2 ? args[1].val() : CArray.ArraySortType.REGULAR.name(), t); @@ -2000,7 +2001,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi @Override public void run() { - Mixed c = new array_sort().exec(Target.UNKNOWN, null, array, sortType); + Mixed c = new array_sort().exec(Target.UNKNOWN, null, null, array, sortType); callback.executeCallable(environment, t, new Mixed[]{c}); } }); @@ -2051,7 +2052,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); //This needs to be in terms of array_remove, to ensure that the iteration //logic is followed. We will iterate backwards, however, to make the @@ -2061,7 +2062,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi } else { for(long i = array.size() - 1; i >= 0; i--) { if(BasicLogic.equals.doEquals(array.get(i, t), args[1])) { - new array_remove().exec(t, environment, array, new CInt(i, t)); + new array_remove().exec(t, environment, null, array, new CInt(i, t)); } } } @@ -2120,7 +2121,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!(args[0].isInstanceOf(CArray.TYPE))) { throw new CRECastException("Expected parameter 1 to be an array, but was " + args[0].val(), t); } @@ -2183,8 +2184,8 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { - CArray ca = (CArray) new array_indexes().exec(t, environment, args); + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { + CArray ca = (CArray) new array_indexes().exec(t, environment, generics, args); if(ca.isEmpty()) { return CNull.NULL; } else { @@ -2242,8 +2243,8 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { - CArray ca = (CArray) new array_indexes().exec(t, environment, args); + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { + CArray ca = (CArray) new array_indexes().exec(t, environment, generics, args); if(ca.isEmpty()) { return CNull.NULL; } else { @@ -2301,7 +2302,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CArray.TYPE)) { ((CArray) args[0]).reverse(t); } @@ -2361,7 +2362,7 @@ public Boolean runAsync() { Random r = new Random(System.currentTimeMillis()); @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { long number = 1; boolean getKeys = true; CArray array = ArgumentValidation.getArray(args[0], t); @@ -2466,7 +2467,7 @@ public Boolean runAsync() { } @Override - public CArray exec(final Target t, final Environment environment, Mixed... args) throws ConfigRuntimeException { + public CArray exec(final Target t, final Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); boolean compareTypes = true; if(args.length == 2) { @@ -2482,8 +2483,8 @@ public CArray exec(final Target t, final Environment environment, Mixed... args) @Override public boolean checkIfEquals(Mixed item1, Mixed item2) { - return (fCompareTypes && ArgumentValidation.getBoolean(sequals.exec(t, environment, item1, item2), t)) - || (!fCompareTypes && ArgumentValidation.getBoolean(equals.exec(t, environment, item1, item2), t)); + return (fCompareTypes && ArgumentValidation.getBoolean(sequals.exec(t, environment, null, item1, item2), t)) + || (!fCompareTypes && ArgumentValidation.getBoolean(equals.exec(t, environment, null, item1, item2), t)); } }); for(Mixed c : set) { @@ -2553,7 +2554,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { com.laytonsmith.core.natives.interfaces.Iterable array; CClosure closure; if(!(args[0] instanceof com.laytonsmith.core.natives.interfaces.Iterable)) { @@ -2656,7 +2657,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length != 1) { throw new CREInsufficientArgumentsException("Expecting exactly one argument", t); } @@ -2724,7 +2725,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length != 1) { throw new CREInsufficientArgumentsException("Expecting exactly one argument", t); } @@ -2797,7 +2798,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { ArrayAccess aa; if(args[0] instanceof CFixedArray fa) { aa = fa; @@ -2875,7 +2876,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); CClosure closure = ArgumentValidation.getObject(args[1], t, CClosure.class); if(array.isEmpty()) { @@ -2960,7 +2961,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); CClosure closure = ArgumentValidation.getObject(args[1], t, CClosure.class); if(array.isEmpty()) { @@ -3045,7 +3046,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); CClosure closure = ArgumentValidation.getObject(args[1], t, CClosure.class); for(Mixed c : array.keySet()) { @@ -3118,7 +3119,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); CClosure closure = ArgumentValidation.getObject(args[1], t, CClosure.class); for(Mixed c : array.keySet()) { @@ -3191,7 +3192,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); CClosure closure = ArgumentValidation.getObject(args[1], t, CClosure.class); CArray newArray = (array.isAssociative() ? CArray.GetAssociativeArray(t) : new CArray(t, (int) array.size())); @@ -3287,7 +3288,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray one = ArgumentValidation.getArray(args[0], t); CArray two = ArgumentValidation.getArray(args[1], t); CClosure closure = null; @@ -3330,14 +3331,14 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi for(int i = 0; i < k1.length; i++) { for(int j = 0; j < k2.length; j++) { if(associativeMode) { - if(equals.exec(t, environment, k1[i], k2[j]).getBoolean()) { + if(equals.exec(t, environment, null, k1[i], k2[j]).getBoolean()) { ret.set(k1[i], one.get(k1[i], t), t); continue i; } } else { if(closure == null) { if(comparisonFunction != null) { - if(ArgumentValidation.getBoolean(comparisonFunction.exec(t, environment, + if(ArgumentValidation.getBoolean(comparisonFunction.exec(t, environment, null, one.get(k1[i], t), two.get(k2[j], t) ), t)) { ret.push(one.get(k1[i], t), t); @@ -3474,7 +3475,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed constA = args[0]; Mixed constB = args[1]; if(!(constA.isInstanceOf(CArray.TYPE))) { @@ -3624,7 +3625,7 @@ public Class[] thrown() { Random rand = new Random(); @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); if(array.isEmpty()) { throw new CRELengthException("Array is empty", t); @@ -3679,7 +3680,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray one = ArgumentValidation.getArray(args[0], t); CArray two = ArgumentValidation.getArray(args[1], t); CClosure closure = null; @@ -3722,14 +3723,14 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi boolean addValue = true; for(int j = 0; j < k2.length; j++) { if(associativeMode) { - if(equals.exec(t, environment, k1[i], k2[j]).getBoolean()) { + if(equals.exec(t, environment, null, k1[i], k2[j]).getBoolean()) { addValue = false; break; } } else { if(closure == null) { if(comparisonFunction != null) { - if(ArgumentValidation.getBoolean(comparisonFunction.exec(t, environment, + if(ArgumentValidation.getBoolean(comparisonFunction.exec(t, environment, null, one.get(k1[i], t), two.get(k2[j], t) ), t)) { addValue = false; @@ -3817,7 +3818,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed fill = args[1]; if(args[0] instanceof CFixedArray fa) { fa.fill(fill, t); @@ -3873,7 +3874,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { ArgumentValidation.getArray(args[0], t).clear(); return CVoid.VOID; } diff --git a/src/main/java/com/laytonsmith/core/functions/BasicLogic.java b/src/main/java/com/laytonsmith/core/functions/BasicLogic.java index 0640280275..e7ce19f552 100644 --- a/src/main/java/com/laytonsmith/core/functions/BasicLogic.java +++ b/src/main/java/com/laytonsmith/core/functions/BasicLogic.java @@ -29,6 +29,7 @@ import com.laytonsmith.core.constructs.CSymbol; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -71,7 +72,7 @@ public static class equals extends AbstractFunction implements Optimizable { * @return */ public static boolean doEquals(Mixed one, Mixed two) { - CBoolean ret = SELF.exec(Target.UNKNOWN, null, one, two); + CBoolean ret = SELF.exec(Target.UNKNOWN, null, null, one, two); return ret.getBoolean(); } @@ -86,7 +87,7 @@ public Integer[] numArgs() { } @Override - public CBoolean exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args.length <= 1) { throw new CREInsufficientArgumentsException("At least two arguments must be passed to equals", t); } @@ -254,7 +255,7 @@ public Boolean runAsync() { } @Override - public CBoolean exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CBoolean exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length != 2) { throw new CREFormatException(this.getName() + " expects 2 arguments.", t); } @@ -264,7 +265,7 @@ public CBoolean exec(Target t, Environment environment, Mixed... args) throws Co // for numeric strings. Thus '2' !== '2.0' return CBoolean.get(args[0].val().equals(args[1].val())); } - return new equals().exec(t, environment, args); + return new equals().exec(t, environment, null, args); } else { return CBoolean.FALSE; } @@ -332,8 +333,8 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { - return new sequals().exec(t, environment, args).not(); + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { + return new sequals().exec(t, environment, null, args).not(); } @Override @@ -410,8 +411,8 @@ public Boolean runAsync() { } @Override - public CBoolean exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { - return new equals().exec(t, env, args).not(); + public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { + return new equals().exec(t, env, null, args).not(); } @Override @@ -480,7 +481,7 @@ public Boolean runAsync() { } @Override - public CBoolean exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length <= 1) { throw new CREInsufficientArgumentsException("At least two arguments must be passed to equals_ic", t); } @@ -574,13 +575,13 @@ public Boolean runAsync() { } @Override - public CBoolean exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CBoolean exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed v1 = args[0]; Mixed v2 = args[1]; if(!v2.getClass().equals(v1.getClass())) { return CBoolean.FALSE; } - return new equals_ic().exec(t, environment, v1, v2); + return new equals_ic().exec(t, environment, null, v1, v2); } @Override @@ -673,8 +674,8 @@ public Boolean runAsync() { } @Override - public CBoolean exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { - return new equals_ic().exec(t, environment, args).not(); + public CBoolean exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { + return new equals_ic().exec(t, environment, null, args).not(); } @Override @@ -720,11 +721,11 @@ public Boolean runAsync() { } @Override - public CBoolean exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CBoolean exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CArray.TYPE) && args[1].isInstanceOf(CArray.TYPE)) { return CBoolean.get(args[0] == args[1]); } else { - return new equals().exec(t, environment, args); + return new equals().exec(t, environment, null, args); } } @@ -792,7 +793,7 @@ public Integer[] numArgs() { } @Override - public CBoolean exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args.length != 2) { throw new CREFormatException(this.getName() + " expects 2 arguments.", t); } @@ -866,7 +867,7 @@ public Integer[] numArgs() { } @Override - public CBoolean exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args.length != 2) { throw new CREFormatException(this.getName() + " expects 2 arguments.", t); } @@ -940,7 +941,7 @@ public Integer[] numArgs() { } @Override - public CBoolean exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args.length != 2) { throw new CREFormatException(this.getName() + " expects 2 arguments.", t); } @@ -1015,7 +1016,7 @@ public Integer[] numArgs() { } @Override - public CBoolean exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args.length != 2) { throw new CREFormatException(this.getName() + " expects 2 arguments.", t); } @@ -1091,7 +1092,7 @@ public Integer[] numArgs() { } @Override - public CBoolean exec(Target t, Environment env, Mixed... args) { + public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixed... args) { //This will only happen if they hardcode true/false in, but we still //need to handle it appropriately. for(Mixed c : args) { @@ -1252,7 +1253,7 @@ public boolean useSpecialExec() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -1384,7 +1385,7 @@ public Integer[] numArgs() { } @Override - public CBoolean exec(Target t, Environment env, Mixed... args) { + public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixed... args) { //This will only happen if they hardcode true/false in, but we still //need to handle it appropriately. for(Mixed c : args) { @@ -1548,7 +1549,7 @@ public boolean useSpecialExec() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -1644,7 +1645,7 @@ public Integer[] numArgs() { } @Override - public CBoolean exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args.length != 1) { throw new CREFormatException(this.getName() + " expects 1 argument.", t); } @@ -1748,7 +1749,7 @@ public Boolean runAsync() { } @Override - public CBoolean exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CBoolean exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length != 2) { throw new CREFormatException(this.getName() + " expects 2 arguments.", t); } @@ -1822,7 +1823,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) { return CNull.NULL; } @@ -1897,7 +1898,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) { return CNull.NULL; } @@ -1972,11 +1973,11 @@ public Boolean runAsync() { } @Override - public CBoolean exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CBoolean exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length != 2) { throw new CREFormatException(this.getName() + " expects 2 arguments.", t); } - return new xor().exec(t, environment, args).not(); + return new xor().exec(t, environment, null, args).not(); } @Override @@ -2044,7 +2045,7 @@ public Boolean runAsync() { } @Override - public CInt exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CInt exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length < 2) { throw new CREFormatException(this.getName() + " expects at least 2 arguments.", t); } @@ -2131,7 +2132,7 @@ public Boolean runAsync() { } @Override - public CInt exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CInt exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length < 2) { throw new CREFormatException(this.getName() + " expects at least 2 arguments.", t); } @@ -2220,7 +2221,7 @@ public Boolean runAsync() { } @Override - public CInt exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CInt exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length < 2) { throw new CREFormatException(this.getName() + " expects at least 2 arguments.", t); } @@ -2305,7 +2306,7 @@ public Boolean runAsync() { } @Override - public CInt exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CInt exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length != 1) { throw new CREFormatException(this.getName() + " expects 1 argument.", t); } @@ -2371,7 +2372,7 @@ public Boolean runAsync() { } @Override - public CInt exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CInt exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length != 2) { throw new CREFormatException(this.getName() + " expects 2 arguments.", t); } @@ -2441,7 +2442,7 @@ public Boolean runAsync() { } @Override - public CInt exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CInt exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length != 2) { throw new CREFormatException(this.getName() + " expects 2 arguments.", t); } @@ -2513,7 +2514,7 @@ public Boolean runAsync() { } @Override - public CInt exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CInt exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length != 2) { throw new CREFormatException(this.getName() + " expects 2 arguments.", t); } @@ -2564,7 +2565,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -2644,7 +2645,7 @@ public Boolean runAsync() { } @Override - public CInt exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CInt exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt(args[0].hashCode(), t); } @@ -2705,7 +2706,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { double d1 = ArgumentValidation.getNumber(args[0], t); double d2 = ArgumentValidation.getNumber(args[1], t); double epsilon = ArgumentValidation.getDouble(args[2], t); diff --git a/src/main/java/com/laytonsmith/core/functions/BossBar.java b/src/main/java/com/laytonsmith/core/functions/BossBar.java index cdb67bf635..d1923a616a 100644 --- a/src/main/java/com/laytonsmith/core/functions/BossBar.java +++ b/src/main/java/com/laytonsmith/core/functions/BossBar.java @@ -16,6 +16,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -78,7 +79,7 @@ public Integer[] numArgs() { } @Override - public CArray exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public CArray exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ca = new CArray(t); for(String id : BARS.keySet()) { ca.push(new CString(id, t), t); @@ -120,7 +121,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String id = args[0].val(); if(BARS.containsKey(id)) { throw new CREIllegalArgumentException("That boss bar id is already in use.", t); @@ -202,7 +203,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String id = args[0].val(); MCBossBar bar = BARS.get(id); if(bar == null) { @@ -278,7 +279,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String id = args[0].val(); MCBossBar bar = BARS.get(id); if(bar == null) { @@ -319,7 +320,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String id = args[0].val(); MCBossBar bar = BARS.get(id); if(bar == null) { @@ -356,7 +357,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCBossBar bar = BARS.get(args[0].val()); if(bar == null) { throw new CRENotFoundException("That boss bar id does not exist.", t); @@ -390,7 +391,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCBossBar bar = BARS.get(args[0].val()); if(bar == null) { throw new CRENotFoundException("That boss bar id does not exist.", t); @@ -424,7 +425,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCBossBar bar = BARS.get(args[0].val()); if(bar == null) { throw new CRENotFoundException("That boss bar id does not exist.", t); diff --git a/src/main/java/com/laytonsmith/core/functions/BukkitMetadata.java b/src/main/java/com/laytonsmith/core/functions/BukkitMetadata.java index 820c9b13a8..d30985192c 100644 --- a/src/main/java/com/laytonsmith/core/functions/BukkitMetadata.java +++ b/src/main/java/com/laytonsmith/core/functions/BukkitMetadata.java @@ -16,6 +16,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREBadEntityException; @@ -107,7 +108,7 @@ public ExampleScript[] examples() throws ConfigCompileException { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { List metadata; if(args.length == 1) { metadata = Static.getPlayer(environment, t).getMetadata(args[0].val()); @@ -156,7 +157,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String key; MCMetadatable metadatable; if(args.length == 1) { @@ -213,7 +214,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String key; MCMetadatable metadatable; Mixed value; @@ -258,7 +259,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String key; MCMetadatable metadatable; if(args.length == 1) { diff --git a/src/main/java/com/laytonsmith/core/functions/ByteArrays.java b/src/main/java/com/laytonsmith/core/functions/ByteArrays.java index 15cb83bb1a..3d1a7c41b1 100644 --- a/src/main/java/com/laytonsmith/core/functions/ByteArrays.java +++ b/src/main/java/com/laytonsmith/core/functions/ByteArrays.java @@ -14,6 +14,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; import com.laytonsmith.core.exceptions.CRE.CREFormatException; @@ -52,7 +53,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CByteArray(t); } @@ -82,7 +83,7 @@ public String getName() { public static class ba_as_array extends ba { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = ArgumentValidation.getByteArray(args[0], t); return ba.asArray(t); } @@ -117,7 +118,7 @@ public String getName() { public static class ba_rewind extends ba { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); ba.rewind(); return CVoid.VOID; @@ -149,7 +150,7 @@ public String getName() { public static class ba_get_byte extends ba_get { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); Integer pos = get_getPos(args, t); try { @@ -181,7 +182,7 @@ public String getName() { public static class ba_get_char extends ba_get { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); Integer pos = get_getPos(args, t); try { @@ -213,7 +214,7 @@ public String getName() { public static class ba_get_short extends ba_get { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); Integer pos = get_getPos(args, t); try { @@ -244,7 +245,7 @@ public String getName() { public static class ba_get_int extends ba_get { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); Integer pos = get_getPos(args, t); try { @@ -276,7 +277,7 @@ public String getName() { public static class ba_get_long extends ba_get { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); Integer pos = get_getPos(args, t); try { @@ -308,7 +309,7 @@ public String getName() { public static class ba_get_float extends ba_get { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); Integer pos = get_getPos(args, t); try { @@ -340,7 +341,7 @@ public String getName() { public static class ba_get_double extends ba_get { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); Integer pos = get_getPos(args, t); try { @@ -376,7 +377,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); int size = ArgumentValidation.getInt32(args[1], t); Integer pos = null; @@ -412,7 +413,7 @@ public String getName() { public static class ba_get_string extends ba_get { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); Integer pos = get_getPos(args, t); String encoding = null; @@ -454,7 +455,7 @@ public String getName() { public static class ba_put_byte extends ba_put { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); byte b = ArgumentValidation.getInt8(args[1], t); Integer pos = set_getPos(args, t); @@ -489,7 +490,7 @@ public Class[] thrown() { public static class ba_put_char extends ba_put { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); String b = args[1].val(); char c = '\0'; @@ -523,7 +524,7 @@ public String getName() { public static class ba_put_short extends ba_put { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); short b = ArgumentValidation.getInt16(args[1], t); Integer pos = set_getPos(args, t); @@ -558,7 +559,7 @@ public Class[] thrown() { public static class ba_put_int extends ba_put { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); int b = ArgumentValidation.getInt32(args[1], t); Integer pos = set_getPos(args, t); @@ -592,7 +593,7 @@ public Class[] thrown() { public static class ba_put_long extends ba_put { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); long b = ArgumentValidation.getInt(args[1], t); Integer pos = set_getPos(args, t); @@ -622,7 +623,7 @@ public String getName() { public static class ba_put_float extends ba_put { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); float b = ArgumentValidation.getDouble32(args[1], t); Integer pos = set_getPos(args, t); @@ -657,7 +658,7 @@ public Class[] thrown() { public static class ba_put_double extends ba_put { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); double b = ArgumentValidation.getDouble(args[1], t); Integer pos = set_getPos(args, t); @@ -687,7 +688,7 @@ public String getName() { public static class ba_put_bytes extends ba_put { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray dest = getBA(args, t); CByteArray src = ArgumentValidation.getByteArray(args[1], t); Integer pos = set_getPos(args, t); @@ -717,7 +718,7 @@ public String getName() { public static class ba_put_string extends ba_put { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = getBA(args, t); String s = args[1].val(); Integer pos = set_getPos(args, t); @@ -775,7 +776,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = ArgumentValidation.getByteArray(args[0], t); boolean setLittle = ArgumentValidation.getBoolean(args[1], t); ba.setOrder(setLittle ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN); @@ -826,7 +827,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = ArgumentValidation.getByteArray(args[0], t); return CBoolean.get(ba.getOrder() == ByteOrder.LITTLE_ENDIAN); } diff --git a/src/main/java/com/laytonsmith/core/functions/Clipboard.java b/src/main/java/com/laytonsmith/core/functions/Clipboard.java index a19b672894..08a0e76f69 100644 --- a/src/main/java/com/laytonsmith/core/functions/Clipboard.java +++ b/src/main/java/com/laytonsmith/core/functions/Clipboard.java @@ -7,6 +7,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREFormatException; import com.laytonsmith.core.exceptions.CRE.CREIOException; @@ -64,7 +65,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Cmdline.requireCmdlineMode(environment, this, t); if(clipboard == null) { throw new CREUnsupportedOperationException( @@ -132,7 +133,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Cmdline.requireCmdlineMode(environment, this, t); if(clipboard == null) { throw new CREUnsupportedOperationException( diff --git a/src/main/java/com/laytonsmith/core/functions/Cmdline.java b/src/main/java/com/laytonsmith/core/functions/Cmdline.java index 8b86483d91..84d111ea5c 100644 --- a/src/main/java/com/laytonsmith/core/functions/Cmdline.java +++ b/src/main/java/com/laytonsmith/core/functions/Cmdline.java @@ -33,6 +33,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.environments.StaticRuntimeEnv; @@ -97,7 +98,7 @@ public Boolean runAsync() { } @Override - public CVoid exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CVoid exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String msg = Static.MCToANSIColors(args[0].val()); PrintStream out = StreamUtils.GetSystemOut(); out.print(msg); @@ -162,7 +163,7 @@ public Boolean runAsync() { } @Override - public CVoid exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CVoid exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String msg = Static.MCToANSIColors(args[0].val()); PrintStream se = StreamUtils.GetSystemErr(); se.print(msg); @@ -226,7 +227,7 @@ public Boolean runAsync() { } @Override - public CVoid exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CVoid exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String msg = Static.MCToANSIColors(args[0].val()); PrintStream so = StreamUtils.GetSystemOut(); so.print(msg); @@ -283,7 +284,7 @@ public Boolean runAsync() { } @Override - public CVoid exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CVoid exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String msg = Static.MCToANSIColors(args[0].val()); StreamUtils.GetSystemErr().print(msg); StreamUtils.GetSystemErr().flush(); @@ -338,7 +339,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int exit_code = 0; if(args.length == 1) { exit_code = ArgumentValidation.getInt32(args[0], t); @@ -346,7 +347,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi if(Static.InCmdLine(environment, true)) { System.exit(exit_code); } - return new ControlFlow.die().exec(t, environment, args); + return new ControlFlow.die().exec(t, environment, null, args); } @Override @@ -404,7 +405,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length == 1) { String propName = args[0].val(); String prop; @@ -510,7 +511,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length == 1) { return new CString(System.getenv(args[0].val()), t); } else { @@ -564,7 +565,7 @@ public Boolean runAsync() { @SuppressWarnings({"BroadCatchBlock", "TooBroadCatch", "UseSpecificCatch"}) @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { //TODO: Make this more robust by having a local cache of the environment which we modify, and get_env returns from. Map newenv = new HashMap<>(System.getenv()); newenv.put(args[0].val(), args[1].val()); @@ -655,7 +656,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!Static.InCmdLine(environment, true)) { throw new CREInsufficientPermissionException(getName() + " cannot be used outside of cmdline mode.", t); } @@ -733,7 +734,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { requireCmdlineMode(environment, this, t); String prompt = args[0].val(); @@ -806,7 +807,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!Static.InCmdLine(environment, true)) { throw new CREInsufficientPermissionException(getName() + " cannot be used outside of cmdline mode.", t); } @@ -865,7 +866,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { java.awt.Toolkit.getDefaultToolkit().beep(); return CVoid.VOID; } @@ -912,7 +913,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(Static.InCmdLine(environment, true)) { try { new jline.console.ConsoleReader().clearScreen(); @@ -967,7 +968,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(final Target t, final Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!Static.InCmdLine(environment, true)) { if(!Prefs.AllowShellCommands()) { throw new CREInsufficientPermissionException("Shell commands are not allowed. Enable them in preferences.ini.", t); @@ -1175,7 +1176,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!Static.InCmdLine(environment, true)) { if(!Prefs.AllowShellCommands()) { throw new CREInsufficientPermissionException("Shell commands are not allowed. Enable them in preferences.ini.", t); @@ -1314,7 +1315,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Set oses = new HashSet<>(); String osS = args[0].val(); for(String osSS : osS.split("\\|")) { @@ -1327,7 +1328,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi oses.add(os); } if(oses.contains(OSUtils.GetOS())) { - return new shell_adv().exec(t, environment, ArrayUtils.cast(ArrayUtils.slice(args, 1, args.length - 1), Construct[].class)); + return new shell_adv().exec(t, environment, null, ArrayUtils.cast(ArrayUtils.slice(args, 1, args.length - 1), Construct[].class)); } return CVoid.VOID; } @@ -1380,7 +1381,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Set oses = new HashSet<>(); String osS = args[0].val(); for(String osSS : osS.split("\\|")) { @@ -1393,7 +1394,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi oses.add(os); } if(oses.contains(OSUtils.GetOS())) { - return new shell().exec(t, environment, ArrayUtils.cast(ArrayUtils.slice(args, 1, args.length - 1), Construct[].class)); + return new shell().exec(t, environment, null, ArrayUtils.cast(ArrayUtils.slice(args, 1, args.length - 1), Construct[].class)); } return CNull.NULL; } @@ -1456,7 +1457,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CString(OSUtils.GetOS().name(), t); } @@ -1501,7 +1502,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!Static.InCmdLine(environment, true)) { throw new CREInsufficientPermissionException(getName() + " cannot be used outside of cmdline mode.", t); } @@ -1585,7 +1586,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { File root; if(Static.InCmdLine(environment, true)) { root = environment.getEnv(GlobalEnv.class).GetRootFolder(); @@ -1652,7 +1653,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { requireCmdlineMode(environment, this, t); File cd = Static.GetFileFromArgument(args.length == 0 ? null : args[0].val(), environment, t, new File(System.getProperty("user.home"))); if(!cd.exists()) { @@ -1704,7 +1705,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { requireCmdlineMode(environment, this, t); CArray ca = new CArray(t); File cwd = Static.GetFileFromArgument(args.length > 0 ? args[0].val() : null, environment, t, environment.getEnv(GlobalEnv.class).GetRootFolder()); @@ -1765,7 +1766,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { requireCmdlineMode(environment, this, t); if(!(args[0].isInstanceOf(CClosure.TYPE))) { throw new CRECastException("Expecting a closure for argument 1 of " + getName(), t); @@ -1818,7 +1819,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { requireCmdlineMode(environment, this, t); try { int i = new jline.console.ConsoleReader().getTerminal().getWidth(); @@ -1870,7 +1871,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String name = StaticLayer.GetConvertor().GetUser(environment); if(name == null) { return CNull.NULL; @@ -1922,7 +1923,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.GenerateCBoolean(Static.InCmdLine(environment, true), t); } @@ -1967,7 +1968,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { requireCmdlineMode(environment, this, t); final CArray a = new CArray(t); String regex = ArgumentValidation.getString(args[0], t); diff --git a/src/main/java/com/laytonsmith/core/functions/Commands.java b/src/main/java/com/laytonsmith/core/functions/Commands.java index 302391b584..52acefac68 100644 --- a/src/main/java/com/laytonsmith/core/functions/Commands.java +++ b/src/main/java/com/laytonsmith/core/functions/Commands.java @@ -17,6 +17,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -68,7 +69,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCServer s = Static.getServer(); MCCommandMap map = s.getCommandMap(); if(map == null) { @@ -164,7 +165,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandMap map = Static.getServer().getCommandMap(); if(map == null) { throw new CRENotFoundException(this.getName() + " is not supported in this mode (CommandMap not found).", t); @@ -225,7 +226,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandMap map = Static.getServer().getCommandMap(); if(map == null) { throw new CRENotFoundException( @@ -496,7 +497,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandMap map = Static.getServer().getCommandMap(); if(map == null) { throw new CRENotFoundException(this.getName() + " is not supported in this mode (CommandMap not found).", t); @@ -568,7 +569,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandMap map = Static.getServer().getCommandMap(); if(map == null) { return CNull.NULL; @@ -641,7 +642,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandMap map = Static.getServer().getCommandMap(); if(map != null) { map.clearCommands(); diff --git a/src/main/java/com/laytonsmith/core/functions/Compiler.java b/src/main/java/com/laytonsmith/core/functions/Compiler.java index 26a2ebee2b..238e923619 100644 --- a/src/main/java/com/laytonsmith/core/functions/Compiler.java +++ b/src/main/java/com/laytonsmith/core/functions/Compiler.java @@ -36,6 +36,7 @@ import com.laytonsmith.core.constructs.InstanceofUtil; import com.laytonsmith.core.constructs.Target; import com.laytonsmith.core.constructs.Token; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.environments.Environment.EnvironmentImpl; @@ -101,7 +102,7 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -154,7 +155,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CEntry(args[0], args[1], t); } } @@ -167,7 +168,7 @@ public static class __autoconcat__ extends DummyFunction { public static final String NAME = "__autoconcat__"; @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { throw new Error("Should not have gotten here, " + __autoconcat__.NAME + " was not removed before runtime."); } @@ -716,7 +717,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -782,7 +783,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { throw new CRENotFoundException("\"" + args[0].val() + "\" cannot be resolved to a type.", t); } @@ -910,7 +911,7 @@ public boolean isRestricted() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String s = null; if(args.length == 1) { s = args[0].val(); @@ -936,7 +937,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length == 0) { return CVoid.VOID; } @@ -949,7 +950,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi public static class __cbracket__ extends DummyFunction implements Optimizable { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { throw new UnsupportedOperationException("Not supported yet."); } @@ -985,7 +986,7 @@ public static class __cbrace__ extends DummyFunction implements Optimizable { public static final String NAME = "__cbrace__"; @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { throw new UnsupportedOperationException("Not supported yet."); } @@ -1066,8 +1067,8 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { - throw new UnsupportedOperationException(getName() + " should have been compiled out. If you are reaching" + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { + throw new UnsupportedOperationException(getName()+ " should have been compiled out. If you are reaching" + " this, an error has occurred in the parser. Please report this error to the developers."); } @@ -1240,7 +1241,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed value = args[0]; CClassType type = ArgumentValidation.getClassType(args[1], t); if(!InstanceofUtil.isInstanceof(value, type, env)) { @@ -1337,7 +1338,7 @@ public String getName() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { // Get arguments. CClassType type; diff --git a/src/main/java/com/laytonsmith/core/functions/CompositeFunction.java b/src/main/java/com/laytonsmith/core/functions/CompositeFunction.java index 30937cdf93..6461fb1999 100644 --- a/src/main/java/com/laytonsmith/core/functions/CompositeFunction.java +++ b/src/main/java/com/laytonsmith/core/functions/CompositeFunction.java @@ -16,6 +16,7 @@ import com.laytonsmith.core.constructs.IVariable; import com.laytonsmith.core.constructs.IVariableList; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.exceptions.ConfigCompileException; @@ -41,7 +42,7 @@ public abstract class CompositeFunction extends AbstractFunction { private static final Map, ParseTree> CACHED_SCRIPTS = new HashMap<>(); @Override - public final Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public final Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { ParseTree tree; // TODO: Ultimately, this is not scalable. We need to compile and cache these scripts at Java compile time, // not at runtime the first time a function is used. This is an easier first step though. diff --git a/src/main/java/com/laytonsmith/core/functions/ControlFlow.java b/src/main/java/com/laytonsmith/core/functions/ControlFlow.java index b571627e0e..04f273f6c9 100644 --- a/src/main/java/com/laytonsmith/core/functions/ControlFlow.java +++ b/src/main/java/com/laytonsmith/core/functions/ControlFlow.java @@ -52,6 +52,7 @@ import com.laytonsmith.core.constructs.IVariable; import com.laytonsmith.core.constructs.InstanceofUtil; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; @@ -127,7 +128,7 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) } @Override - public Mixed exec(Target t, Environment env, Mixed... args) + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return CVoid.VOID; } @@ -407,7 +408,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CNull.NULL; } @@ -636,7 +637,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CNull.NULL; } @@ -695,11 +696,11 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) return parent.seval(code, env); } } - } else if(equals.exec(t, env, value, inner).getBoolean()) { + } else if(equals.exec(t, env, null, value, inner).getBoolean()) { return parent.seval(code, env); } } - } else if(equals.exec(t, env, value, evalStatement).getBoolean()) { + } else if(equals.exec(t, env, null, value, evalStatement).getBoolean()) { return parent.seval(code, env); } } @@ -856,7 +857,7 @@ public ParseTree optimizeDynamic(Target t, Environment env, + " remove the duplicate value"; final BasicLogic.equals equals = new BasicLogic.equals(); Set values = new TreeSet<>((Mixed t1, Mixed t2) -> { - if(equals.exec(Target.UNKNOWN, null, t1, t2).getBoolean()) { + if(equals.exec(Target.UNKNOWN, null, null, t1, t2).getBoolean()) { return 0; } else { return t1.val().compareTo(t2.val()); @@ -943,7 +944,7 @@ public ParseTree optimizeDynamic(Target t, Environment env, break; } } - } else if(equals.exec(t, null, children.get(0).getData(), value).getBoolean()) { + } else if(equals.exec(t, null, null, children.get(0).getData(), value).getBoolean()) { toReturn = children.get(i + 1); break; } @@ -1006,7 +1007,7 @@ public List isScope(List children) { public static class switch_ic extends _switch implements Optimizable, BranchStatement, VariableScope { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { throw new Error(); } @@ -1093,7 +1094,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) { return CVoid.VOID; } @@ -1314,7 +1315,7 @@ public boolean useSpecialExec() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return null; } @@ -1469,7 +1470,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return CVoid.VOID; } @@ -1503,9 +1504,9 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) long finish = ((CSlice) arr).getFinish(); if(finish < start) { arr = new ArrayHandling.range() - .exec(t, env, new CInt(start, t), new CInt(finish - 1, t), new CInt(-1, t)); + .exec(t, env, null, new CInt(start, t), new CInt(finish - 1, t), new CInt(-1, t)); } else { - arr = new ArrayHandling.range().exec(t, env, new CInt(start, t), new CInt(finish + 1, t)); + arr = new ArrayHandling.range().exec(t, env, null, new CInt(start, t), new CInt(finish + 1, t)); } } if(!(arr instanceof com.laytonsmith.core.natives.interfaces.Iterable)) { @@ -2123,7 +2124,7 @@ public boolean useSpecialExec() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CNull.NULL; } @@ -2229,7 +2230,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CNull.NULL; } @@ -2471,7 +2472,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { int num = 1; if(args.length == 1) { @@ -2619,7 +2620,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { int num = 1; if(args.length == 1) { @@ -2756,7 +2757,7 @@ public Set optimizationOptions() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed ret = (args.length == 1 ? args[0] : CVoid.VOID); throw new FunctionReturnException(ret, t); } @@ -2813,7 +2814,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length < 1) { throw new CREInsufficientArgumentsException("Expecting at least one argument to " + getName(), t); } @@ -2863,7 +2864,7 @@ public ParseTree optimizeDynamic(Target t, Environment env, public static class call_proc_array extends call_proc { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ca = ArgumentValidation.getArray(args[1], t); if(ca.inAssociativeMode()) { throw new CRECastException("Expected the array passed to " + getName() + " to be non-associative.", t); @@ -2873,7 +2874,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi for(int i = 1; i < args2.length; i++) { args2[i] = ca.get(i - 1, t); } - return super.exec(t, environment, args2); + return super.exec(t, environment, null, args2); } @Override @@ -2924,7 +2925,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException { if(args.length == 0) { throw new CancelCommandException("", t); } diff --git a/src/main/java/com/laytonsmith/core/functions/Crypto.java b/src/main/java/com/laytonsmith/core/functions/Crypto.java index c27de8bcd8..17b3e89d8b 100644 --- a/src/main/java/com/laytonsmith/core/functions/Crypto.java +++ b/src/main/java/com/laytonsmith/core/functions/Crypto.java @@ -13,6 +13,7 @@ import com.laytonsmith.core.constructs.CSecureString; import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; import com.laytonsmith.core.exceptions.CRE.CREPluginInternalException; @@ -114,7 +115,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String s = args[0].val(); StringBuilder b = new StringBuilder(); for(int i = 0; i < s.length(); i++) { @@ -193,7 +194,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { byte[] val = getByteArrayFromArg(args[0]); MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); @@ -264,7 +265,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { byte[] val = getByteArrayFromArg(args[0]); MessageDigest digest = java.security.MessageDigest.getInstance("SHA1"); @@ -334,7 +335,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { byte[] val = getByteArrayFromArg(args[0]); MessageDigest digest = java.security.MessageDigest.getInstance("SHA-256"); @@ -405,7 +406,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { byte[] val = getByteArrayFromArg(args[0]); MessageDigest digest = java.security.MessageDigest.getInstance("SHA-512"); @@ -453,7 +454,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int log_rounds = 5; if(args.length == 2) { log_rounds = ArgumentValidation.getInt32(args[1], t); @@ -529,7 +530,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String val; if(args[0].isInstanceOf(CSecureString.TYPE)) { val = new String(((CSecureString) args[0]).getDecryptedCharArray()); @@ -590,7 +591,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = ArgumentValidation.getByteArray(args[0], t); byte[] data = ba.asByteArrayCopy(); data = Base64.encodeBase64(data); @@ -645,7 +646,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = ArgumentValidation.getByteArray(args[0], t); byte[] data = ba.asByteArrayCopy(); data = Base64.decodeBase64(data); @@ -722,7 +723,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return getHMAC("HmacMD5", t, args); } @@ -782,7 +783,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return getHMAC("HmacSHA1", t, args); } @@ -842,7 +843,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return getHMAC("HmacSHA256", t, args); } diff --git a/src/main/java/com/laytonsmith/core/functions/DataHandling.java b/src/main/java/com/laytonsmith/core/functions/DataHandling.java index bc4eb359aa..6680b1e0f0 100644 --- a/src/main/java/com/laytonsmith/core/functions/DataHandling.java +++ b/src/main/java/com/laytonsmith/core/functions/DataHandling.java @@ -70,6 +70,7 @@ import com.laytonsmith.core.constructs.InstanceofUtil; import com.laytonsmith.core.constructs.ProcedureUsage; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.Environment.EnvironmentImpl; @@ -143,7 +144,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return new CArray(t, args); } @@ -279,7 +280,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CArray.GetAssociativeArray(t, args); } @@ -340,7 +341,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { IVariableList list = env.getEnv(GlobalEnv.class).GetVarList(); IVariable var; if(args.length == 3) { @@ -845,7 +846,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(!(args[0].isInstanceOf(CArray.TYPE))); } @@ -906,7 +907,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(args[0].isInstanceOf(CString.TYPE)); } @@ -965,7 +966,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(args[0].isInstanceOf(CByteArray.TYPE)); } @@ -1025,7 +1026,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(args[0].isInstanceOf(CArray.TYPE)); } @@ -1087,7 +1088,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(args[0].isInstanceOf(CInt.TYPE) || args[0].isInstanceOf(CDouble.TYPE)); } @@ -1150,7 +1151,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(args[0].isInstanceOf(CDouble.TYPE)); } @@ -1211,7 +1212,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(args[0].isInstanceOf(CInt.TYPE)); } @@ -1271,7 +1272,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(args[0].isInstanceOf(CBoolean.TYPE)); } @@ -1330,7 +1331,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(args[0] instanceof CNull); } @@ -1385,7 +1386,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { boolean b = true; try { ArgumentValidation.getNumber(args[0], t); @@ -1459,7 +1460,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { double d; try { d = ArgumentValidation.getDouble(args[0], t); @@ -1696,7 +1697,7 @@ public static Procedure getProcedure(Target t, Environment env, Script parent, P } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -1940,7 +1941,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String procName = args[0].val(); Procedure proc = env.getEnv(GlobalEnv.class).GetProcs().get(procName); if(proc == null) { @@ -2075,7 +2076,7 @@ public Boolean runAsync() { } @Override - public CVoid exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public CVoid exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -2291,7 +2292,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { // This function is rewritten to include() calls in compile time, so this doesn't exist in runtime. throw new UnsupportedOperationException(); } @@ -2439,7 +2440,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) { return CBoolean.get(env.getEnv(GlobalEnv.class).GetProcs().get(args[0].val()) != null); } } @@ -2483,7 +2484,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CArray.TYPE)) { return CBoolean.get(((CArray) args[0]).inAssociativeMode()); } else { @@ -2542,7 +2543,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(args[0].isInstanceOf(CClosure.TYPE)); } @@ -2603,7 +2604,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String key; if(args[0].isInstanceOf(CString.TYPE)) { key = args[0].val(); @@ -2674,7 +2675,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String key; if(args[0].isInstanceOf(CString.TYPE)) { key = args[0].val(); @@ -2766,7 +2767,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -3133,7 +3134,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[args.length - 1] instanceof Callable callable) { Mixed[] vals = new Mixed[args.length - 1]; System.arraycopy(args, 0, vals, 0, args.length - 1); @@ -3198,7 +3199,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed[] vals = ArgumentValidation.getArray(args[0], t).asList().toArray(new Mixed[0]); CClosure closure = ArgumentValidation.getObject(args[1], t, CClosure.class); return closure.executeCallable(vals); @@ -3250,7 +3251,7 @@ public boolean isRestricted() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!(args[args.length - 1].isInstanceOf(CClosure.TYPE))) { throw new CRECastException("Only a closure (created from the closure function) can be sent to executeas()", t); } @@ -3339,7 +3340,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(ArgumentValidation.getBoolean(args[0], t)); } @@ -3408,7 +3409,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed arg = args[0]; if(arg instanceof CMutablePrimitive) { arg = ((CMutablePrimitive) arg).get(); @@ -3501,7 +3502,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(ArgumentValidation.getDouble(args[0], t), t); } @@ -3566,7 +3567,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CString.TYPE)) { return args[0]; } @@ -3618,7 +3619,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int radix = ArgumentValidation.getInt32(args[1], t); if(radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { throw new CRERangeException("The radix must be between " + Character.MIN_RADIX + " and " + Character.MAX_RADIX + ", inclusive.", t); @@ -3690,7 +3691,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String value = args[0].val(); int radix = ArgumentValidation.getInt32(args[1], t); if(radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { @@ -3775,7 +3776,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { return args[0].typeof(); } catch (IllegalArgumentException ex) { @@ -3912,7 +3913,7 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return CVoid.VOID; } //Doesn't matter, run out of state anyways @@ -3968,7 +3969,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return CVoid.VOID; } @@ -4029,7 +4030,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed val = CNull.NULL; if(args.length > 0) { val = args[0]; @@ -4131,7 +4132,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0] instanceof CNull) { return CBoolean.FALSE; } @@ -4193,7 +4194,7 @@ public ParseTree optimizeDynamic(Target t, Environment env, } // It's hardcoded, allow it, but optimize it out. if(children.get(0).isConst()) { - return new ParseTree(exec(t, null, children.get(0).getData(), children.get(1).getData()), fileOptions); + return new ParseTree(exec(t, null, null, children.get(0).getData(), children.get(1).getData()), fileOptions); } return null; } @@ -4238,7 +4239,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { IVariableList list = env.getEnv(GlobalEnv.class).GetVarList(); Mixed value = list.get(((IVariable) args[0]).getVariableName(), t, env).ival(); list.freeValue(value); @@ -4304,7 +4305,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CClassType type = ArgumentValidation.getClassType(args[0], t); int size = ArgumentValidation.getInt32(args[1], t); if(size < 0) { diff --git a/src/main/java/com/laytonsmith/core/functions/DataTransformations.java b/src/main/java/com/laytonsmith/core/functions/DataTransformations.java index e56c9db147..ae64c58534 100644 --- a/src/main/java/com/laytonsmith/core/functions/DataTransformations.java +++ b/src/main/java/com/laytonsmith/core/functions/DataTransformations.java @@ -14,6 +14,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -72,7 +73,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ca = ArgumentValidation.getArray(args[0], t); try { return new CString(Construct.json_encode(ca, t), t); @@ -129,7 +130,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String s = args[0].val(); try { return Construct.json_decode(s, t); @@ -187,7 +188,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ca = ArgumentValidation.getArray(args[0], t); boolean prettyPrint = false; if(args.length == 2) { @@ -248,7 +249,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String data = args[0].val(); LoaderOptions options = new LoaderOptions(); Mixed codePointLimit = env.getEnv(GlobalEnv.class) @@ -322,7 +323,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Properties props = new Properties(); CArray arr = ArgumentValidation.getArray(args[0], t); String comment = null; @@ -401,7 +402,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Properties props = new Properties(); Reader reader = new StringReader(args[0].val()); try { @@ -468,7 +469,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { XMLDocument doc; try { doc = new XMLDocument(args[0].val()); @@ -524,7 +525,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { throw new UnsupportedOperationException("Not supported yet."); } diff --git a/src/main/java/com/laytonsmith/core/functions/Debug.java b/src/main/java/com/laytonsmith/core/functions/Debug.java index 3e8a878b2e..a703d73f60 100644 --- a/src/main/java/com/laytonsmith/core/functions/Debug.java +++ b/src/main/java/com/laytonsmith/core/functions/Debug.java @@ -22,6 +22,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.IVariable; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -109,7 +110,7 @@ public static String docs() { // return false; // } // -// public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { +// public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { // if(!(Boolean) Static.getPreferences().getPreference("allow-debug-logging")) { // throw new ConfigRuntimeException("allow-debug-logging is currently set to false. To use " + this.getVariableName() + ", enable it in your preferences.", CRESecurityException.class, t); // } @@ -242,7 +243,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(Prefs.DebugMode()) { try { Static.LogDebug(MethodScriptFileLocations.getDefault().getConfigDirectory(), args[0].val(), LogLevel.DEBUG); @@ -259,7 +260,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi public static class trace extends always_trace { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { //TODO: Once Prefs are no longer static, check to see if debug mode is on during compilation, and //if so, remove this function entirely if(Prefs.DebugMode()) { @@ -306,7 +307,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return doTrace(t, environment, args); } @@ -441,7 +442,7 @@ public ParseTree optimizeDynamic(Target t, Environment env, // return false; // } // -// public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { +// public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { // if(!(Boolean) Static.getPreferences().getPreference("allow-debug-logging")) { // throw new ConfigRuntimeException("allow-debug-logging is currently set to false. To use " + this.getVariableName() + ", enable it in your preferences.", CRESecurityException.class, t); // } @@ -494,7 +495,7 @@ public ParseTree optimizeDynamic(Target t, Environment env, // return true; // } // -// public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { +// public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { // if(!(Boolean) Static.getPreferences().getPreference("allow-debug-logging")) { // throw new ConfigRuntimeException("allow-debug-logging is currently set to false. To use " + this.getVariableName() + ", enable it in your preferences.", CRESecurityException.class, t); // } @@ -570,7 +571,7 @@ public ParseTree optimizeDynamic(Target t, Environment env, // return false; // } // -// public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { +// public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { // if(!(Boolean) Static.getPreferences().getPreference("allow-debug-logging")) { // throw new ConfigRuntimeException("allow-debug-logging is currently set to false. To use " + this.getVariableName() + ", enable it in your preferences.", CRESecurityException.class, t); // } @@ -606,7 +607,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Set threadSet = Thread.getAllStackTraces().keySet(); CArray carray = new CArray(t); for(Thread thread : threadSet) { @@ -658,7 +659,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { File file = new File("dump.hprof"); try { HeapDumper.dumpHeap(file.getAbsolutePath(), true); @@ -713,7 +714,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Script.debugOutput = ArgumentValidation.getBoolean(args[0], t); if(Script.debugOutput) { StreamUtils.GetSystemOut().println(TermColors.BG_RED + "[[DEBUG]] set_debug_output(true)" diff --git a/src/main/java/com/laytonsmith/core/functions/Easings.java b/src/main/java/com/laytonsmith/core/functions/Easings.java index 8e8f559765..3ccbaf485b 100644 --- a/src/main/java/com/laytonsmith/core/functions/Easings.java +++ b/src/main/java/com/laytonsmith/core/functions/Easings.java @@ -13,6 +13,7 @@ import com.laytonsmith.core.constructs.CClassType; import com.laytonsmith.core.constructs.CDouble; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; import com.laytonsmith.core.exceptions.CRE.CREThrowable; @@ -52,7 +53,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { com.laytonsmith.core.Easings.EasingType type = ArgumentValidation.getEnum(args[0], com.laytonsmith.core.Easings.EasingType.class, t); double x = ArgumentValidation.getDouble(args[1], t); @@ -136,7 +137,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray start = ArgumentValidation.getArray(args[0], t); double startX = ArgumentValidation.getDouble(start.get("x", t), t); double startY = ArgumentValidation.getDouble(start.get("y", t), t); diff --git a/src/main/java/com/laytonsmith/core/functions/Echoes.java b/src/main/java/com/laytonsmith/core/functions/Echoes.java index 0bc72f0fbb..ea7f08f5c0 100644 --- a/src/main/java/com/laytonsmith/core/functions/Echoes.java +++ b/src/main/java/com/laytonsmith/core/functions/Echoes.java @@ -25,6 +25,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; @@ -69,7 +70,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(final Target t, Environment env, final Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, Environment env, GenericParameters generics, final Mixed... args) throws ConfigRuntimeException { StringBuilder b = new StringBuilder(); for(Mixed arg : args) { b.append(arg.val()); @@ -135,7 +136,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length < 2) { throw new CREInsufficientArgumentsException("You must send at least 2 arguments to tmsg", t); } @@ -201,7 +202,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String selector = "@a"; String json; try { @@ -310,7 +311,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player; int fadein = 10; int stay = 70; @@ -351,7 +352,7 @@ public String docs() { return "void {[player], message} Sends a message to the action bar above the hot bar."; } - public Construct exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Construct exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player; String message; if(args.length == 2) { @@ -400,7 +401,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String val = Construct.nval(args[0]); if(val == null) { return new CString(MCChatColor.WHITE.toString(), t); @@ -552,7 +553,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CString(MCChatColor.stripColor(args[0].val()), t); } @@ -572,7 +573,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(final Target t, final Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(p != null) { p.chat(args[0].val()); @@ -646,7 +647,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final MCPlayer player = Static.GetPlayer(args[0], t); player.chat(args[1].val()); return CVoid.VOID; @@ -700,7 +701,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final MCServer server = Static.getServer(); // Handle "broadcast(message, [null])". @@ -789,7 +790,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String mes = Static.MCToANSIColors(args[0].val()); boolean prefix = ArgumentValidation.getBooleanish(env.getEnv(GlobalEnv.class) .GetRuntimeSetting("function.console.prefix_default", CBoolean.TRUE), t); @@ -835,7 +836,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed text = args[0]; String symbol = "&"; if(args.length == 2) { diff --git a/src/main/java/com/laytonsmith/core/functions/Enchantments.java b/src/main/java/com/laytonsmith/core/functions/Enchantments.java index 88c6e81994..e10aaac9d7 100644 --- a/src/main/java/com/laytonsmith/core/functions/Enchantments.java +++ b/src/main/java/com/laytonsmith/core/functions/Enchantments.java @@ -21,6 +21,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -182,7 +183,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; int offset = 0; if(args.length == 4 || args.length == 3 && args[2].isInstanceOf(CArray.TYPE)) { @@ -257,7 +258,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; int offset = 0; if(args.length == 3) { @@ -330,7 +331,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; Mixed slot; if(args.length == 2) { @@ -391,7 +392,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEnchantment e = GetEnchantment(args[0].val(), t); MCItemStack is = ObjectGenerator.GetGenerator().item(args[1], t); return CBoolean.get(e.canEnchantItem(is)); @@ -438,7 +439,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEnchantment e = GetEnchantment(args[0].val().replace(' ', '_'), t); return new CInt(e.getMaxLevel(), t); } @@ -487,7 +488,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCItemStack is; if(args[0].isInstanceOf(CArray.TYPE)) { is = ObjectGenerator.GetGenerator().item(args[0], t); @@ -570,7 +571,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { GetEnchantment(args[0].val(), t); return CBoolean.TRUE; @@ -599,7 +600,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); for(MCEnchantment e : MCEnchantment.values()) { ret.push(new CString(e.name().toLowerCase(), t), t); diff --git a/src/main/java/com/laytonsmith/core/functions/EntityManagement.java b/src/main/java/com/laytonsmith/core/functions/EntityManagement.java index daa5d8e824..e80a147e33 100644 --- a/src/main/java/com/laytonsmith/core/functions/EntityManagement.java +++ b/src/main/java/com/laytonsmith/core/functions/EntityManagement.java @@ -145,6 +145,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREBadEntityException; @@ -224,7 +225,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); if(args.length == 0) { for(MCWorld w : Static.getServer().getWorlds()) { @@ -316,7 +317,7 @@ public ExampleScript[] examples() throws ConfigCompileException { public static class entity_exists extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { Static.getEntity(args[0], t); } catch(ConfigRuntimeException cre) { @@ -345,7 +346,7 @@ public MSVersion since() { public static class is_entity_living extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e; try { @@ -393,7 +394,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); return CBoolean.get(e instanceof MCLivingEntity && ((MCLivingEntity) e).isTameable()); } @@ -404,7 +405,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi public static class entity_loc extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); return ObjectGenerator.GetGenerator().location(e.getLocation()); } @@ -447,7 +448,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); MCLocation l; if(args[1].isInstanceOf(CArray.TYPE)) { @@ -507,7 +508,7 @@ public MSVersion since() { public static class entity_velocity extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); CArray va = ObjectGenerator.GetGenerator().vector(e.getVelocity(), t); va.set("magnitude", new CDouble(e.getVelocity().length(), t), t); @@ -546,7 +547,7 @@ public MSVersion since() { public static class set_entity_velocity extends EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); try { e.setVelocity(ObjectGenerator.GetGenerator().vector(args[1], t)); @@ -597,7 +598,7 @@ public MSVersion since() { public static class entity_remove extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent = Static.getEntity(args[0], t); if(ent instanceof MCHumanEntity) { throw new CREBadEntityException("Cannot remove human entity (" + ent.getUniqueId() + ")!", t); @@ -630,7 +631,7 @@ public MSVersion since() { public static class get_entity_saves_on_unload extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent = Static.getEntity(args[0], t); return CBoolean.get(ent.savesOnUnload()); } @@ -657,7 +658,7 @@ public MSVersion since() { public static class set_entity_saves_on_unload extends EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent = Static.getEntity(args[0], t); ent.setSavesOnUnload(ArgumentValidation.getBooleanObject(args[1], t)); return CVoid.VOID; @@ -691,7 +692,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent; try { ent = Static.getEntity(args[0], t); @@ -723,7 +724,7 @@ public MSVersion since() { public static class get_entity_age extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt(Static.getEntity(args[0], t).getTicksLived(), t); } @@ -754,7 +755,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int age = ArgumentValidation.getInt32(args[1], t); MCEntity ent = Static.getEntity(args[0], t); try { @@ -792,7 +793,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -953,7 +954,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCLocation loc; @@ -1085,7 +1086,7 @@ public Set optimizationOptions() { public static class entity_onfire extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent = Static.getEntity(args[0], t); return new CInt(ent.getFireTicks() / 20, t); } @@ -1113,7 +1114,7 @@ public MSVersion since() { public static class set_entity_onfire extends EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent = Static.getEntity(args[0], t); int seconds = ArgumentValidation.getInt32(args[1], t); if(seconds < 0) { @@ -1148,7 +1149,7 @@ public MSVersion since() { public static class play_entity_effect extends EntitySetterFunction implements Optimizable { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent = Static.getEntity(args[0], t); try { MCEntityEffect mee = MCEntityEffect.valueOf(args[1].val().toUpperCase()); @@ -1213,7 +1214,7 @@ public Set optimizationOptions() { public static class get_mob_name extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity le = Static.getEntity(args[0], t); try { return new CString(le.getCustomName(), t); @@ -1243,7 +1244,7 @@ public MSVersion since() { public static class set_mob_name extends EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity le = Static.getEntity(args[0], t); try { le.setCustomName(args[1].val()); @@ -1281,7 +1282,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender cs = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender(); int qty = 1; CArray ret = new CArray(t); @@ -1441,7 +1442,7 @@ public Set optimizationOptions() { public static class set_entity_rider extends EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity horse; MCEntity rider; boolean success; @@ -1498,7 +1499,7 @@ public MSVersion since() { public static class get_entity_rider extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent = Static.getEntity(args[0], t); List passengers = ent.getPassengers(); if(!passengers.isEmpty()) { @@ -1529,7 +1530,7 @@ public MSVersion since() { public static class get_entity_riders extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent = Static.getEntity(args[0], t); List riders = ent.getPassengers(); CArray ret = new CArray(t); @@ -1560,7 +1561,7 @@ public MSVersion since() { public static class get_entity_vehicle extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent = Static.getEntity(args[0], t); if(ent.isInsideVehicle()) { return new CString(ent.getVehicle().getUniqueId().toString(), t); @@ -1594,7 +1595,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); if(e instanceof MCMinecart) { return new CDouble(((MCMinecart) e).getMaxSpeed(), t); @@ -1629,7 +1630,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); double speed = ArgumentValidation.getDouble(args[1], t); if(e instanceof MCMinecart) { @@ -1661,7 +1662,7 @@ public MSVersion since() { public static class get_name_visible extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { return CBoolean.get(Static.getEntity(args[0], t).isCustomNameVisible()); } catch(IllegalArgumentException e) { @@ -1692,7 +1693,7 @@ public MSVersion since() { public static class set_name_visible extends EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { Static.getEntity(args[0], t).setCustomNameVisible(ArgumentValidation.getBoolean(args[1], t)); } catch(IllegalArgumentException e) { @@ -1724,7 +1725,7 @@ public MSVersion since() { public static class get_art_at extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(environment.getEnv(CommandHelperEnvironment.class).GetPlayer() != null) { w = environment.getEnv(CommandHelperEnvironment.class).GetPlayer().getWorld(); @@ -1762,7 +1763,7 @@ public Version since() { public static class set_art_at extends EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(environment.getEnv(CommandHelperEnvironment.class).GetPlayer() != null) { w = environment.getEnv(CommandHelperEnvironment.class).GetPlayer().getWorld(); @@ -1814,7 +1815,7 @@ public Version since() { public static class entity_grounded extends EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(Static.getEntity(args[0], t).isOnGround()); } @@ -1881,7 +1882,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); CArray specArray = CArray.GetAssociativeArray(t); switch(entity.getType().getAbstracted()) { @@ -2594,7 +2595,7 @@ private static void throwException(String index, Target t) throws ConfigRuntimeE } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); CArray specArray = ArgumentValidation.getArray(args[1], t); @@ -4216,7 +4217,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); if(entity instanceof MCProjectile) { @@ -4255,7 +4256,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); if(entity instanceof MCProjectile) { if(args[1] instanceof CNull) { @@ -4297,7 +4298,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); if(entity instanceof MCProjectile) { return CBoolean.get(((MCProjectile) entity).doesBounce()); @@ -4327,7 +4328,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); if(entity instanceof MCProjectile) { ((MCProjectile) entity).setBounce(ArgumentValidation.getBoolean(args[1], t)); @@ -4360,7 +4361,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); if(entity instanceof MCItemProjectile) { return ObjectGenerator.GetGenerator().item(((MCItemProjectile) entity).getItem(), t); @@ -4392,7 +4393,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); if(entity instanceof MCItemProjectile) { ((MCItemProjectile) entity).setItem(ObjectGenerator.GetGenerator().item(args[1], t)); @@ -4423,7 +4424,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(Static.getEntity(args[0], t).getFallDistance(), t); } @@ -4448,7 +4449,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Static.getEntity(args[0], t).setFallDistance(ArgumentValidation.getDouble32(args[1], t)); return CVoid.VOID; } @@ -4474,7 +4475,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Static.getEntity(args[0], t).setGlowing(ArgumentValidation.getBoolean(args[1], t)); return CVoid.VOID; } @@ -4500,7 +4501,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); return CBoolean.GenerateCBoolean(e.isGlowing(), t); } @@ -4526,7 +4527,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.GenerateCBoolean(Static.getEntity(args[0], t).isSilent(), t); } @@ -4551,7 +4552,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); e.setSilent(ArgumentValidation.getBoolean(args[1], t)); return CVoid.VOID; @@ -4578,7 +4579,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.GenerateCBoolean(Static.getEntity(args[0], t).hasGravity(), t); } @@ -4603,7 +4604,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); e.setHasGravity(ArgumentValidation.getBoolean(args[1], t)); return CVoid.VOID; @@ -4630,7 +4631,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.GenerateCBoolean(Static.getEntity(args[0], t).isInvulnerable(), t); } @@ -4656,7 +4657,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); e.setInvulnerable(ArgumentValidation.getBoolean(args[1], t)); return CVoid.VOID; @@ -4684,7 +4685,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); return new CInt(e.getFreezingTicks(), t); } @@ -4717,7 +4718,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); int ticks = ArgumentValidation.getInt32(args[1], t); if(ticks < 0) { @@ -4748,7 +4749,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); CArray tags = new CArray(t); for(String tag : e.getScoreboardTags()) { @@ -4783,7 +4784,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); return CBoolean.get(e.hasScoreboardTag(args[1].val())); } @@ -4809,7 +4810,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); return CBoolean.get(e.addScoreboardTag(args[1].val())); } @@ -4835,7 +4836,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); return CBoolean.get(e.removeScoreboardTag(args[1].val())); } @@ -4888,7 +4889,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation l; MCItemStack is; boolean natural; @@ -4949,7 +4950,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld w = null; if(p != null) { @@ -5063,7 +5064,7 @@ public MSVersion since() { public static class get_hanging_direction extends EntityGetterFunction { @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); if(entity instanceof MCHanging hanging) { return new CString(hanging.getFacing().name(), t); @@ -5120,7 +5121,7 @@ public CClassType getReturnType(Target t, List argTypes, List[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity entity = Static.getLivingEntity(args[0], t); if(args[1] instanceof CNull) { entity.setKiller(null); @@ -5816,7 +5817,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); return CBoolean.get(!entity.isVisibleByDefault()); } @@ -5845,7 +5846,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); entity.setVisibleByDefault(!ArgumentValidation.getBooleanObject(args[1], t)); return CVoid.VOID; @@ -5915,7 +5916,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); return new CString(entity.getPose().name(), t); } @@ -5953,7 +5954,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); MCPose pose; try { diff --git a/src/main/java/com/laytonsmith/core/functions/Environment.java b/src/main/java/com/laytonsmith/core/functions/Environment.java index 86c2e365c5..d6d3890547 100644 --- a/src/main/java/com/laytonsmith/core/functions/Environment.java +++ b/src/main/java/com/laytonsmith/core/functions/Environment.java @@ -58,6 +58,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.exceptions.CRE.CREBadEntityException; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -105,7 +106,7 @@ public String docs() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlock b = loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); @@ -158,7 +159,7 @@ public String docs() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); boolean physics = true; @@ -215,7 +216,7 @@ public String docs() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlock b = loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); @@ -268,7 +269,7 @@ public String docs() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlock b = loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); @@ -330,7 +331,7 @@ public String docs() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlock b = loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); @@ -385,7 +386,7 @@ public String docs() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlock b = loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); @@ -486,7 +487,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld world = null; if(player != null) { @@ -597,7 +598,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld world = null; if(player != null) { @@ -669,7 +670,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCWorld w = null; if(sender instanceof MCPlayer) { @@ -720,7 +721,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCWorld w = null; if(sender instanceof MCPlayer) { @@ -789,7 +790,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCWorld w = null; if(sender instanceof MCPlayer) { @@ -859,7 +860,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCWorld w = null; if(sender instanceof MCPlayer) { @@ -915,7 +916,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCWorld w = null; if(sender instanceof MCPlayer) { @@ -977,7 +978,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], p != null ? p.getWorld() : null, t); @@ -1059,7 +1060,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], p != null ? p.getWorld() : null, t); @@ -1131,7 +1132,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld w = (p != null ? p.getWorld() : null); MCBlock b = ObjectGenerator.GetGenerator().location(args[0], w, t).getBlock(); @@ -1185,7 +1186,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int x; int z; MCCommandSender sender = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender(); @@ -1288,7 +1289,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCWorld w = null; if(sender instanceof MCPlayer) { @@ -1345,7 +1346,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { int x = 0; int z = 0; MCWorld w = null; @@ -1431,7 +1432,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCLocation loc; float size = 3; boolean safe = false; @@ -1498,7 +1499,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCInstrument i = null; MCNote n = null; @@ -1671,7 +1672,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation l = ObjectGenerator.GetGenerator().location(args[0], null, t); MCParticle p; int count = 0; @@ -1805,7 +1806,7 @@ public Boolean runAsync() { @Override public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, - Mixed... args) throws ConfigRuntimeException { + GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = null; MCEntity ent = null; @@ -1976,7 +1977,7 @@ public Boolean runAsync() { @Override public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, - Mixed... args) throws ConfigRuntimeException { + GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = null; MCEntity ent = null; @@ -2109,7 +2110,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCLocation l = ObjectGenerator.GetGenerator().location(args[0], p == null ? null : p.getWorld(), t); MCBlock b = l.getBlock(); @@ -2208,7 +2209,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer pl = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -2261,7 +2262,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer pl = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -2314,7 +2315,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer pl = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -2369,7 +2370,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer pl = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -2457,7 +2458,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer pl = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -2511,7 +2512,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCTreeType treeType; if(args.length == 1) { treeType = MCTreeType.TREE; @@ -2569,7 +2570,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); return CBoolean.get(loc.getBlock().getState().isLockable()); @@ -2619,7 +2620,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlockState block = loc.getBlock().getState(); @@ -2673,7 +2674,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlockState block = loc.getBlock().getState(); @@ -2728,7 +2729,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlockState block = loc.getBlock().getState(); @@ -2779,7 +2780,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); if(loc.getBlock().isCommandBlock()) { @@ -2831,7 +2832,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String cmd = null; if(args.length == 2 && !(args[1] instanceof CNull)) { @@ -2891,7 +2892,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); if(loc.getBlock().isCommandBlock()) { @@ -2943,7 +2944,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args ) throws ConfigRuntimeException { String name = null; if(args.length == 2 && !(args[1] instanceof CNull)) { @@ -2983,7 +2984,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlock b = loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); if(b.getState() instanceof MCBanner banner) { @@ -3056,7 +3057,7 @@ public CClassType getReturnType(Target t, List argTypes, List[] thrown() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); return CBoolean.get(loc.getBlock().applyBoneMeal()); @@ -3263,7 +3264,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlockState bs = loc.getBlock().getState(); @@ -3322,7 +3323,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlockState bs = loc.getBlock().getState(); @@ -3396,7 +3397,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlockState bs = loc.getBlock().getState(); @@ -3464,7 +3465,7 @@ public Version since() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], null, t); MCBlockState bs = loc.getBlock().getState(); diff --git a/src/main/java/com/laytonsmith/core/functions/EventBinding.java b/src/main/java/com/laytonsmith/core/functions/EventBinding.java index afe27912ec..b67a8a131d 100644 --- a/src/main/java/com/laytonsmith/core/functions/EventBinding.java +++ b/src/main/java/com/laytonsmith/core/functions/EventBinding.java @@ -34,6 +34,7 @@ import com.laytonsmith.core.constructs.IVariable; import com.laytonsmith.core.constructs.IVariableList; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.environments.StaticRuntimeEnv; @@ -127,7 +128,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -507,7 +508,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return EventUtils.DumpEvents(); } } @@ -552,7 +553,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String id; BoundEvent be; if(args.length == 1) { @@ -627,7 +628,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { boolean cancelled = true; if(args.length == 1) { cancelled = ArgumentValidation.getBoolean(args[0], t); @@ -684,7 +685,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { BoundEvent.ActiveEvent original = environment.getEnv(GlobalEnv.class).GetEvent(); if(original == null) { throw new CREBindException("is_cancelled cannot be called outside an event handler", t); @@ -747,7 +748,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray obj = null; if(args[1] instanceof CNull) { obj = new CArray(t); @@ -816,7 +817,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String parameter = args[0].val(); Mixed value = args[1]; boolean throwOnFailure = false; @@ -884,7 +885,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(environment.getEnv(GlobalEnv.class).GetEvent() == null) { throw new CREBindException("lock must be called from within an event handler", t); } @@ -955,7 +956,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(environment.getEnv(GlobalEnv.class).GetEvent() == null) { throw new CREBindException("is_locked may only be called from inside an event handler", t); } @@ -1004,7 +1005,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(environment.getEnv(GlobalEnv.class).GetEvent() == null) { throw new CREBindException("consume may only be called from an event handler!", t); } @@ -1055,7 +1056,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(environment.getEnv(GlobalEnv.class).GetEvent() == null) { throw new CREBindException("is_consumed must be called from within an event handler", t); } @@ -1109,7 +1110,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(environment.getEnv(GlobalEnv.class).GetEvent() == null) { throw new CREBindException("event_meta must be called from within an event handler!", t); } @@ -1145,7 +1146,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(EventUtils.GetEventById(args[0].val()) != null); } diff --git a/src/main/java/com/laytonsmith/core/functions/Exceptions.java b/src/main/java/com/laytonsmith/core/functions/Exceptions.java index 916aab22e9..da978c7133 100644 --- a/src/main/java/com/laytonsmith/core/functions/Exceptions.java +++ b/src/main/java/com/laytonsmith/core/functions/Exceptions.java @@ -39,6 +39,7 @@ import com.laytonsmith.core.constructs.IVariableList; import com.laytonsmith.core.constructs.NativeTypeList; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.environments.StaticRuntimeEnv; @@ -205,7 +206,7 @@ public Mixed execs(Target t, Environment env, Script that, ParseTree... nodes) { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return CVoid.VOID; } @@ -339,7 +340,7 @@ public Boolean runAsync() { // return true; // } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args.length == 1) { try { // Exception type @@ -397,7 +398,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CClosure.TYPE)) { CClosure old = environment.getEnv(StaticRuntimeEnv.class).getExceptionHandler(); environment.getEnv(StaticRuntimeEnv.class).setExceptionHandler((CClosure) args[0]); @@ -495,7 +496,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -728,7 +729,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { StackTraceManager stManager = environment.getEnv(GlobalEnv.class).GetStackTraceManager(); List elements = stManager.getCurrentStackTrace(); CArray ret = new CArray(t); diff --git a/src/main/java/com/laytonsmith/core/functions/ExecutionQueue.java b/src/main/java/com/laytonsmith/core/functions/ExecutionQueue.java index df365ec803..a49728cdc5 100644 --- a/src/main/java/com/laytonsmith/core/functions/ExecutionQueue.java +++ b/src/main/java/com/laytonsmith/core/functions/ExecutionQueue.java @@ -9,6 +9,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.environments.StaticRuntimeEnv; @@ -56,7 +57,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, final Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, final Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final CClosure c; String queue = null; if(!(args[0].isInstanceOf(CClosure.TYPE))) { @@ -139,7 +140,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, final Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, final Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final CClosure c; String queue = null; if(!(args[0].isInstanceOf(CClosure.TYPE))) { @@ -222,7 +223,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String queue = null; if(args.length == 1) { queue = Construct.nval(args[0]); @@ -272,7 +273,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String queue = null; if(args.length == 1) { queue = Construct.nval(args[0]); @@ -323,7 +324,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String queue = null; if(args.length == 1) { queue = Construct.nval(args[0]); @@ -374,7 +375,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String queue = null; if(args.length == 1) { queue = Construct.nval(args[0]); @@ -423,7 +424,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String queue = null; if(args.length == 2) { queue = Construct.nval(args[1]); @@ -489,7 +490,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String queue = null; if(args.length == 2) { queue = Construct.nval(args[1]); diff --git a/src/main/java/com/laytonsmith/core/functions/ExtensionMeta.java b/src/main/java/com/laytonsmith/core/functions/ExtensionMeta.java index 633ec52668..534c2fc178 100644 --- a/src/main/java/com/laytonsmith/core/functions/ExtensionMeta.java +++ b/src/main/java/com/laytonsmith/core/functions/ExtensionMeta.java @@ -12,6 +12,7 @@ import com.laytonsmith.core.constructs.CBoolean; import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.events.Event; import com.laytonsmith.core.events.EventList; @@ -57,7 +58,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { FunctionList.getFunction(args[0].val().toLowerCase(), environment.getEnvClasses(), t); } catch (ConfigCompileException ex) { @@ -159,7 +160,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(EventList.getEvent(args[0].val().toLowerCase()) != null); } @@ -204,7 +205,7 @@ public ParseTree optimizeDynamic(Target t, Environment env, throw new ConfigCompileException(getName() + " can only accept hardcoded string values", t); } - return new ParseTree(this.exec(t, null, children.get(0).getData()), children.get(0).getFileOptions()); + return new ParseTree(this.exec(t, null, null, children.get(0).getData()), children.get(0).getFileOptions()); } } @@ -228,7 +229,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Map trackers = ExtensionManager.getTrackers(); for(ExtensionTracker tracker : trackers.values()) { String identifier = tracker.getIdentifier(); @@ -276,7 +277,7 @@ public ParseTree optimizeDynamic(Target t, Environment env, } else if(!(children.get(0).getData().isInstanceOf(CString.TYPE))) { throw new ConfigCompileException(getName() + " can only accept hardcoded string values", t); } else { - return new ParseTree(this.exec(t, null, children.get(0).getData()), children.get(0).getFileOptions()); + return new ParseTree(this.exec(t, null, null, children.get(0).getData()), children.get(0).getFileOptions()); } } } @@ -300,7 +301,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Map trackers = ExtensionManager.getTrackers(); CArray retn = CArray.GetAssociativeArray(t); diff --git a/src/main/java/com/laytonsmith/core/functions/FileHandling.java b/src/main/java/com/laytonsmith/core/functions/FileHandling.java index 965f2a4cc2..62496247fc 100644 --- a/src/main/java/com/laytonsmith/core/functions/FileHandling.java +++ b/src/main/java/com/laytonsmith/core/functions/FileHandling.java @@ -28,6 +28,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.StaticRuntimeEnv; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -80,7 +81,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { File location = Static.GetFileFromArgument(args[0].val(), env, t, null); String charset = "UTF-8"; if(args.length > 1) { @@ -160,7 +161,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CNull.NULL; } @@ -204,9 +205,9 @@ public ParseTree optimizeDynamic(Target t, Environment env, String ret; if(children.size() == 1) { - ret = new read().exec(t, env, children.get(0).getData()).val(); + ret = new read().exec(t, env, null, children.get(0).getData()).val(); } else { - ret = new read().exec(t, env, children.get(0).getData(), + ret = new read().exec(t, env, null, children.get(0).getData(), children.get(1).getData()).val(); } ParseTree tree = new ParseTree(new CString(ret, t), fileOptions); @@ -262,7 +263,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(final Target t, final Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { startup(); final String file = args[0].val(); final CClosure callback; @@ -389,7 +390,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { File location = Static.GetFileFromArgument(args[0].val(), environment, t, null); try { if(!Static.InCmdLine(environment, true) && !Security.CheckSecurity(location)) { @@ -442,7 +443,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { File location = Static.GetFileFromArgument(args[0].val(), env, t, null); try { if(!Static.InCmdLine(env, true)) { @@ -507,7 +508,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { File location = Static.GetFileFromArgument(args[0].val(), env, t, null); try { //Verify this file is not above the craftbukkit directory (or whatever directory the user specified @@ -570,7 +571,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { //TODO: Doesn't work yet. //TODO: Be sure to change over to Static.GetFileFromArgument String path = args[0].val().trim().replace('\\', '/'); @@ -634,7 +635,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { File f = Static.GetFileFromArgument(args[0].val(), environment, t, null); try { return new CString(f.getCanonicalPath(), t); diff --git a/src/main/java/com/laytonsmith/core/functions/Function.java b/src/main/java/com/laytonsmith/core/functions/Function.java index 3fe5b7d4ff..858c0ed89d 100644 --- a/src/main/java/com/laytonsmith/core/functions/Function.java +++ b/src/main/java/com/laytonsmith/core/functions/Function.java @@ -1,5 +1,6 @@ package com.laytonsmith.core.functions; +import com.laytonsmith.PureUtilities.Common.ReflectionUtils; import com.laytonsmith.core.Documentation; import com.laytonsmith.core.LogLevel; import com.laytonsmith.core.ParseTree; @@ -11,14 +12,17 @@ import com.laytonsmith.core.compiler.signature.SignatureBuilder; import com.laytonsmith.core.constructs.CClassType; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREThrowable; import com.laytonsmith.core.exceptions.CancelCommandException; import com.laytonsmith.core.exceptions.ConfigCompileException; import com.laytonsmith.core.exceptions.ConfigRuntimeException; import com.laytonsmith.core.natives.interfaces.Mixed; +import java.util.Collections; import java.util.List; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; /** * Note that to "activate" this class as a function, you must prefix the '@api' annotation to it. @@ -68,18 +72,19 @@ public interface Function extends FunctionBase, Documentation, Comparable getBranches(ParseTree self); } + + // TODO: The reflection bridge below is a backward-compatibility shim for + // 3rd-party functions that still implement the old 3-arg + // exec(Target, Environment, Mixed...) signature. Once all known extensions + // have been updated, the cache and reflection fallback can be removed, and + // callers can invoke exec directly. + + /** + * Cache of Function classes that only implement the old 3-arg exec signature. + */ + Set> OLD_EXEC_CACHE = Collections.newSetFromMap(new ConcurrentHashMap<>()); + + /** + * Invokes {@link #exec} on the given function with backward compatibility for 3rd-party functions + * that still implement the old 3-arg exec(Target, Environment, Mixed...) signature. + * For functions with the new signature, this has zero overhead beyond a Set lookup on cached misses. + * + * @param f The function to execute. + * @param t The code target. + * @param env The environment. + * @param args The arguments. + * @return The result of the function execution. + * @throws ConfigRuntimeException + */ + static Mixed ExecuteFunction(Function f, Target t, Environment env, Mixed[] args) throws ConfigRuntimeException { + if(OLD_EXEC_CACHE.contains(f.getClass())) { + return ReflectionUtils.invokeMethod(f.getClass(), f, "exec", + new Class[]{Target.class, Environment.class, Mixed[].class}, + new Object[]{t, env, args}); + } + try { + return f.exec(t, env, null, args); + } catch(AbstractMethodError e) { + OLD_EXEC_CACHE.add(f.getClass()); + return ReflectionUtils.invokeMethod(f.getClass(), f, "exec", + new Class[]{Target.class, Environment.class, Mixed[].class}, + new Object[]{t, env, args}); + } + } } diff --git a/src/main/java/com/laytonsmith/core/functions/InventoryManagement.java b/src/main/java/com/laytonsmith/core/functions/InventoryManagement.java index 69480e403b..d1b6bb7e16 100644 --- a/src/main/java/com/laytonsmith/core/functions/InventoryManagement.java +++ b/src/main/java/com/laytonsmith/core/functions/InventoryManagement.java @@ -38,6 +38,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREBadEntityException; @@ -122,7 +123,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Integer index = -1; boolean all; MCPlayer m; @@ -217,7 +218,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { @@ -273,7 +274,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { @@ -332,7 +333,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player; MCPlayer other; @@ -396,7 +397,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { @@ -490,7 +491,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m; Mixed arg; if(args.length == 3) { @@ -594,7 +595,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 0) { p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -651,7 +652,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCItemStack is; Mixed c; @@ -773,7 +774,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; Mixed item; CArray ca = null; @@ -907,7 +908,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCItemStack is; int itemOffset = 0; @@ -1022,7 +1023,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCItemStack is; int itemOffset = 0; @@ -1167,7 +1168,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCItemStack is; int itemOffset = 0; @@ -1279,7 +1280,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCItemStack is; int itemOffset = 0; @@ -1431,7 +1432,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; @@ -1532,7 +1533,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); Integer index = -1; @@ -1609,7 +1610,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(p != null) { @@ -1664,7 +1665,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(p != null) { @@ -1728,7 +1729,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(p != null) { @@ -1790,7 +1791,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(p != null) { @@ -1848,7 +1849,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(environment.getEnv(CommandHelperEnvironment.class).GetPlayer() != null) { w = environment.getEnv(CommandHelperEnvironment.class).GetPlayer().getWorld(); @@ -1900,7 +1901,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(p != null) { @@ -1957,7 +1958,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p1 = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCPlayer p2; if(args.length == 2) { @@ -2040,7 +2041,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCInventory inventory = InventoryManagement.GetInventory(args[0], null, t); @@ -2120,7 +2121,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCInventory inventory = InventoryManagement.GetInventory(args[0], null, t); Integer size = inventory.getSize(); @@ -2211,7 +2212,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCInventory inventory = InventoryManagement.GetInventory(args[0], null, t); MCItemStack is; if(args.length == 2) { @@ -2299,7 +2300,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCInventory inventory = InventoryManagement.GetInventory(args[0], null, t); Integer size = inventory.getSize(); CArray ca = null; @@ -2411,7 +2412,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player; switch(args.length) { case 1: { @@ -2493,7 +2494,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player; switch(args.length) { case 0: { @@ -2549,7 +2550,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCInventory inv; if(args.length == 2) { @@ -2609,7 +2610,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -2667,7 +2668,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCInventory inv = GetInventory(args[0], null, t); CArray list = new CArray(t); for(MCHumanEntity viewer : inv.getViewers()) { @@ -2717,7 +2718,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray list = new CArray(t); for(String id : VIRTUAL_INVENTORIES.keySet()) { list.push(new CString(id, t), t); @@ -2780,7 +2781,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String id = args[0].val(); if(VIRTUAL_INVENTORIES.get(id) != null) { throw new CREIllegalArgumentException("An inventory using the id \"" + id + "\" already exists.", t); @@ -2891,7 +2892,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String id = args[0].val(); MCInventory inv = VIRTUAL_INVENTORIES.get(id); if(inv != null) { diff --git a/src/main/java/com/laytonsmith/core/functions/ItemMeta.java b/src/main/java/com/laytonsmith/core/functions/ItemMeta.java index ede6f1c841..0af569a673 100644 --- a/src/main/java/com/laytonsmith/core/functions/ItemMeta.java +++ b/src/main/java/com/laytonsmith/core/functions/ItemMeta.java @@ -35,6 +35,7 @@ import com.laytonsmith.core.constructs.CNull; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -78,7 +79,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCItemStack is; Mixed slot; @@ -182,7 +183,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; Mixed slot; Mixed meta; @@ -290,7 +291,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); int slot; if(args.length == 2) { @@ -355,7 +356,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); int slot; CArray color; @@ -434,7 +435,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; Mixed slot; if(args.length == 2) { diff --git a/src/main/java/com/laytonsmith/core/functions/Marquee.java b/src/main/java/com/laytonsmith/core/functions/Marquee.java index 423785a599..f3397b5cfd 100644 --- a/src/main/java/com/laytonsmith/core/functions/Marquee.java +++ b/src/main/java/com/laytonsmith/core/functions/Marquee.java @@ -8,6 +8,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; import com.laytonsmith.core.exceptions.CRE.CREThrowable; @@ -52,7 +53,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(final Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final String marqueeName; final String text; final int stringWidth; @@ -158,7 +159,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String marqueeName = args[0].val(); if(MARQUEE_MAP.containsKey(marqueeName)) { MARQUEE_MAP.get(marqueeName).stop(); diff --git a/src/main/java/com/laytonsmith/core/functions/Math.java b/src/main/java/com/laytonsmith/core/functions/Math.java index d3868ed4ab..2a0e6a477a 100644 --- a/src/main/java/com/laytonsmith/core/functions/Math.java +++ b/src/main/java/com/laytonsmith/core/functions/Math.java @@ -21,6 +21,7 @@ import com.laytonsmith.core.constructs.CArray; import com.laytonsmith.core.constructs.CClassType; import com.laytonsmith.core.constructs.CDouble; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.constructs.CFunction; import com.laytonsmith.core.constructs.CInt; import com.laytonsmith.core.constructs.CMutablePrimitive; @@ -77,7 +78,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(ArgumentValidation.anyDoubles(args)) { double tally = ArgumentValidation.getNumber(args[0], t); for(int i = 1; i < args.length; i++) { @@ -165,7 +166,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(ArgumentValidation.anyDoubles(args)) { double tally = ArgumentValidation.getNumber(args[0], t); for(int i = 1; i < args.length; i++) { @@ -241,7 +242,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(ArgumentValidation.anyDoubles(args)) { double tally = ArgumentValidation.getNumber(args[0], t); for(int i = 1; i < args.length; i++) { @@ -327,7 +328,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { double tally = ArgumentValidation.getNumber(args[0], t); for(int i = 1; i < args.length; i++) { double next = ArgumentValidation.getNumber(args[i], t); @@ -403,7 +404,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { long arg1 = ArgumentValidation.getInt(args[0], t); long arg2 = ArgumentValidation.getInt(args[1], t); if(arg2 == 0) { @@ -468,7 +469,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { double arg1 = ArgumentValidation.getNumber(args[0], t); double arg2 = ArgumentValidation.getNumber(args[1], t); return new CDouble(java.lang.Math.pow(arg1, arg2), t); @@ -548,7 +549,7 @@ protected static Mixed doIncrementDecrement(ParseTree[] nodes, if(!(array.isInstanceOf(CArray.TYPE)) && !(array.isInstanceOf(ArrayAccess.TYPE))) { //Let's just evaluate this like normal with array_get, so it will //throw the appropriate exception. - new ArrayHandling.array_get().exec(t, env, array, index); + new ArrayHandling.array_get().exec(t, env, null, array, index); throw ConfigRuntimeException.CreateUncatchableException("Shouldn't have gotten here. Please report this error, and how you got here.", t); } else if(!(array.isInstanceOf(CArray.TYPE))) { //It's an ArrayAccess type, but we can't use that here, so, throw our @@ -568,7 +569,7 @@ protected static Mixed doIncrementDecrement(ParseTree[] nodes, } else { newVal = new CInt(ArgumentValidation.getInt(value, t) - delta, t); } - new ArrayHandling.array_set().exec(t, env, array, index, newVal); + new ArrayHandling.array_set().exec(t, env, null, array, index, newVal); if(pre) { return newVal; } else { @@ -581,7 +582,7 @@ protected static Mixed doIncrementDecrement(ParseTree[] nodes, } else { newVal = new CDouble(ArgumentValidation.getDouble(value, t) - delta, t); } - new ArrayHandling.array_set().exec(t, env, array, index, newVal); + new ArrayHandling.array_set().exec(t, env, null, array, index, newVal); if(pre) { return newVal; } else { @@ -596,7 +597,7 @@ protected static Mixed doIncrementDecrement(ParseTree[] nodes, for(int i = 0; i < args.length; i++) { args[i] = parent.eval(nodes[i], env); } - return func.exec(t, env, args); + return Function.ExecuteFunction(func, t, env, args); } @api @@ -627,7 +628,7 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { long value = 1; if(args.length == 2) { if(args[1] instanceof IVariable) { @@ -707,7 +708,7 @@ public Mixed optimize(Target t, Environment env, Mixed... args) throws ConfigCom if(args[0] instanceof IVariable) { return null; } else { - return exec(t, null, args); + return exec(t, null, null, args); } } @@ -747,7 +748,7 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { long value = 1; if(args.length == 2) { if(args[1] instanceof IVariable) { @@ -822,7 +823,7 @@ public Mixed optimize(Target t, Environment env, Mixed... args) throws ConfigCom if(args[0] instanceof IVariable) { return null; } else { - return exec(t, null, args); + return exec(t, null, null, args); } } @@ -877,7 +878,7 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { long value = 1; if(args.length == 2) { if(args[1] instanceof IVariable) { @@ -946,7 +947,7 @@ public Mixed optimize(Target t, Environment env, Mixed... args) throws ConfigCom if(args[0] instanceof IVariable) { return null; } else { - return exec(t, null, args); + return exec(t, null, null, args); } } @@ -997,7 +998,7 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { long value = 1; if(args.length == 2) { if(args[1] instanceof IVariable) { @@ -1072,7 +1073,7 @@ public Mixed optimize(Target t, Environment env, Mixed... args) throws ConfigCom if(args[0] instanceof IVariable) { return null; } else { - return exec(t, null, args); + return exec(t, null, null, args); } } @@ -1136,7 +1137,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args.length == 0) { return new CDouble(java.lang.Math.random(), t); } else { @@ -1223,7 +1224,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CInt.TYPE)) { return new CInt(java.lang.Math.abs(ArgumentValidation.getInt(args[0], t)), t); } else { @@ -1287,7 +1288,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt((long) java.lang.Math.floor(ArgumentValidation.getNumber(args[0], t)), t); } @@ -1339,7 +1340,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt((long) java.lang.Math.ceil(ArgumentValidation.getNumber(args[0], t)), t); } @@ -1392,7 +1393,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { double d = ArgumentValidation.getNumber(args[0], t); if(d < 0) { throw new CRERangeException("sqrt expects a number >= 0", t); @@ -1454,7 +1455,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length == 0) { throw new CREInsufficientArgumentsException("You must send at least one parameter to min", t); } @@ -1536,7 +1537,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length == 0) { throw new CREInsufficientArgumentsException("You must send at least one parameter to max", t); } @@ -1617,7 +1618,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(java.lang.Math.sin(ArgumentValidation.getNumber(args[0], t)), t); } @@ -1669,7 +1670,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(java.lang.Math.cos(ArgumentValidation.getNumber(args[0], t)), t); } @@ -1721,7 +1722,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(java.lang.Math.tan(ArgumentValidation.getNumber(args[0], t)), t); } @@ -1773,7 +1774,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(java.lang.Math.asin(ArgumentValidation.getNumber(args[0], t)), t); } @@ -1825,7 +1826,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(java.lang.Math.acos(ArgumentValidation.getNumber(args[0], t)), t); } @@ -1877,7 +1878,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(java.lang.Math.atan(ArgumentValidation.getNumber(args[0], t)), t); } @@ -1929,7 +1930,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return Static.getNumber(java.lang.Math.sinh(ArgumentValidation.getNumber(args[0], t)), t); } @@ -1981,7 +1982,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return Static.getNumber(java.lang.Math.cosh(ArgumentValidation.getNumber(args[0], t)), t); } @@ -2033,7 +2034,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return Static.getNumber(java.lang.Math.tanh(ArgumentValidation.getNumber(args[0], t)), t); } @@ -2085,7 +2086,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(java.lang.Math.toRadians(ArgumentValidation.getNumber(args[0], t)), t); } @@ -2137,7 +2138,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(java.lang.Math.toDegrees(ArgumentValidation.getNumber(args[0], t)), t); } @@ -2193,7 +2194,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CDouble(java.lang.Math.atan2(ArgumentValidation.getNumber(args[0], t), ArgumentValidation.getNumber(args[1], t)), t); } @@ -2246,7 +2247,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { double number = ArgumentValidation.getNumber(args[0], t); int precision = 0; if(args.length > 1) { @@ -2298,7 +2299,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { double x = ArgumentValidation.getDouble(args[0], t) + 1; DecimalFormat twoDForm = new DecimalFormat("0.##############E0"); String str = twoDForm.format(x); @@ -2396,7 +2397,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String expr = args[0].val().trim(); if("".equals(expr)) { throw new CREFormatException("Expression may not be empty", t); @@ -2502,7 +2503,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CInt.TYPE)) { return new CInt(-(ArgumentValidation.getInt(args[0], t)), t); } else { @@ -2543,7 +2544,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { double val = ArgumentValidation.getDouble(args[0], t); if(val <= 0) { throw new CRERangeException("val was <= 0", t); @@ -2688,7 +2689,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { MathConstants c = MathConstants.valueOf(args[0].val()); Number v = c.getValue(); diff --git a/src/main/java/com/laytonsmith/core/functions/MatrixHandling.java b/src/main/java/com/laytonsmith/core/functions/MatrixHandling.java index 9f2d217ad3..6ea7483d39 100644 --- a/src/main/java/com/laytonsmith/core/functions/MatrixHandling.java +++ b/src/main/java/com/laytonsmith/core/functions/MatrixHandling.java @@ -17,6 +17,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; import com.laytonsmith.core.exceptions.CRE.CREIllegalArgumentException; @@ -96,7 +97,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length == 1) { return CReal2dMatrix.FromConstruct(ArgumentValidation.getArray(args[0], t), t); } else { @@ -173,7 +174,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix matrix = getMatrix(args[0], t, 1); int column = ArgumentValidation.getInt32(args[1], t); double[] data = matrix.getColumn(column); @@ -236,7 +237,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix matrix = getMatrixOnly(args[0], t, 1); return matrix.deepClone(); } @@ -290,7 +291,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix matrix = getMatrix(args[0], t, 1); double[] data = matrix.getData(); String format = "%.3f"; @@ -382,7 +383,7 @@ public Boolean runAsync() { } @Override - public CArray exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public CArray exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix m = MatrixHandling.getMatrixOnly(args[0], t, 1); return m.toArray(); } @@ -438,7 +439,7 @@ public Boolean runAsync() { } @Override - public CReal2dMatrix exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public CReal2dMatrix exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int dimension = ArgumentValidation.getInt32(args[0], t); double[] data = new double[dimension * dimension]; for(int i = 0; i < (dimension * dimension); i++) { @@ -498,7 +499,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return MatrixHandling.getMatrix(args[0], t, 1).transpose(); } @@ -553,7 +554,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix left = MatrixHandling.getMatrix(args[0], t, 1); CReal2dMatrix right = MatrixHandling.getMatrix(args[1], t, 2); left.add(right, t); @@ -618,7 +619,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix left = MatrixHandling.getMatrix(args[0], t, 1); CReal2dMatrix right = MatrixHandling.getMatrix(args[1], t, 2); left.subtract(right, t); @@ -683,7 +684,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix matrix = MatrixHandling.getMatrix(args[0], t, 1); double scalar = ArgumentValidation.getDouble(args[1], t); matrix.scalarMultiply(scalar); @@ -742,7 +743,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix matrix = MatrixHandling.getMatrix(args[0], t, 1); int row = ArgumentValidation.getInt32(args[1], t); int column = ArgumentValidation.getInt32(args[2], t); @@ -806,7 +807,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix left = MatrixHandling.getMatrix(args[0], t, 1); CReal2dMatrix right = MatrixHandling.getMatrix(args[1], t, 2); return left.multiply(right, t); @@ -872,7 +873,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix left = MatrixHandling.getMatrix(args[0], t, 1); CReal2dMatrix right = MatrixHandling.getMatrix(args[1], t, 2); return CBoolean.get(left.canMultiply(right)); @@ -937,7 +938,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix left = MatrixHandling.getMatrix(args[0], t, 1); CReal2dMatrix right = MatrixHandling.getMatrix(args[1], t, 2); return CBoolean.get(left.canAdd(right)); @@ -1002,7 +1003,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix matrix = MatrixHandling.getMatrix(args[0], t, 1); return CBoolean.get(matrix.isSquare()); } @@ -1057,7 +1058,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix left = MatrixHandling.getMatrix(args[0], t, 1); CReal2dMatrix right = MatrixHandling.getMatrix(args[1], t, 2); double tolerance = ArgumentValidation.getDouble(args[2], t); @@ -1126,7 +1127,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix matrix = MatrixHandling.getMatrix(args[0], t, 1); return new CDouble(matrix.trace(t), t); } @@ -1182,7 +1183,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix matrix = MatrixHandling.getMatrix(args[0], t, 1); return new CDouble(matrix.determinant(t), t); } @@ -1239,7 +1240,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CReal2dMatrix matrix = MatrixHandling.getMatrix(args[0], t, 1); return new CDouble(matrix.norm(), t); } diff --git a/src/main/java/com/laytonsmith/core/functions/Meta.java b/src/main/java/com/laytonsmith/core/functions/Meta.java index 6f662587fe..a23dec1b3c 100644 --- a/src/main/java/com/laytonsmith/core/functions/Meta.java +++ b/src/main/java/com/laytonsmith/core/functions/Meta.java @@ -42,6 +42,7 @@ import com.laytonsmith.core.constructs.IVariable; import com.laytonsmith.core.constructs.Target; import com.laytonsmith.core.constructs.Variable; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; @@ -115,7 +116,7 @@ public Boolean runAsync() { return false; } - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(CommandHelperPlugin.isFirstLoad()); } @@ -151,7 +152,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, final Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, final Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args[1] instanceof CNull || args[1].val().isEmpty() || args[1].val().charAt(0) != '/') { throw new CREFormatException("The first character of the command must be a forward slash (i.e. '/give')", t); } @@ -159,7 +160,7 @@ public Mixed exec(Target t, final Environment env, Mixed... args) throws CancelC if(args[0].isInstanceOf(CArray.TYPE)) { CArray u = (CArray) args[0]; for(int i = 0; i < u.size(); i++) { - exec(t, env, new Mixed[]{new CString(u.get(i, t).val(), t), args[1]}); + exec(t, env, null, new Mixed[]{new CString(u.get(i, t).val(), t), args[1]}); } return CVoid.VOID; } @@ -258,7 +259,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed command; MCPlayer sender; if(args.length == 2) { @@ -271,7 +272,7 @@ public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntime //If the command sender is null, this is not a player, so just try to run() this. if(sender == null) { - return new run().exec(t, env, args); + return new run().exec(t, env, null, args); } if(command instanceof CNull || command.val().isEmpty() || command.val().charAt(0) != '/') { @@ -410,7 +411,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args[0] instanceof CNull || args[0].val().isEmpty() || args[0].val().charAt(0) != '/') { throw new CREFormatException("The first character of the command must be a forward slash (i.e. '/give')", t); } @@ -497,7 +498,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCCommandSender sender; String commandString; List argList; @@ -600,7 +601,7 @@ public Boolean runAsync() { } @Override - public CBoolean exec(Target t, Environment environment, Mixed... args) + public CBoolean exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { AliasCore ac = Static.getAliasCore(); @@ -679,7 +680,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); if(sender == null) { throw new CREException("No command sender in this context.", t); @@ -759,7 +760,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) { return null; } @@ -849,7 +850,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(environment.getEnv(CommandHelperEnvironment.class).GetCommand() == null) { return CNull.NULL; } else { @@ -883,7 +884,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String player = args[0].val(); String cmd = args[1].val(); if(cmd.isEmpty() || cmd.charAt(0) != '/') { @@ -963,7 +964,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCLocation loc; CArray ret; @@ -1022,7 +1023,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player; boolean state; if(args.length == 1) { @@ -1089,17 +1090,17 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CString s; if(args[0].isInstanceOf(CString.TYPE)) { s = (CString) args[0]; } else { s = new CString(args[0].val(), t); } - if(is_alias.exec(t, environment, s).getBoolean()) { - call_alias.exec(t, environment, s); + if(is_alias.exec(t, environment, null, s).getBoolean()) { + call_alias.exec(t, environment, null, s); } else { - run.exec(t, environment, s); + run.exec(t, environment, null, s); } return CVoid.VOID; } @@ -1164,7 +1165,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -1218,15 +1219,15 @@ public Boolean runAsync() { } @Override - public CArray exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CArray exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray c = new CArray(t); for(Locale l : Locale.getAvailableLocales()) { if(!l.getCountry().isEmpty()) { c.push(new CString(l.toString(), t), t); } } - new ArrayHandling.array_sort().exec(t, environment, c); - c = new ArrayHandling.array_unique().exec(t, environment, c); + new ArrayHandling.array_sort().exec(t, environment, null, c); + c = new ArrayHandling.array_unique().exec(t, environment, null, c); return c; } @@ -1280,12 +1281,12 @@ public Boolean runAsync() { } public static long GetEngineBuildDate() { - Mixed m = new engine_build_date().exec(Target.UNKNOWN, null); + Mixed m = new engine_build_date().exec(Target.UNKNOWN, null, null); return m instanceof CNull ? 0 : ((CInt) m).getInt(); } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { JarFile jf; try { String jar = ClassDiscovery.GetClassContainer(Meta.class).toString(); @@ -1341,7 +1342,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt(environment.getEnv(GlobalEnv.class).GetScript().getCompileTime(), t); } @@ -1386,7 +1387,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CResource<>(environment, t); } @@ -1433,7 +1434,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); for(FileOptions.CompilerOption s : FileOptions.CompilerOption.values()) { ret.push(new CString(s.getName(), t), t); @@ -1482,7 +1483,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); for(FileOptions.SuppressWarning s : FileOptions.SuppressWarning.values()) { ret.push(new CString(s.getName(), t), t); @@ -1533,7 +1534,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String name = ArgumentValidation.getString(args[0], t); Mixed setting = args[1]; environment.getEnv(GlobalEnv.class).SetRuntimeSetting(name, setting); @@ -1586,7 +1587,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String name = ArgumentValidation.getString(args[0], t); GlobalEnv env = environment.getEnv(GlobalEnv.class); if(env.GetRuntimeSetting(name) != null) { @@ -1645,7 +1646,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String name = ArgumentValidation.getString(args[0], t); return CBoolean.get(environment.getEnv(GlobalEnv.class).GetRuntimeSetting(name) != null); } @@ -1691,7 +1692,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { throw new Error(); } @@ -1768,7 +1769,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CString(ClassDiscovery.GetClassContainer(Meta.class).toString(), t); } @@ -1814,7 +1815,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { SmartComment comment = environment.getEnv(GlobalEnv.class).GetAliasComment(); if(comment == null) { return CNull.NULL; diff --git a/src/main/java/com/laytonsmith/core/functions/Minecraft.java b/src/main/java/com/laytonsmith/core/functions/Minecraft.java index 3cc9ad89c8..cf3ceab481 100644 --- a/src/main/java/com/laytonsmith/core/functions/Minecraft.java +++ b/src/main/java/com/laytonsmith/core/functions/Minecraft.java @@ -38,6 +38,7 @@ import com.laytonsmith.core.constructs.CNull; import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.constructs.Target; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; @@ -95,7 +96,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args[0].isInstanceOf(CInt.TYPE)) { return new CInt(ArgumentValidation.getInt(args[0], t), t); } @@ -225,7 +226,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int i = -1; int i2 = -1; if(args[0].isInstanceOf(CString.TYPE)) { @@ -309,7 +310,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray item = ArgumentValidation.getArray(args[0], t); MCItemStack is = ObjectGenerator.GetGenerator().item(item, t, true); return ObjectGenerator.GetGenerator().item(is, t); @@ -357,7 +358,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Mixed id = args[0]; if(id.isInstanceOf(CArray.TYPE)) { MCItemStack is = ObjectGenerator.GetGenerator().item(id, t); @@ -461,7 +462,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCLocation l = ObjectGenerator.GetGenerator().location(args[0], p == null ? null : p.getWorld(), t); MCEffect effect; @@ -629,7 +630,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCServer server = Static.getServer(); int index = -1; if(args.length == 0) { @@ -793,7 +794,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCServer server = Static.getServer(); CArray co = new CArray(t); List so = server.getBannedPlayers(); @@ -847,7 +848,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCServer server = Static.getServer(); CArray co = new CArray(t); List so = server.getWhitelistedPlayers(); @@ -881,7 +882,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(p != null) { @@ -941,7 +942,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(p != null) { @@ -1010,7 +1011,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = Static.GetPlayer(args[0], t); p.sendResourcePack(args[1].val()); return CVoid.VOID; @@ -1060,7 +1061,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCServer s = Static.getServer(); CArray ret = new CArray(t); for(String ip : s.getIPBans()) { @@ -1109,7 +1110,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCServer s = Static.getServer(); String ip = args[0].val(); if(ArgumentValidation.getBoolean(args[1], t)) { @@ -1151,7 +1152,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCMaterial mat = StaticLayer.GetMaterial(args[0].val()); if(mat == null) { try { @@ -1319,7 +1320,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws CancelCommandException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws CancelCommandException { Static.getServer().shutdown(); throw new CancelCommandException("", t); } @@ -1351,7 +1352,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld world = null; MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(p != null) { @@ -1414,7 +1415,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray mats = new CArray(t); for(String mat : MCMaterial.types()) { mats.push(new CString(mat, t), t); @@ -1465,7 +1466,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender; String selector; if(args.length == 2) { diff --git a/src/main/java/com/laytonsmith/core/functions/MobManagement.java b/src/main/java/com/laytonsmith/core/functions/MobManagement.java index a63db86dbf..01598158a4 100644 --- a/src/main/java/com/laytonsmith/core/functions/MobManagement.java +++ b/src/main/java/com/laytonsmith/core/functions/MobManagement.java @@ -38,6 +38,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREBadEntityException; @@ -108,7 +109,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity mob = Static.getLivingEntity(args[0], t); if(!mob.isTameable()) { throw new CREUntameableMobException("The specified entity is not tameable", t); @@ -164,7 +165,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity mob = Static.getLivingEntity(args[0], t); if(!mob.isTameable()) { throw new CREUntameableMobException("The specified entity is not tameable", t); @@ -221,7 +222,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity mob = Static.getLivingEntity(args[0], t); Mixed player = args[1]; if(!mob.isTameable()) { @@ -279,7 +280,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); double percent = ArgumentValidation.getDouble(args[1], t); if(percent < 0 || percent > 100) { @@ -331,7 +332,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); return new CDouble(e.getHealth() / e.getMaxHealth() * 100.0, t); } @@ -341,7 +342,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi public static class get_entity_breedable extends EntityManagement.EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity ent = Static.getEntity(args[0], t); if(ent instanceof MCBreedable) { @@ -371,7 +372,7 @@ public MSVersion since() { public static class set_entity_breedable extends EntityManagement.EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { boolean breed = ArgumentValidation.getBoolean(args[1], t); MCEntity ent = Static.getEntity(args[0], t); @@ -411,7 +412,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity ent = Static.getLivingEntity(args[0], t); if(ent instanceof MCAgeable mob) { return new CInt(mob.getAge(), t); @@ -447,7 +448,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int age = ArgumentValidation.getInt32(args[1], t); boolean lock = false; if(args.length == 3) { @@ -498,7 +499,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity ent = Static.getLivingEntity(args[0], t); if(ent instanceof MCAnimal animal) { return new CInt(animal.getLoveTicks(), t); @@ -533,7 +534,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity ent = Static.getLivingEntity(args[0], t); int ticks = ArgumentValidation.getInt32(args[1], t); if(ent instanceof MCAnimal animal) { @@ -564,7 +565,7 @@ public MSVersion since() { public static class get_mob_effects extends EntityManagement.EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity mob = Static.getLivingEntity(args[0], t); return ObjectGenerator.GetGenerator().potions(mob.getEffects(), t); } @@ -629,7 +630,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity mob = Static.getLivingEntity(args[0], t); MCPotionEffectType type = null; @@ -693,7 +694,7 @@ public MSVersion since() { public static class get_mob_target extends EntityManagement.EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity le = Static.getLivingEntity(args[0], t); if(le.getTarget(t) == null) { return CNull.NULL; @@ -728,7 +729,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity le = Static.getLivingEntity(args[0], t); MCLivingEntity target = null; if(!(args[1] instanceof CNull)) { @@ -760,7 +761,7 @@ public MSVersion since() { public static class get_mob_equipment extends EntityManagement.EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity le = Static.getLivingEntity(args[0], t); MCEntityEquipment eq = le.getEquipment(); if(eq == null) { @@ -809,7 +810,7 @@ public MSVersion since() { public static class set_mob_equipment extends EntityManagement.EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity le = Static.getLivingEntity(args[0], t); MCEntityEquipment ee = le.getEquipment(); if(ee == null) { @@ -870,7 +871,7 @@ public MSVersion since() { public static class get_max_health extends EntityManagement.EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity le = Static.getLivingEntity(args[0], t); return new CDouble(le.getMaxHealth(), t); } @@ -895,7 +896,7 @@ public MSVersion since() { public static class set_max_health extends EntityManagement.EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity le = Static.getLivingEntity(args[0], t); le.setMaxHealth(ArgumentValidation.getDouble(args[1], t)); return CVoid.VOID; @@ -929,7 +930,7 @@ public MSVersion since() { public static class get_equipment_droprates extends EntityManagement.EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity le = Static.getLivingEntity(args[0], t); if(le instanceof MCPlayer || le instanceof MCArmorStand) { throw new CREBadEntityException(getName() + "() does not work on type: " + le.getType(), t); @@ -968,7 +969,7 @@ public MSVersion since() { public static class set_equipment_droprates extends EntityManagement.EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity le = Static.getLivingEntity(args[0], t); if(le instanceof MCPlayer || le instanceof MCArmorStand) { throw new CREBadEntityException(getName() + "() does not work on type: " + le.getType(), t); @@ -1022,7 +1023,7 @@ public MSVersion since() { public static class can_pickup_items extends EntityManagement.EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(Static.getLivingEntity(args[0], t).getCanPickupItems()); } @@ -1046,7 +1047,7 @@ public MSVersion since() { public static class set_can_pickup_items extends EntityManagement.EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Static.getLivingEntity(args[0], t).setCanPickupItems(ArgumentValidation.getBoolean(args[1], t)); return CVoid.VOID; } @@ -1071,7 +1072,7 @@ public MSVersion since() { public static class get_entity_persistence extends EntityManagement.EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(!Static.getLivingEntity(args[0], t).getRemoveWhenFarAway()); } @@ -1095,7 +1096,7 @@ public MSVersion since() { public static class set_entity_persistence extends EntityManagement.EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Static.getLivingEntity(args[0], t).setRemoveWhenFarAway(!ArgumentValidation.getBoolean(args[1], t)); return CVoid.VOID; } @@ -1120,7 +1121,7 @@ public MSVersion since() { public static class get_leashholder extends EntityManagement.EntityGetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); if(!(e instanceof MCLeashable)) { throw new CREBadEntityException("Entity type is not leashable.", t); @@ -1153,7 +1154,7 @@ public MSVersion since() { public static class set_leashholder extends EntityManagement.EntitySetterFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity e = Static.getEntity(args[0], t); MCEntity holder; if(args[1] instanceof CNull) { @@ -1201,7 +1202,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt(Static.getLivingEntity(args[0], t).getRemainingAir(), t); } @@ -1225,7 +1226,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Static.getLivingEntity(args[0], t).setRemainingAir(ArgumentValidation.getInt32(args[1], t)); return CVoid.VOID; } @@ -1250,7 +1251,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt(Static.getLivingEntity(args[0], t).getMaximumAir(), t); } @@ -1274,7 +1275,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Static.getLivingEntity(args[0], t).setMaximumAir(ArgumentValidation.getInt32(args[1], t)); return CVoid.VOID; } @@ -1313,7 +1314,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity entity = Static.getLivingEntity(args[0], t); HashSet transparents = null; int maxDistance = 512; @@ -1387,7 +1388,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(Static.getLivingEntity(args[0], t).hasLineOfSight(Static.getEntity(args[1], t))); } @@ -1407,7 +1408,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCEntity entity = Static.getEntity(args[0], t); if(!(entity instanceof MCLivingEntity)) { @@ -1464,7 +1465,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); boolean glide = ArgumentValidation.getBoolean(args[1], t); @@ -1493,7 +1494,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.GenerateCBoolean(Static.getLivingEntity(args[0], t).isGliding(), t); } @@ -1517,7 +1518,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.GenerateCBoolean(Static.getLivingEntity(args[0], t).hasAI(), t); } @@ -1541,7 +1542,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); boolean ai = ArgumentValidation.getBoolean(args[1], t); @@ -1570,7 +1571,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.GenerateCBoolean(Static.getLivingEntity(args[0], t).isCollidable(), t); } @@ -1594,7 +1595,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); boolean collidable = ArgumentValidation.getBoolean(args[1], t); e.setCollidable(collidable); @@ -1644,7 +1645,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); MCAttribute attribute; try { @@ -1701,7 +1702,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); MCAttribute attribute; try { @@ -1758,7 +1759,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); MCAttribute attribute; try { @@ -1815,7 +1816,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); MCAttribute attribute; try { @@ -1877,7 +1878,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); MCAttribute attribute; try { @@ -1936,7 +1937,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); MCAttribute attribute; try { @@ -1995,7 +1996,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); MCAttributeModifier modifier = ObjectGenerator.GetGenerator().attributeModifier(ArgumentValidation.getArray(args[1], t), t); try { @@ -2048,7 +2049,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLivingEntity e = Static.getLivingEntity(args[0], t); MCAttributeModifier modifier = null; if(args.length == 2) { @@ -2131,7 +2132,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt(Static.getLivingEntity(args[0], t).getNoDamageTicks(), t); } @@ -2155,7 +2156,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Static.getLivingEntity(args[0], t).setNoDamageTicks(ArgumentValidation.getInt32(args[1], t)); return CVoid.VOID; } @@ -2181,7 +2182,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(Static.getLivingEntity(args[0], t).isSleeping()); } diff --git a/src/main/java/com/laytonsmith/core/functions/OAuth.java b/src/main/java/com/laytonsmith/core/functions/OAuth.java index b576bde393..b12acae478 100644 --- a/src/main/java/com/laytonsmith/core/functions/OAuth.java +++ b/src/main/java/com/laytonsmith/core/functions/OAuth.java @@ -20,6 +20,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.StaticRuntimeEnv; import com.laytonsmith.core.exceptions.CRE.CREFormatException; @@ -116,7 +117,7 @@ CArray toOptionsArray() { } public static String execute(Environment env, OAuthOptions options) { - return new x_get_oauth_token().exec(Target.UNKNOWN, env, options.toOptionsArray()).val(); + return new x_get_oauth_token().exec(Target.UNKNOWN, env, null, options.toOptionsArray()).val(); } @Override @@ -135,7 +136,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { // TODO: Make this part support profiles CArray options = ArgumentValidation.getArray(args[0], t); String authorizationUrl = options.get("authorizationUrl", t).val(); @@ -179,7 +180,7 @@ public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, M } String requestURI = generateRequestURI(authorizationUrl, clientId, scope, redirectUrl, extraHeaders); - new XGUI.x_launch_browser().exec(t, env, new CString(requestURI, t)); + new XGUI.x_launch_browser().exec(t, env, null, new CString(requestURI, t)); synchronized(lock) { if(lock.getObject() == null) { lock.wait(); @@ -207,7 +208,7 @@ public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, M switch(responseType) { case "application/json": { CArray tokenJson = (CArray) new DataTransformations.json_decode() - .exec(t, env, new CString(tokenResponse.getContentAsString(), t)); + .exec(t, env, null, new CString(tokenResponse.getContentAsString(), t)); if(tokenJson.containsKey("refresh_token")) { storeRefreshToken(env, clientId, tokenJson.get("refresh_token", t).val()); } @@ -246,7 +247,7 @@ public Mixed exec(Target t, com.laytonsmith.core.environments.Environment env, M tokenParameters.put("grant_type", "refresh_token"); settings.setParameters(tokenParameters); HTTPResponse tokenResponse = WebUtility.GetPage(new URL(tokenUrl), settings); - CArray tokenJson = (CArray) new DataTransformations.json_decode().exec(t, env, new CString(tokenResponse.getContentAsString(), t)); + CArray tokenJson = (CArray) new DataTransformations.json_decode().exec(t, env, null, new CString(tokenResponse.getContentAsString(), t)); accessToken = tokenJson.get("access_token", t).val(); storeAccessToken(env, clientId, new AccessToken(accessToken, ArgumentValidation.getInt32(tokenJson.get("expires_in", t), t) * 1000)); } @@ -500,7 +501,7 @@ public static void execute(Environment env, String clientId) { if(clientId != null) { args = new Mixed[]{new CString(clientId, Target.UNKNOWN)}; } - new clear_oauth_tokens().exec(Target.UNKNOWN, env, args); + new clear_oauth_tokens().exec(Target.UNKNOWN, env, null, args); } @Override @@ -519,7 +520,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { PersistenceNetwork pn = environment.getEnv(StaticRuntimeEnv.class).GetPersistenceNetwork(); String namespace = "oauth"; if(args.length >= 1) { diff --git a/src/main/java/com/laytonsmith/core/functions/OS.java b/src/main/java/com/laytonsmith/core/functions/OS.java index ebed196878..4c302a521b 100644 --- a/src/main/java/com/laytonsmith/core/functions/OS.java +++ b/src/main/java/com/laytonsmith/core/functions/OS.java @@ -6,6 +6,7 @@ import com.laytonsmith.core.MSVersion; import com.laytonsmith.core.constructs.CInt; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREThrowable; import com.laytonsmith.core.exceptions.CRE.CREUnsupportedOperationException; @@ -41,7 +42,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { return new CInt(OSUtils.GetMyPid(), t); } catch (UnsupportedOperationException ex) { diff --git a/src/main/java/com/laytonsmith/core/functions/ObjectManagement.java b/src/main/java/com/laytonsmith/core/functions/ObjectManagement.java index 2a6a3c7d76..c8fef22e5a 100644 --- a/src/main/java/com/laytonsmith/core/functions/ObjectManagement.java +++ b/src/main/java/com/laytonsmith/core/functions/ObjectManagement.java @@ -24,6 +24,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.NativeTypeList; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.exceptions.CRE.CREClassDefinitionError; @@ -80,7 +81,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @@ -131,7 +132,7 @@ public boolean useSpecialExec() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { throw new Error(); } @@ -197,7 +198,7 @@ private Mixed evaluateMixed(ParseTree data, Target t) { throw new CREClassDefinitionError("Expected __to_class_reference__, but found " + data.getData() + " instead", t); } - return new __to_class_reference__().exec(t, null, + return new __to_class_reference__().exec(t, null, null, data.getChildren().stream() .map((parseTree -> parseTree.getData())) .collect(Collectors.toList()) @@ -448,7 +449,7 @@ public boolean useSpecialExec() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { throw new Error(); } @@ -597,7 +598,7 @@ public Class[] thrown() { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { return CClassType.get(FullyQualifiedClassName.forFullyQualifiedClass(args[0].val())); } catch (ClassNotFoundException ex) { diff --git a/src/main/java/com/laytonsmith/core/functions/Performance.java b/src/main/java/com/laytonsmith/core/functions/Performance.java index 38adac62bd..efcbb96276 100644 --- a/src/main/java/com/laytonsmith/core/functions/Performance.java +++ b/src/main/java/com/laytonsmith/core/functions/Performance.java @@ -7,6 +7,7 @@ import com.laytonsmith.core.Static; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRESecurityException; import com.laytonsmith.core.exceptions.CRE.CREThrowable; @@ -83,7 +84,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!Prefs.AllowProfiling()) { throw new CRESecurityException("allow-profiling is currently off, you must set it to true in your preferences.", t); } diff --git a/src/main/java/com/laytonsmith/core/functions/Permissions.java b/src/main/java/com/laytonsmith/core/functions/Permissions.java index e90b3e6474..0890ecefab 100644 --- a/src/main/java/com/laytonsmith/core/functions/Permissions.java +++ b/src/main/java/com/laytonsmith/core/functions/Permissions.java @@ -7,6 +7,7 @@ import com.laytonsmith.core.Static; import com.laytonsmith.core.constructs.CBoolean; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; @@ -70,7 +71,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender; String permission; diff --git a/src/main/java/com/laytonsmith/core/functions/Persistence.java b/src/main/java/com/laytonsmith/core/functions/Persistence.java index 1d3e7804e5..dc520ce27b 100644 --- a/src/main/java/com/laytonsmith/core/functions/Persistence.java +++ b/src/main/java/com/laytonsmith/core/functions/Persistence.java @@ -15,6 +15,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.environments.StaticRuntimeEnv; @@ -91,7 +92,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { String key = GetNamespace(args, args.length - 1, getName(), t); String value = null; try { @@ -174,7 +175,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { Object o; String namespace = GetNamespace(args, null, getName(), t); MSLog.GetLogger().Log(MSLog.Tags.PERSISTENCE, LogLevel.DEBUG, "Getting value: " + namespace, t); @@ -264,7 +265,7 @@ public ExampleScript[] examples() throws ConfigCompileException { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { PersistenceNetwork p = environment.getEnv(StaticRuntimeEnv.class).GetPersistenceNetwork(); List keyChain = new ArrayList(); keyChain.add("storage"); @@ -345,7 +346,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { return CBoolean.get(env.getEnv(StaticRuntimeEnv.class).GetPersistenceNetwork() .hasKey(("storage." + GetNamespace(args, null, getName(), t)).split("\\."))); @@ -403,7 +404,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String namespace = GetNamespace(args, null, getName(), t); MSLog.GetLogger().Log(MSLog.Tags.PERSISTENCE, LogLevel.DEBUG, "Clearing value: " + namespace, t); try { diff --git a/src/main/java/com/laytonsmith/core/functions/PlayerManagement.java b/src/main/java/com/laytonsmith/core/functions/PlayerManagement.java index 21acb4dd87..c1fc00040f 100644 --- a/src/main/java/com/laytonsmith/core/functions/PlayerManagement.java +++ b/src/main/java/com/laytonsmith/core/functions/PlayerManagement.java @@ -60,6 +60,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; @@ -119,7 +120,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); if(args.length == 1) { @@ -197,7 +198,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCOfflinePlayer pl = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); boolean dashless = false; if(args.length >= 1) { @@ -262,7 +263,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray players = new CArray(t); if(args.length == 0) { for(MCPlayer player : Static.getServer().getOnlinePlayers()) { @@ -359,7 +360,7 @@ boolean inRadius(MCPlayer player, double dist, MCLocation loc) { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Collection pa = Static.getServer().getOnlinePlayers(); MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -431,7 +432,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 0) { p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -521,7 +522,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCLocation l; if(args.length <= 2) { @@ -621,7 +622,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); HashSet trans = null; int transparentIndex = -1; @@ -720,7 +721,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length > 0) { p = Static.GetPlayer(args[0], t); @@ -770,7 +771,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; if(args.length == 1) { @@ -825,7 +826,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender sender; if(args.length == 0) { sender = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); @@ -938,7 +939,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender m = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); String player; int index; @@ -1126,7 +1127,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; if(args.length == 0) { @@ -1182,7 +1183,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); String message = "You have been kicked"; MCPlayer m = null; @@ -1264,7 +1265,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m; if(args.length == 0) { m = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -1338,7 +1339,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player; String name; if(args.length == 1) { @@ -1415,7 +1416,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player; if(args.length == 0) { player = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -1485,7 +1486,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); //Getter if(args.length == 0 || args.length == 1) { @@ -1624,7 +1625,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; if(p instanceof MCPlayer) { @@ -1685,7 +1686,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; String mode; @@ -1750,7 +1751,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; if(p instanceof MCPlayer) { @@ -1804,7 +1805,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; int xp; @@ -1865,7 +1866,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = environment.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; int xp; @@ -1924,7 +1925,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; if(p instanceof MCPlayer) { @@ -1977,7 +1978,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; int level; @@ -2035,7 +2036,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; if(p instanceof MCPlayer) { @@ -2045,7 +2046,7 @@ public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntime m = Static.GetPlayer(args[0].val(), t); } Static.AssertPlayerNonNull(m, t); - int texp = m.getExpAtLevel() + java.lang.Math.round(m.getExpToLevel() * m.getExp()); + int texp = m.getExpAtLevel()+ java.lang.Math.round(m.getExpToLevel() * m.getExp()); return new CInt(texp, t); } } @@ -2089,7 +2090,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; int xp; @@ -2154,7 +2155,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; if(p instanceof MCPlayer) { @@ -2207,7 +2208,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; int level; @@ -2277,7 +2278,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = Static.GetPlayer(args[0].val(), t); MCPotionEffectType type = null; @@ -2366,7 +2367,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length > 0) { p = Static.GetPlayer(args[0], t); @@ -2419,7 +2420,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 0) { p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -2491,7 +2492,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m; if(args.length == 0) { m = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -2542,7 +2543,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m; if(args.length == 0) { m = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -2594,7 +2595,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; if(p instanceof MCPlayer) { @@ -2658,7 +2659,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { //Static.GetPlayer() autocompletes names, which we don't want in this function, //however we have to check if this is an injected player first. @@ -2715,7 +2716,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCOfflinePlayer pl = Static.GetUser(args[0].val(), t); return CBoolean.get(pl != null && pl.isWhitelisted()); } @@ -2761,7 +2762,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCOfflinePlayer pl = Static.GetUser(args[0].val(), t); boolean whitelist = ArgumentValidation.getBoolean(args[1], t); if(pl == null) { @@ -2824,7 +2825,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCOfflinePlayer pl = Static.GetUser(args[0].val(), t); if(pl == null) { throw new CRENotFoundException( @@ -2879,7 +2880,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String target = args[0].val(); boolean ban = ArgumentValidation.getBoolean(args[1], t); String reason = ""; @@ -2952,7 +2953,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; double speed; @@ -3016,7 +3017,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; @@ -3074,7 +3075,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; double speed; @@ -3138,7 +3139,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer m = null; @@ -3195,7 +3196,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { m = Static.GetPlayer(args[0].val(), t); @@ -3244,7 +3245,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCLocation l; if(args.length == 1) { @@ -3302,7 +3303,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { m = Static.GetPlayer(args[0].val(), t); @@ -3352,7 +3353,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -3403,7 +3404,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); Mixed ticks; if(args.length == 2) { @@ -3461,7 +3462,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -3511,7 +3512,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); boolean flight; if(args.length == 1) { @@ -3596,7 +3597,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = null; boolean relative = false; if(environment.getEnv(CommandHelperEnvironment.class).GetPlayer() != null) { @@ -3692,7 +3693,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = null; if(environment.getEnv(CommandHelperEnvironment.class).GetPlayer() != null) { p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -3744,7 +3745,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = null; if(environment.getEnv(CommandHelperEnvironment.class).GetPlayer() != null) { p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -3777,7 +3778,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { m = Static.GetPlayer(args[0], t); @@ -3827,7 +3828,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); int offset = 0; if(args.length == 2) { @@ -3887,7 +3888,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m; String listName; if(args.length == 2) { @@ -3943,7 +3944,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -4010,7 +4011,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -4054,7 +4055,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); Vector3D v; int offset = 0; @@ -4142,7 +4143,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); int offset = 0; if(args.length == 3 || args.length == 6) { @@ -4296,7 +4297,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); int offset = 0; if(args.length == 3) { @@ -4408,7 +4409,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCLocation location; float progress; @@ -4477,7 +4478,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -4526,7 +4527,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); int hungerIndex = 0; if(args.length == 2) { @@ -4579,7 +4580,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -4628,7 +4629,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); float saturation; int saturationIndex = 0; @@ -4680,7 +4681,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCOfflinePlayer player = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { player = Static.GetUser(args[0].val(), t); @@ -4771,7 +4772,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCCommandSender p = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); String pname = null; MCPlayer m = null; @@ -4894,7 +4895,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { p = Static.GetPlayer(args[0].val(), t); @@ -4949,7 +4950,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(args.length == 1) { p = Static.GetPlayer(args[0].val(), t); @@ -4979,7 +4980,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCServer s = Static.getServer(); CArray ret = new CArray(t); // This causes the function to return an empty array for a fake/null server. @@ -5042,7 +5043,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCOfflinePlayer offp = Static.GetUser(args[0].val(), t); return CBoolean.get(offp != null && offp.hasPlayedBefore()); } @@ -5099,7 +5100,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCOfflinePlayer op; if(args.length == 1) { op = Static.GetUser(args[0].val(), t); @@ -5110,7 +5111,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi + " requires a player argument when ran from a non-player", t); } } - return new CInt((op == null ? 0 : op.getFirstPlayed()), t); // Return 0 for fake/null command senders. + return new CInt((op == null ? 0 : op.getFirstPlayed()), t);// Return 0 for fake/null command senders. } @Override @@ -5166,7 +5167,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCOfflinePlayer op; if(args.length == 1) { op = Static.GetUser(args[0].val(), t); @@ -5177,7 +5178,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi + " requires a player argument when ran from a non-player", t); } } - return new CInt((op == null ? 0 : op.getLastPlayed()), t); // Return 0 for fake/null command senders. + return new CInt((op == null ? 0 : op.getLastPlayed()), t);// Return 0 for fake/null command senders. } @Override @@ -5232,7 +5233,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCOfflinePlayer p = Static.GetUser(args[0].val(), t); if(p == null) { return CNull.NULL; @@ -5286,7 +5287,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Static.getServer().savePlayers(); return CVoid.VOID; } @@ -5348,7 +5349,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); boolean flight; if(args.length == 1) { @@ -5416,7 +5417,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -5469,7 +5470,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 0) { p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -5530,7 +5531,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; int offset = 0; if(args.length == 1) { @@ -5578,7 +5579,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = Static.GetPlayer(args[0], t); @@ -5663,7 +5664,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = Static.GetPlayer(args[0], t); @@ -5719,7 +5720,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, Mixed... args) + public Mixed exec(Target t, com.laytonsmith.core.environments.Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = Static.GetPlayer(args[0], t); @@ -5798,7 +5799,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; String materialName; if(args.length == 2) { @@ -5862,7 +5863,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; String materialName; int cooldown; @@ -5932,7 +5933,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCHumanEntity he; if(args.length == 0) { he = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -5985,7 +5986,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 2) { p = Static.GetPlayer(args[0], t); @@ -6039,7 +6040,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; String header; if(args.length == 2) { @@ -6095,7 +6096,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 2) { p = Static.GetPlayer(args[0], t); @@ -6149,7 +6150,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; String footer; if(args.length == 2) { @@ -6206,7 +6207,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); if(p == null) { throw new CREPlayerOfflineException("ptellraw() requires player context. Consider tellraw().", t); @@ -6311,7 +6312,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); String filter = null; MCPlayerStatistic stat; @@ -6414,7 +6415,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); String filter = null; MCPlayerStatistic stat; @@ -6536,7 +6537,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -6587,7 +6588,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -6625,7 +6626,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { p = Static.GetPlayer(args[0], t); @@ -6690,7 +6691,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; Mixed c; if(args.length == 2) { @@ -6778,7 +6779,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 0) { p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -6829,7 +6830,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; String stringKey; if(args.length == 1) { @@ -6889,7 +6890,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; Mixed value; if(args.length == 1) { @@ -6960,7 +6961,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 0) { p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -7014,7 +7015,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCEntity e; if(args.length == 1) { @@ -7069,7 +7070,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCEntity e; if(args.length == 1) { @@ -7125,7 +7126,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCEntity e; if(args.length == 1) { @@ -7183,7 +7184,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; MCLivingEntity le; Mixed equipment; @@ -7255,7 +7256,7 @@ public String docs() { + " This is an indicator of the quality of the player's connection, as represented in the tab list."; } - public Construct exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Construct exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { p = Static.GetPlayer(args[0].val(), t); @@ -7300,7 +7301,7 @@ public String docs() { + " Array contains the following keys: forward, backward, left, right, jump, sneak, and sprint."; } - public Construct exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Construct exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p; if(args.length == 1) { p = Static.GetPlayer(args[0].val(), t); @@ -7349,7 +7350,7 @@ public static class set_player_sleeping_ignored extends AbstractFunction { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final MCPlayer player; final boolean value; @@ -7405,7 +7406,7 @@ public static class is_player_sleeping_ignored extends AbstractFunction { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final MCPlayer player; if(args.length == 0) { @@ -7480,7 +7481,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer thisPlayer; boolean isVanished; MCPlayer otherPlayer; @@ -7539,7 +7540,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer thisPlayer; MCPlayer otherPlayer; if(args.length == 1) { diff --git a/src/main/java/com/laytonsmith/core/functions/PluginMeta.java b/src/main/java/com/laytonsmith/core/functions/PluginMeta.java index f7c1ff5926..ba04388ad9 100644 --- a/src/main/java/com/laytonsmith/core/functions/PluginMeta.java +++ b/src/main/java/com/laytonsmith/core/functions/PluginMeta.java @@ -14,6 +14,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -55,7 +56,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPluginMeta meta = StaticLayer.GetConvertor().GetPluginMeta(); MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); int offset = 0; @@ -118,7 +119,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); int offset = 0; @@ -183,7 +184,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCMessenger messenger = Static.getServer().getMessenger(); if(messenger == null) { throw new CRENotFoundException( @@ -248,7 +249,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCMessenger messenger = Static.getServer().getMessenger(); if(messenger == null) { throw new CRENotFoundException( @@ -309,7 +310,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCMessenger messenger = Static.getServer().getMessenger(); if(messenger == null) { throw new CRENotFoundException( @@ -363,7 +364,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCMessenger messenger = Static.getServer().getMessenger(); if(messenger == null) { throw new CRENotFoundException( diff --git a/src/main/java/com/laytonsmith/core/functions/Recipes.java b/src/main/java/com/laytonsmith/core/functions/Recipes.java index 16749a8b29..8bb8a493c7 100644 --- a/src/main/java/com/laytonsmith/core/functions/Recipes.java +++ b/src/main/java/com/laytonsmith/core/functions/Recipes.java @@ -11,6 +11,7 @@ import com.laytonsmith.core.constructs.CBoolean; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -56,7 +57,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { return CBoolean.get(Static.getServer().addRecipe(ObjectGenerator.GetGenerator().recipe(args[0], t))); } catch (IllegalStateException ex) { @@ -212,7 +213,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(Static.getServer().removeRecipe(args[0].val())); } @@ -247,7 +248,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); MCItemStack item = ObjectGenerator.GetGenerator().item(args[0], t); List recipes = Static.getServer().getRecipesFor(item); @@ -291,7 +292,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); List recipes = Static.getServer().allRecipes(); for(MCRecipe recipe : recipes) { @@ -332,7 +333,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Static.getServer().clearRecipes(); return CVoid.VOID; } @@ -368,7 +369,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Static.getServer().resetRecipes(); return CVoid.VOID; } diff --git a/src/main/java/com/laytonsmith/core/functions/Reflection.java b/src/main/java/com/laytonsmith/core/functions/Reflection.java index 83e53f70ee..c17e5569b8 100644 --- a/src/main/java/com/laytonsmith/core/functions/Reflection.java +++ b/src/main/java/com/laytonsmith/core/functions/Reflection.java @@ -30,6 +30,7 @@ import com.laytonsmith.core.constructs.IVariable; import com.laytonsmith.core.constructs.NativeTypeList; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; @@ -203,7 +204,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length < 1) { throw new CREInsufficientArgumentsException("Not enough parameters was sent to " + getName(), t); } @@ -296,7 +297,7 @@ public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntime l.forEach((String t1) -> { a.push(new CString(t1, Target.UNKNOWN), Target.UNKNOWN); }); - return new ArrayHandling.array_sort().exec(t, env, a); + return new ArrayHandling.array_sort().exec(t, env, null, a); } else if(args.length == 2) { Keyword k = KeywordList.getKeywordByName(args[1].val()); if(k == null) { @@ -355,7 +356,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CClassType type = ArgumentValidation.getClassType(args[0], t); CArray ret = CArray.GetAssociativeArray(t); ret.set("fqcn", type.getFQCN().getFQCN()); @@ -442,7 +443,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String element = args[0].val(); DocField docField; try { @@ -596,7 +597,7 @@ private void initf(Environment env) { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = CArray.GetAssociativeArray(t); if(FUNCS.keySet().size() < 10) { initf(environment); @@ -653,7 +654,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); for(Event event : EventList.GetEvents()) { @@ -703,7 +704,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); for(Script s : Static.getAliasCore().getScripts()) { ret.push(new CString(s.getSignature(), t), t); @@ -752,7 +753,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { PersistenceNetwork pn = environment.getEnv(StaticRuntimeEnv.class).GetPersistenceNetwork(); return new CString(pn.getKeySource(args[0].val().split("\\.")).toString(), t); } @@ -803,7 +804,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); for(Map.Entry p : environment.getEnv(GlobalEnv.class).GetProcs().entrySet()) { ret.push(new CString(p.getKey(), t), t); @@ -868,7 +869,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); ObjectDefinitionTable odt = environment.getEnv(CompilerEnvironment.class).getObjectDefinitionTable(); for(ObjectDefinition od : odt.getObjectDefinitionSet()) { @@ -936,7 +937,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String type = ArgumentValidation.getStringObject(args[0], t); try { return CClassType.get(FullyQualifiedClassName.forName(args[0].val(), t, environment)); diff --git a/src/main/java/com/laytonsmith/core/functions/Regex.java b/src/main/java/com/laytonsmith/core/functions/Regex.java index d4fc2aba6b..c0ceacefef 100644 --- a/src/main/java/com/laytonsmith/core/functions/Regex.java +++ b/src/main/java/com/laytonsmith/core/functions/Regex.java @@ -16,6 +16,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; import com.laytonsmith.core.exceptions.CRE.CREFormatException; @@ -90,7 +91,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Pattern pattern = getPattern(args[0], t); String subject = args[1].val(); Matcher m = pattern.matcher(subject); @@ -178,7 +179,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Pattern pattern = getPattern(args[0], t); String subject = args[1].val(); CArray fret = new CArray(t); @@ -271,7 +272,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Pattern pattern = getPattern(args[0], t); Mixed replacement = args[1]; String subject = args[2].val(); @@ -392,7 +393,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Pattern pattern = getPattern(args[0], t); String subject = args[1].val(); /** @@ -492,7 +493,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Pattern pattern = getPattern(args[0], t); String subject = args[1].val(); long ret = 0; @@ -551,7 +552,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CString(java.util.regex.Pattern.quote(args[0].val()), t); } diff --git a/src/main/java/com/laytonsmith/core/functions/ResourceManager.java b/src/main/java/com/laytonsmith/core/functions/ResourceManager.java index 290d6ba6a3..ac740b4657 100644 --- a/src/main/java/com/laytonsmith/core/functions/ResourceManager.java +++ b/src/main/java/com/laytonsmith/core/functions/ResourceManager.java @@ -11,6 +11,7 @@ import com.laytonsmith.core.constructs.CResource; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; import com.laytonsmith.core.exceptions.CRE.CREFormatException; @@ -110,7 +111,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { ResourceTypes type; Mixed data = null; try { @@ -209,7 +210,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CResource.TYPE)) { CResource resource = (CResource) args[0]; if(RESOURCES.containsKey(resource.getId())) { diff --git a/src/main/java/com/laytonsmith/core/functions/SQL.java b/src/main/java/com/laytonsmith/core/functions/SQL.java index 18e1d36c3c..12fbc24942 100644 --- a/src/main/java/com/laytonsmith/core/functions/SQL.java +++ b/src/main/java/com/laytonsmith/core/functions/SQL.java @@ -28,6 +28,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.StaticRuntimeEnv; import com.laytonsmith.core.exceptions.ConfigCompileException; @@ -150,7 +151,7 @@ public void run() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { Profiles.Profile profile; if(args[0].isInstanceOf(CArray.TYPE)) { @@ -495,7 +496,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(final Target t, final Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { startup(); Mixed arg = args[args.length - 1]; if(!(arg.isInstanceOf(CClosure.TYPE))) { @@ -512,7 +513,7 @@ public void run() { Mixed returnValue = CNull.NULL; Mixed exception = CNull.NULL; try { - returnValue = new query().exec(t, environment, newArgs); + returnValue = new query().exec(t, environment, null, newArgs); } catch (ConfigRuntimeException ex) { exception = ObjectGenerator.GetGenerator().exception(ex, environment, t); } diff --git a/src/main/java/com/laytonsmith/core/functions/Sandbox.java b/src/main/java/com/laytonsmith/core/functions/Sandbox.java index 037cf53459..1d5664ef5a 100644 --- a/src/main/java/com/laytonsmith/core/functions/Sandbox.java +++ b/src/main/java/com/laytonsmith/core/functions/Sandbox.java @@ -25,6 +25,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; @@ -106,7 +107,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { BoundEvent.ActiveEvent original = environment.getEnv(GlobalEnv.class).GetEvent(); if(original == null) { throw new CREBindException("is_cancelled cannot be called outside an event handler", t); @@ -155,7 +156,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CString(GenerateMooSaying(args[0].val()) + " \\ ^__^\n" + " \\ (oo)\\_______\n" @@ -176,7 +177,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CString( GenerateMooSaying(args[0].val()) + " ^__^ /\n" @@ -198,7 +199,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CString(" .-*)) `*-.\n" + " /* ((* *'.\n" + "| *)) * *\\\n" @@ -215,7 +216,7 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi public static class norway extends DummyFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCChatColor red = MCChatColor.RED; MCChatColor white = MCChatColor.WHITE; MCChatColor blue = MCChatColor.BLUE; @@ -279,7 +280,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Random r; try { r = (Random) ArgumentValidation.getObject(args[0], t, CResource.class).getResource(); @@ -407,7 +408,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { File file = Static.GetFileFromArgument(args[0].val(), env, t, null).getCanonicalFile(); if(!Static.InCmdLine(env, true) && !Security.CheckSecurity(file)) { @@ -486,7 +487,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(!Static.InCmdLine(environment, true)) { throw new CRESecurityException(getName() + " is only available in cmdline mode.", t); } diff --git a/src/main/java/com/laytonsmith/core/functions/Scheduling.java b/src/main/java/com/laytonsmith/core/functions/Scheduling.java index 6c9cff182a..8f50b54b50 100644 --- a/src/main/java/com/laytonsmith/core/functions/Scheduling.java +++ b/src/main/java/com/laytonsmith/core/functions/Scheduling.java @@ -30,6 +30,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.environments.StaticRuntimeEnv; @@ -130,7 +131,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return new CInt(System.currentTimeMillis(), t); } } @@ -175,7 +176,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return new CInt(System.nanoTime(), t); } } @@ -220,7 +221,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { Mixed x = args[0]; double time = ArgumentValidation.getNumber(x, t); try { @@ -277,7 +278,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(final Target t, final Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { long time = ArgumentValidation.getInt(args[0], t); int offset = 0; long delay = time; @@ -383,7 +384,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(final Target t, final Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final TaskManager taskManager = environment.getEnv(StaticRuntimeEnv.class).GetTaskManager(); long time = ArgumentValidation.getInt(args[0], t); if(time < 0) { @@ -497,7 +498,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length == 0 && environment.getEnv(GlobalEnv.class).GetCustom("timeout-id") != null) { StaticLayer.ClearFutureRunnable((Integer) environment.getEnv(GlobalEnv.class).GetCustom("timeout-id")); } else if(args.length == 1) { @@ -613,7 +614,7 @@ public Boolean runAsync() { } @Override - public CString exec(Target t, Environment env, Mixed... args) { + public CString exec(Target t, Environment env, GenericParameters generics, Mixed... args) { Date now = new Date(); if(args.length >= 2 && !(args[1] instanceof CNull)) { now = new Date(ArgumentValidation.getInt(args[1], t)); @@ -684,7 +685,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { SimpleDateFormat dateFormat; Locale locale = Locale.getDefault(); if(args.length >= 3) { @@ -765,7 +766,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String[] timezones = ArrayUtils.EMPTY_STRING_ARRAY; try { timezones = TimeZone.getAvailableIDs(); @@ -852,7 +853,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { //First things first, check the format of the arguments. if(!(args[0].isInstanceOf(CString.TYPE))) { throw new CRECastException("Expected string for argument 1 in " + getName(), t); @@ -1204,7 +1205,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Integer id = (Integer) environment.getEnv(GlobalEnv.class).GetCustom("cron-task-id"); if(args.length == 1) { id = (int) ArgumentValidation.getInt(args[0], t); diff --git a/src/main/java/com/laytonsmith/core/functions/Scoreboards.java b/src/main/java/com/laytonsmith/core/functions/Scoreboards.java index a0998c38f2..17b9dd9202 100644 --- a/src/main/java/com/laytonsmith/core/functions/Scoreboards.java +++ b/src/main/java/com/laytonsmith/core/functions/Scoreboards.java @@ -28,6 +28,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREFormatException; @@ -256,7 +257,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = Static.GetPlayer(args[0], t); String ret; try { @@ -300,7 +301,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = Static.GetPlayer(args[0], t); p.setScoreboard(assignBoard(1, t, args)); return CVoid.VOID; @@ -337,7 +338,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); for(String id : BOARDS.keySet()) { ret.push(new CString(id, t), t); @@ -372,7 +373,7 @@ public MSVersion since() { public static class get_objectives extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s; if(args.length == 0) { s = getBoard(MAIN, t); @@ -436,7 +437,7 @@ public MSVersion since() { public static class get_teams extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s; if(args.length == 0) { s = getBoard(MAIN, t); @@ -483,7 +484,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard newBoard = Static.getServer().getNewScoreboard(); if(newBoard == null) { throw new CRENullPointerException( @@ -520,7 +521,7 @@ public MSVersion since() { public static class create_objective extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(2, t, args); String name = args[0].val(); MCCriteria criteria = MCCriteria.DUMMY; @@ -568,7 +569,7 @@ public MSVersion since() { public static class create_team extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(1, t, args); String name = args[0].val(); try { @@ -611,7 +612,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(2, t, args); MCObjective o = s.getObjective(args[0].val()); if(o == null) { @@ -692,7 +693,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(2, t, args); MCTeam o = s.getTeam(args[0].val()); if(o == null) { @@ -797,7 +798,7 @@ public MSVersion since() { public static class team_add_player extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(2, t, args); MCTeam team = s.getTeam(args[0].val()); if(team == null) { @@ -833,7 +834,7 @@ public MSVersion since() { public static class team_remove_player extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(2, t, args); MCTeam team = s.getTeam(args[0].val()); if(team == null) { @@ -868,7 +869,7 @@ public MSVersion since() { public static class get_pteam extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(1, t, args); MCTeam team = s.getPlayerTeam(args[0].val()); if(team == null) { @@ -904,7 +905,7 @@ public MSVersion since() { public static class remove_scoreboard extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String id = args[0].val(); boolean nullify = true; if(args.length == 2) { @@ -960,7 +961,7 @@ public MSVersion since() { public static class remove_objective extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(1, t, args); MCObjective o = s.getObjective(args[0].val()); try { @@ -998,7 +999,7 @@ public MSVersion since() { public static class remove_team extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(1, t, args); MCTeam team = s.getTeam(args[0].val()); try { @@ -1041,7 +1042,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(2, t, args); MCObjective o = s.getObjective(args[0].val()); if(o == null) { @@ -1086,7 +1087,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(3, t, args); MCObjective o = s.getObjective(args[0].val()); if(o == null) { @@ -1127,7 +1128,7 @@ public MSVersion since() { public static class reset_all_pscores extends SBFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { assignBoard(1, t, args).resetScores(args[0].val()); return CVoid.VOID; } @@ -1163,7 +1164,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(2, t, args); MCTeam team = s.getTeam(args[0].val()); if(team == null) { @@ -1254,7 +1255,7 @@ public MSVersion since() { public static class get_scoreboard_entries extends SBFunction { @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCScoreboard s = assignBoard(0, t, args); Set entries = s.getEntries(); CArray ret = new CArray(t, entries.size()); diff --git a/src/main/java/com/laytonsmith/core/functions/Statistics.java b/src/main/java/com/laytonsmith/core/functions/Statistics.java index 53484ad166..dc42d9c05d 100644 --- a/src/main/java/com/laytonsmith/core/functions/Statistics.java +++ b/src/main/java/com/laytonsmith/core/functions/Statistics.java @@ -10,6 +10,7 @@ import com.laytonsmith.core.constructs.CDouble; import com.laytonsmith.core.constructs.CNumber; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; import com.laytonsmith.core.exceptions.CRE.CREIndexOverflowException; @@ -67,7 +68,7 @@ public Set optimizationOptions() { public static class average extends StatisticsFunction { @Override - public CNumber exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CNumber exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { long count; if(args.length == 1 && args[0].isInstanceOf(CArray.TYPE)) { CArray c = ArgumentValidation.getArray(args[0], t); @@ -75,7 +76,7 @@ public CNumber exec(Target t, Environment environment, Mixed... args) throws Con } else { count = args.length; } - double sum = new sum().exec(t, environment, args).getNumber(); + double sum = new sum().exec(t, environment, null, args).getNumber(); return new CDouble(sum / count, t); } @@ -117,7 +118,7 @@ public ExampleScript[] examples() throws ConfigCompileException { public static class sum extends StatisticsFunction { @Override - public CNumber exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CNumber exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { List values = new ArrayList<>(); if(args.length == 1 && args[0].isInstanceOf(CArray.TYPE)) { CArray c = ArgumentValidation.getArray(args[0], t); @@ -173,7 +174,7 @@ public ExampleScript[] examples() throws ConfigCompileException { public static class median extends StatisticsFunction { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { List values = new ArrayList<>(); if(args.length == 1 && args[0].isInstanceOf(CArray.TYPE)) { CArray c = ArgumentValidation.getArray(args[0], t); @@ -237,7 +238,7 @@ public ExampleScript[] examples() throws ConfigCompileException { public static class mode extends StatisticsFunction { @Override - public CArray exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public CArray exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { List values = new ArrayList<>(); if(args.length == 1 && args[0].isInstanceOf(CArray.TYPE)) { CArray c = ArgumentValidation.getArray(args[0], t); @@ -336,7 +337,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { double percentile = ArgumentValidation.getDouble(args[0], t); List values = new ArrayList<>(); if(args.length == 2 && args[1].isInstanceOf(CArray.TYPE)) { diff --git a/src/main/java/com/laytonsmith/core/functions/StringHandling.java b/src/main/java/com/laytonsmith/core/functions/StringHandling.java index cc9e8b0fbe..3d2c74eed5 100644 --- a/src/main/java/com/laytonsmith/core/functions/StringHandling.java +++ b/src/main/java/com/laytonsmith/core/functions/StringHandling.java @@ -33,6 +33,7 @@ import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.InstanceofUtil; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; import com.laytonsmith.core.exceptions.CRE.CREError; @@ -97,7 +98,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { StringBuilder b = new StringBuilder(); for(int i = 0; i < args.length; i++) { b.append(args[i].val()); @@ -172,7 +173,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { StringBuilder b = new StringBuilder(); for(int i = 0; i < args.length; i++) { if(i > 0) { @@ -301,7 +302,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { String thing = args[0].val(); String what = args[1].val(); String that = args[2].val(); @@ -362,7 +363,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { String string = args[0].val(); boolean useAdvanced = false; if(args.length >= 2) { @@ -469,7 +470,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return new CString(args[0].val().trim(), args[0].getTarget()); } @@ -526,7 +527,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return new CString(StringUtils.trimRight(args[0].val()), args[0].getTarget()); } @@ -583,7 +584,7 @@ public MSVersion since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { return new CString(StringUtils.trimLeft(args[0].val()), t); } @@ -646,7 +647,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args[0].isInstanceOf(Sizeable.TYPE)) { return new CInt(((Sizeable) args[0]).size(), t); } else { @@ -708,7 +709,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(!(args[0].isInstanceOf(CString.TYPE))) { throw new CREFormatException(this.getName() + " expects a string as first argument, but type " + args[0].typeof() + " was found.", t); @@ -771,7 +772,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(!(args[0].isInstanceOf(CString.TYPE))) { throw new CREFormatException(this.getName() + " expects a string as first argument, but type " + args[0].typeof() + " was found.", t); @@ -837,7 +838,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { try { String s = args[0].val(); int begin = ArgumentValidation.getInt32(args[1], t); @@ -893,7 +894,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { Static.AssertNonCNull(t, args); String teststring = args[0].val(); @@ -961,7 +962,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { Static.AssertNonCNull(t, args); String teststring = args[0].val(); @@ -1021,7 +1022,7 @@ public String getName() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { if(args[0] instanceof CNull) { throw new CRECastException(this.getName() + " expects a string as first argument, but found null.", t); } @@ -1125,7 +1126,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { Static.AssertNonCNull(t, args); String haystack = args[0].val(); String needle = args[1].val(); @@ -1309,7 +1310,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { //http://stackoverflow.com/questions/2667015/is-regex-too-slow-real-life-examples-where-simple-non-regex-alternative-is-bett //According to this, regex isn't necessarily slower, but we do want to escape the pattern either way, since the main advantage //of this function is convenience (not speed) however, if we can eek out a little extra speed too, excellent. @@ -1386,7 +1387,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length < 2) { throw new CREInsufficientArgumentsException(getName() + " expects 2 or more arguments", t); } @@ -1936,7 +1937,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String val = args[0].val(); String encoding = "UTF-8"; if(args.length == 2) { @@ -1992,7 +1993,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CByteArray ba = ArgumentValidation.getByteArray(args[0], t); String encoding = "UTF-8"; if(args.length == 2) { @@ -2047,7 +2048,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length < 2) { throw new CREInsufficientArgumentsException(getName() + " must have 2 arguments at minimum", t); } @@ -2136,7 +2137,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { return new CString(new String(Character.toChars(ArgumentValidation.getInt32(args[0], t))), t); } catch (IllegalArgumentException ex) { @@ -2204,7 +2205,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].val().toCharArray().length == 0) { throw new CRERangeException("Empty string cannot be converted to unicode.", t); } @@ -2262,7 +2263,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt(StringUtils.LevenshteinDistance(args[0].val(), args[1].val()), t); } @@ -2319,7 +2320,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt(args[0].val().compareTo(args[1].val()), t); } @@ -2364,7 +2365,7 @@ public ExampleScript[] examples() throws ConfigCompileException { public static class string_compare_ic extends string_compare { @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CInt(args[0].val().compareToIgnoreCase(args[1].val()), t); } @@ -2417,7 +2418,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0] instanceof CNull) { return CNull.NULL; } @@ -2526,7 +2527,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CArray.TYPE)) { CArray array = ArgumentValidation.getArray(args[0], t); return new CSecureString(array, t); @@ -2604,7 +2605,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args[0].isInstanceOf(CSecureString.TYPE)) { CSecureString secure = ArgumentValidation.getObject(args[0], t, CSecureString.class); return secure.getDecryptedCharCArray(); @@ -2713,7 +2714,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { UUIDType type = UUIDType.RANDOM; String input = null; if(args.length > 0) { diff --git a/src/main/java/com/laytonsmith/core/functions/TaskHandling.java b/src/main/java/com/laytonsmith/core/functions/TaskHandling.java index d058dcb761..a784bf8042 100644 --- a/src/main/java/com/laytonsmith/core/functions/TaskHandling.java +++ b/src/main/java/com/laytonsmith/core/functions/TaskHandling.java @@ -10,6 +10,7 @@ import com.laytonsmith.core.constructs.CInt; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.StaticRuntimeEnv; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -50,7 +51,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { TaskManager tm = environment.getEnv(StaticRuntimeEnv.class).GetTaskManager(); CArray ret = new CArray(t); for(TaskHandler task : tm.getTasks()) { @@ -134,7 +135,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String type = args[0].val(); int id = ArgumentValidation.getInt32(args[1], t); TaskManager tm = environment.getEnv(StaticRuntimeEnv.class).GetTaskManager(); diff --git a/src/main/java/com/laytonsmith/core/functions/Threading.java b/src/main/java/com/laytonsmith/core/functions/Threading.java index 7b00b4757d..412ca96add 100644 --- a/src/main/java/com/laytonsmith/core/functions/Threading.java +++ b/src/main/java/com/laytonsmith/core/functions/Threading.java @@ -23,6 +23,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.StaticRuntimeEnv; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -84,7 +85,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(final Target t, final Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final String threadId = args[0].val(); final com.laytonsmith.core.natives.interfaces.Callable closure = ArgumentValidation.getObject(args[1], t, com.laytonsmith.core.natives.interfaces.Callable.class); @@ -102,7 +103,7 @@ public void run() { ConfigRuntimeException.HandleUncaughtException(ex, env); } catch (CancelCommandException ex) { if(ex.getMessage() != null) { - new Echoes.console().exec(t, env, new CString(ex.getMessage(), t), CBoolean.FALSE); + new Echoes.console().exec(t, env, null, new CString(ex.getMessage(), t), CBoolean.FALSE); } } finally { dm.deactivateThread(Thread.currentThread()); @@ -183,7 +184,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return new CString(Thread.currentThread().getName(), t); } @@ -237,7 +238,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(final Target t, final Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final com.laytonsmith.core.natives.interfaces.Callable closure = ArgumentValidation.getObject(args[0], t, com.laytonsmith.core.natives.interfaces.Callable.class); StaticLayer.GetConvertor().runOnMainThreadLater( @@ -302,7 +303,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(final Target t, final Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final com.laytonsmith.core.natives.interfaces.Callable closure = ArgumentValidation.getObject(args[0], t, com.laytonsmith.core.natives.interfaces.Callable.class); Object ret; @@ -511,7 +512,7 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes) } @Override - public Mixed exec(final Target t, final Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CVoid.VOID; } @@ -631,7 +632,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { // Get the sync object tree and the code to synchronize. Mixed cSyncObject = args[0]; com.laytonsmith.core.natives.interfaces.Callable callable @@ -726,7 +727,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String threadId = args[0].val(); Thread th; synchronized(THREAD_ID_MAP) { @@ -791,7 +792,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String threadId = args[0].val(); Thread th; synchronized(THREAD_ID_MAP) { @@ -844,7 +845,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { Thread th; if(args.length == 1) { String threadId = args[0].val(); @@ -904,7 +905,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length == 1) { String threadId = args[0].val(); Thread th; @@ -963,7 +964,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(Thread.interrupted()); } diff --git a/src/main/java/com/laytonsmith/core/functions/Trades.java b/src/main/java/com/laytonsmith/core/functions/Trades.java index 8493ca3b57..f7376b9a9c 100644 --- a/src/main/java/com/laytonsmith/core/functions/Trades.java +++ b/src/main/java/com/laytonsmith/core/functions/Trades.java @@ -21,6 +21,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREBadEntityException; @@ -57,7 +58,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = new CArray(t); for(MCMerchantRecipe mr : GetMerchant(args[0], t).getRecipes()) { ret.push(trade(mr, t), t); @@ -97,7 +98,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCMerchant merchant = GetMerchant(args[0], t); CArray trades = ArgumentValidation.getArray(args[1], t); List recipes = new ArrayList<>(); @@ -169,7 +170,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray ret = CArray.GetAssociativeArray(t); for(Map.Entry entry : VIRTUAL_MERCHANTS.entrySet()) { if(entry.getValue() == null) { @@ -212,7 +213,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(VIRTUAL_MERCHANTS.containsKey(args[0].val())) { throw new CREIllegalArgumentException("There is already a merchant with id " + args[0].val(), t); } else { @@ -255,7 +256,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { return CBoolean.get(VIRTUAL_MERCHANTS.remove(args[0].val()) != null); } @@ -291,7 +292,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player; boolean force = false; if(args.length > 1) { @@ -344,7 +345,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCMerchant merchant = GetMerchant(args[0], t); return merchant.isTrading() ? new CString(merchant.getTrader().getUniqueId().toString(), t) : CNull.NULL; } diff --git a/src/main/java/com/laytonsmith/core/functions/Weather.java b/src/main/java/com/laytonsmith/core/functions/Weather.java index a221e23b08..42f484f6be 100644 --- a/src/main/java/com/laytonsmith/core/functions/Weather.java +++ b/src/main/java/com/laytonsmith/core/functions/Weather.java @@ -18,6 +18,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -59,7 +60,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int x; int y; int z; @@ -136,7 +137,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { boolean b = ArgumentValidation.getBoolean(args[0], t); MCWorld w = null; int duration = -1; @@ -227,7 +228,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(args.length == 1) { if(environment.getEnv(CommandHelperEnvironment.class).GetCommandSender() instanceof MCPlayer) { @@ -289,7 +290,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(args.length == 1) { w = Static.getServer().getWorld(args[0].val()); @@ -346,7 +347,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(args.length == 1) { w = Static.getServer().getWorld(args[0].val()); diff --git a/src/main/java/com/laytonsmith/core/functions/Web.java b/src/main/java/com/laytonsmith/core/functions/Web.java index d07fe19bc2..1aa175d507 100644 --- a/src/main/java/com/laytonsmith/core/functions/Web.java +++ b/src/main/java/com/laytonsmith/core/functions/Web.java @@ -36,6 +36,7 @@ import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Construct; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.environments.GlobalEnv; import com.laytonsmith.core.environments.StaticRuntimeEnv; @@ -218,7 +219,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(final Target t, final Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(final Target t, final Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { final URL url; try { url = new URL(args[0].val()); @@ -637,7 +638,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray array = ArgumentValidation.getArray(args[0], t); CookieJar jar = getCookieJar(array, t); jar.clearSessionCookies(); @@ -686,7 +687,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { return new CString(URLEncoder.encode(args[0].val(), "UTF-8"), t); } catch (UnsupportedEncodingException ex) { @@ -743,7 +744,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { try { return new CString(URLDecoder.decode(args[0].val(), "UTF-8"), t); } catch (UnsupportedEncodingException ex) { @@ -801,7 +802,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { // Argument processing CArray options; if(args.length == 1) { diff --git a/src/main/java/com/laytonsmith/core/functions/World.java b/src/main/java/com/laytonsmith/core/functions/World.java index a91c9db9d5..3fc2944565 100644 --- a/src/main/java/com/laytonsmith/core/functions/World.java +++ b/src/main/java/com/laytonsmith/core/functions/World.java @@ -43,6 +43,7 @@ import com.laytonsmith.core.constructs.CString; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.CommandHelperEnvironment; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; @@ -119,7 +120,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w; if(args.length == 1) { w = Static.getServer().getWorld(args[0].val()); @@ -156,7 +157,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(args.length == 1) { MCPlayer p = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -260,7 +261,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld world; int x; @@ -319,7 +320,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld world; int x; @@ -402,7 +403,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld world; int x; @@ -483,7 +484,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld world; if(args.length == 1) { @@ -557,7 +558,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld world; int x; @@ -630,7 +631,7 @@ public String docs() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld world; if(args.length == 1) { world = Static.getServer().getWorld(args[0].val()); @@ -719,7 +720,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld world; int x; @@ -812,7 +813,7 @@ public Boolean runAsync() { Random rnd = new Random(); @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer m = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld world; int x; @@ -928,7 +929,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(environment.getEnv(CommandHelperEnvironment.class).GetPlayer() != null) { w = environment.getEnv(CommandHelperEnvironment.class).GetPlayer().getWorld(); @@ -1019,7 +1020,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(environment.getEnv(CommandHelperEnvironment.class).GetPlayer() != null) { w = environment.getEnv(CommandHelperEnvironment.class).GetPlayer().getWorld(); @@ -1073,7 +1074,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(environment.getEnv(CommandHelperEnvironment.class).GetPlayer() != null) { w = environment.getEnv(CommandHelperEnvironment.class).GetPlayer().getWorld(); @@ -1134,7 +1135,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = null; if(environment.getEnv(CommandHelperEnvironment.class).GetPlayer() != null) { w = environment.getEnv(CommandHelperEnvironment.class).GetPlayer().getWorld(); @@ -1168,7 +1169,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorldCreator creator = StaticLayer.GetConvertor().getWorldCreator(args[0].val()); if(args.length >= 3) { MCWorldType type; @@ -1248,7 +1249,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray worlds = new CArray(t); for(MCWorld w : Static.getServer().getWorlds()) { worlds.push(new CString(w.getName(), t), t); @@ -1291,7 +1292,7 @@ public Integer[] numArgs() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws CancelCommandException, ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws CancelCommandException, ConfigRuntimeException { MCCommandSender cs = env.getEnv(CommandHelperEnvironment.class).GetCommandSender(); MCPlayer p = null; MCWorld w = null; @@ -1378,11 +1379,11 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], p != null ? p.getWorld() : null, t); - MCMaterial mat = StaticLayer.GetMaterial(args[1].val()); + MCMaterial mat= StaticLayer.GetMaterial(args[1].val()); if(mat == null) { mat = Static.ParseItemNotation(getName(), args[1].val(), 1, t).getType(); } @@ -1459,7 +1460,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = Static.getServer().getWorld(args[0].val()); if(w == null) { throw new CREInvalidWorldException("Unknown world: " + args[0], t); @@ -1519,7 +1520,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { boolean save = true; if(args.length == 2) { save = ArgumentValidation.getBoolean(args[1], t); @@ -1593,7 +1594,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld world = Static.getServer().getWorld(args[0].val()); if(world == null) { throw new CREInvalidWorldException("Unknown world: " + args[0].val(), t); @@ -1643,7 +1644,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCDifficulty difficulty; if(args.length == 1) { try { @@ -1709,7 +1710,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld world = Static.getServer().getWorld(args[0].val()); if(world == null) { throw new CREInvalidWorldException("Unknown world: " + args[0].val(), t); @@ -1758,7 +1759,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length == 1) { boolean pvp = ArgumentValidation.getBoolean(args[0], t); for(MCWorld world : Static.getServer().getWorlds()) { @@ -1817,7 +1818,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld world = Static.getServer().getWorld(args[0].val()); if(world == null) { throw new CREInvalidWorldException("Unknown world: " + args[0].val(), t); @@ -1908,7 +1909,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int offset = args.length - 2; List worlds = Static.getServer().getWorlds(); MCWorld world = worlds.get(0); @@ -1982,7 +1983,7 @@ public Class[] thrown() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld world = Static.getServer().getWorld(args[0].val()); if(world == null) { throw new CREInvalidWorldException("Unknown world: " + args[0].val(), t); @@ -2066,7 +2067,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], p != null ? p.getWorld() : null, t); double distance = 1; @@ -2154,7 +2155,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -2221,7 +2222,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); @@ -2282,7 +2283,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { CArray loc = ArgumentValidation.getArray(args[0], t); double yaw; double pitch; @@ -2347,7 +2348,7 @@ public Version since() { } @Override - public Mixed exec(Target t, Environment env, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCLocation loc1 = ObjectGenerator.GetGenerator().location(args[0], null, t); MCLocation loc2 = ObjectGenerator.GetGenerator().location(args[1], null, t); try { @@ -2377,7 +2378,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld world = Static.getWorld(args[0], t); world.save(); return CVoid.VOID; @@ -2424,7 +2425,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target target, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target target, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCPlayer player = environment.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCWorld world = null; if(player != null) { @@ -2474,7 +2475,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = Static.getServer().getWorld(args[0].val()); if(w == null) { throw new CREInvalidWorldException("Unknown world: " + args[0], t); @@ -2532,7 +2533,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = Static.getServer().getWorld(args[0].val()); if(w == null) { throw new CREInvalidWorldException("Unknown world: " + args[0], t); @@ -2611,7 +2612,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { MCWorld w = Static.getServer().getWorld(args[0].val()); if(w == null) { throw new CREInvalidWorldException("Unknown world: " + args[0].val(), t); @@ -2659,7 +2660,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { if(args.length == 1) { boolean autosave = ArgumentValidation.getBooleanish(args[0], t); for(MCWorld world : Static.getServer().getWorlds()) { diff --git a/src/main/java/com/laytonsmith/core/functions/XGUI.java b/src/main/java/com/laytonsmith/core/functions/XGUI.java index 326cb11135..006b1018db 100644 --- a/src/main/java/com/laytonsmith/core/functions/XGUI.java +++ b/src/main/java/com/laytonsmith/core/functions/XGUI.java @@ -12,6 +12,7 @@ import com.laytonsmith.core.constructs.CInt; import com.laytonsmith.core.constructs.CVoid; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREFormatException; import com.laytonsmith.core.exceptions.CRE.CREIOException; @@ -78,7 +79,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { JFrame frame = new JFrame(); int id = WINDOW_IDS.incrementAndGet(); String title = ""; @@ -148,7 +149,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int id = ArgumentValidation.getInt32(args[0], t); boolean show = true; if(args.length > 1) { @@ -202,7 +203,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { int windowID = ArgumentValidation.getInt32(args[0], t); int x = ArgumentValidation.getInt32(args[1], t); int y = ArgumentValidation.getInt32(args[2], t); @@ -267,7 +268,7 @@ public Boolean runAsync() { } @Override - public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException { + public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { String url = args[0].val(); try { if(Desktop.isDesktopSupported()) { diff --git a/src/main/java/com/laytonsmith/core/functions/asm/Cmdline.java b/src/main/java/com/laytonsmith/core/functions/asm/Cmdline.java index 3daf163263..1b9eff9476 100644 --- a/src/main/java/com/laytonsmith/core/functions/asm/Cmdline.java +++ b/src/main/java/com/laytonsmith/core/functions/asm/Cmdline.java @@ -15,6 +15,7 @@ import com.laytonsmith.core.asm.LLVMVersion; import com.laytonsmith.core.compiler.CompilerEnvironment; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREThrowable; import com.laytonsmith.core.exceptions.ConfigCompileException; @@ -30,7 +31,7 @@ public class Cmdline { public static class exit extends LLVMFunction { @Override - public IRData buildIR(IRBuilder builder, Target t, Environment env, ParseTree... nodes) throws ConfigCompileException { + public IRData buildIR(IRBuilder builder, Target t, Environment env, GenericParameters generics, ParseTree... nodes) throws ConfigCompileException { OSUtils.OS os = env.getEnv(CompilerEnvironment.class).getTargetOS(); LLVMEnvironment llvmenv = env.getEnv(LLVMEnvironment.class); String code = "i32 0"; @@ -72,7 +73,7 @@ public Version since() { public static class sys_out extends LLVMFunction { @Override - public IRData buildIR(IRBuilder builder, Target t, Environment env, ParseTree... nodes) throws ConfigCompileException { + public IRData buildIR(IRBuilder builder, Target t, Environment env, GenericParameters generics, ParseTree... nodes) throws ConfigCompileException { OSUtils.OS os = env.getEnv(CompilerEnvironment.class).getTargetOS(); LLVMEnvironment llvmenv = env.getEnv(LLVMEnvironment.class); List lines = new ArrayList<>(); diff --git a/src/main/java/com/laytonsmith/core/functions/asm/Compiler.java b/src/main/java/com/laytonsmith/core/functions/asm/Compiler.java index a0e73f70a3..7174825733 100644 --- a/src/main/java/com/laytonsmith/core/functions/asm/Compiler.java +++ b/src/main/java/com/laytonsmith/core/functions/asm/Compiler.java @@ -11,6 +11,7 @@ import com.laytonsmith.core.asm.LLVMFunction; import com.laytonsmith.core.asm.LLVMVersion; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREThrowable; import com.laytonsmith.core.exceptions.ConfigCompileException; @@ -23,7 +24,7 @@ public class Compiler { public static class __statements__ extends LLVMFunction { @Override - public IRData buildIR(IRBuilder builder, Target t, Environment env, ParseTree... nodes) throws ConfigCompileException { + public IRData buildIR(IRBuilder builder, Target t, Environment env, GenericParameters generics, ParseTree... nodes) throws ConfigCompileException { for(ParseTree node : nodes) { AsmCompiler.getIR(builder, node, env); } @@ -56,7 +57,7 @@ public Version since() { public static class dyn extends LLVMFunction { @Override - public IRData buildIR(IRBuilder builder, Target t, Environment env, ParseTree... nodes) throws ConfigCompileException { + public IRData buildIR(IRBuilder builder, Target t, Environment env, GenericParameters generics, ParseTree... nodes) throws ConfigCompileException { IRData data = AsmCompiler.getIR(builder, nodes[0], env); LLVMEnvironment llvmenv = env.getEnv(LLVMEnvironment.class); int alloca = llvmenv.getNewLocalVariableReference(data.getResultType()); diff --git a/src/main/java/com/laytonsmith/core/functions/asm/DataHandling.java b/src/main/java/com/laytonsmith/core/functions/asm/DataHandling.java index 83c1f36237..ce82912167 100644 --- a/src/main/java/com/laytonsmith/core/functions/asm/DataHandling.java +++ b/src/main/java/com/laytonsmith/core/functions/asm/DataHandling.java @@ -14,6 +14,7 @@ import com.laytonsmith.core.constructs.CClassType; import com.laytonsmith.core.constructs.IVariable; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CRECastException; import com.laytonsmith.core.exceptions.CRE.CREThrowable; @@ -28,7 +29,7 @@ public class DataHandling { public static class assign extends LLVMFunction { @Override - public IRData buildIR(IRBuilder builder, Target t, Environment env, ParseTree... nodes) throws ConfigCompileException { + public IRData buildIR(IRBuilder builder, Target t, Environment env, GenericParameters generics, ParseTree... nodes) throws ConfigCompileException { LLVMEnvironment llvmenv = env.getEnv(LLVMEnvironment.class); int offset; CClassType type; diff --git a/src/main/java/com/laytonsmith/core/functions/asm/Math.java b/src/main/java/com/laytonsmith/core/functions/asm/Math.java index 40d88372b1..89c4fdc4e3 100644 --- a/src/main/java/com/laytonsmith/core/functions/asm/Math.java +++ b/src/main/java/com/laytonsmith/core/functions/asm/Math.java @@ -15,6 +15,7 @@ import com.laytonsmith.core.asm.LLVMVersion; import com.laytonsmith.core.compiler.CompilerEnvironment; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREThrowable; import com.laytonsmith.core.exceptions.ConfigCompileException; @@ -43,7 +44,7 @@ public void addStartupCode(IRBuilder builder, Environment startupEnv, Target t) } @Override - public IRData buildIR(IRBuilder builder, Target t, Environment env, ParseTree... nodes) throws ConfigCompileException { + public IRData buildIR(IRBuilder builder, Target t, Environment env, GenericParameters generics, ParseTree... nodes) throws ConfigCompileException { LLVMEnvironment llvmenv = env.getEnv(LLVMEnvironment.class); CompilerEnvironment cEnv = env.getEnv(CompilerEnvironment.class); llvmenv.addGlobalDeclaration(AsmCommonLibTemplates.RAND, env); diff --git a/src/main/java/com/laytonsmith/core/functions/asm/Meta.java b/src/main/java/com/laytonsmith/core/functions/asm/Meta.java index 16f61e6483..0406499fbb 100644 --- a/src/main/java/com/laytonsmith/core/functions/asm/Meta.java +++ b/src/main/java/com/laytonsmith/core/functions/asm/Meta.java @@ -10,6 +10,7 @@ import com.laytonsmith.core.asm.LLVMFunction; import com.laytonsmith.core.asm.LLVMVersion; import com.laytonsmith.core.constructs.Target; +import com.laytonsmith.core.constructs.generics.GenericParameters; import com.laytonsmith.core.environments.Environment; import com.laytonsmith.core.exceptions.CRE.CREThrowable; import com.laytonsmith.core.exceptions.ConfigCompileException; @@ -22,7 +23,7 @@ public class Meta { public static class noop extends LLVMFunction { @Override - public IRData buildIR(IRBuilder builder, Target t, Environment env, ParseTree... nodes) + public IRData buildIR(IRBuilder builder, Target t, Environment env, GenericParameters generics, ParseTree... nodes) throws ConfigCompileException { builder.appendLine(t, "add i1 0, 0 ; noop()"); return IRDataBuilder.asVoid(); diff --git a/src/main/java/com/laytonsmith/tools/Interpreter.java b/src/main/java/com/laytonsmith/tools/Interpreter.java index 706ba3ef39..ad5f2443a4 100644 --- a/src/main/java/com/laytonsmith/tools/Interpreter.java +++ b/src/main/java/com/laytonsmith/tools/Interpreter.java @@ -949,19 +949,19 @@ public boolean doBuiltin(String script) { a = new Construct[]{new CString(args.get(0), Target.UNKNOWN)}; } try { - new Cmdline.cd().exec(Target.UNKNOWN, env, a); + new Cmdline.cd().exec(Target.UNKNOWN, env, null, a); } catch (CREIOException ex) { pl(RED + ex.getMessage()); } return true; case "pwd": - pl(new Cmdline.pwd().exec(Target.UNKNOWN, env).val()); + pl(new Cmdline.pwd().exec(Target.UNKNOWN, env, null).val()); return true; case "exit": // We need previous code to intercept, we cannot do this here. throw new Error("I should not run"); case "logout": - new Cmdline.exit().exec(Target.UNKNOWN, env, new CInt(0, Target.UNKNOWN)); + new Cmdline.exit().exec(Target.UNKNOWN, env, null, new CInt(0, Target.UNKNOWN)); return true; // won't actually run case "echo": // TODO Probably need some variable interpolation maybe? Otherwise, I don't think this command @@ -974,7 +974,7 @@ public boolean doBuiltin(String script) { } String output = StringUtils.Join(args, " "); if(colorize) { - output = new Echoes.colorize().exec(Target.UNKNOWN, env, new CString(output, Target.UNKNOWN)).val(); + output = new Echoes.colorize().exec(Target.UNKNOWN, env, null, new CString(output, Target.UNKNOWN)).val(); } pl(output); return true; diff --git a/src/main/java/com/laytonsmith/tools/docgen/DocGenTemplates.java b/src/main/java/com/laytonsmith/tools/docgen/DocGenTemplates.java index d3cb329ea1..1445e37850 100644 --- a/src/main/java/com/laytonsmith/tools/docgen/DocGenTemplates.java +++ b/src/main/java/com/laytonsmith/tools/docgen/DocGenTemplates.java @@ -735,7 +735,7 @@ public String generate(String... args) { @Override public String generate(String... args) { String template = args[0]; - return new Scheduling.simple_date().exec(Target.UNKNOWN, null, new CString(template, Target.UNKNOWN)).val(); + return new Scheduling.simple_date().exec(Target.UNKNOWN, null, null, new CString(template, Target.UNKNOWN)).val(); } }; @@ -772,7 +772,7 @@ public String generate(String... args) throws GenerateException { public static final Generator CURRENTYEAR = new Generator() { @Override public String generate(String... args) throws GenerateException { - return new Scheduling.simple_date().exec(Target.UNKNOWN, null, new CString("yyyy", Target.UNKNOWN)).val(); + return new Scheduling.simple_date().exec(Target.UNKNOWN, null, null, new CString("yyyy", Target.UNKNOWN)).val(); } }; diff --git a/src/main/java/com/laytonsmith/tools/pnviewer/PNViewer.java b/src/main/java/com/laytonsmith/tools/pnviewer/PNViewer.java index 8f3f57e30a..571b72e798 100644 --- a/src/main/java/com/laytonsmith/tools/pnviewer/PNViewer.java +++ b/src/main/java/com/laytonsmith/tools/pnviewer/PNViewer.java @@ -338,7 +338,7 @@ public void run() { } catch (MarshalException ex) { Logger.getLogger(PNViewer.class.getName()).log(Level.SEVERE, null, ex); } - valueTypeLabel.setText(new DataHandling.typeof().exec(Target.UNKNOWN, null, c).val()); + valueTypeLabel.setText(new DataHandling.typeof().exec(Target.UNKNOWN, null, null, c).val()); valueTextArea.setText(c.val()); } } diff --git a/src/test/java/com/laytonsmith/core/functions/ArrayHandlingTest.java b/src/test/java/com/laytonsmith/core/functions/ArrayHandlingTest.java index d72a113913..ccc78090ef 100644 --- a/src/test/java/com/laytonsmith/core/functions/ArrayHandlingTest.java +++ b/src/test/java/com/laytonsmith/core/functions/ArrayHandlingTest.java @@ -64,7 +64,7 @@ public void testDocs() { public void testArraySize() throws Exception, CancelCommandException { ArrayHandling.array_size a = new ArrayHandling.array_size(); CArray arr = commonArray; - Mixed ret = a.exec(Target.UNKNOWN, env, arr); + Mixed ret = a.exec(Target.UNKNOWN, env, null, arr); assertReturn(ret, C.INT); assertCEquals(C.onstruct(3), ret); } @@ -72,7 +72,7 @@ public void testArraySize() throws Exception, CancelCommandException { @Test(expected = Exception.class, timeout = 10000) public void testArraySizeEx() throws CancelCommandException { ArrayHandling.array_size a = new ArrayHandling.array_size(); - a.exec(Target.UNKNOWN, env, C.Int(0)); + a.exec(Target.UNKNOWN, env, null, C.Int(0)); } @Test//(timeout = 10000) @@ -121,46 +121,46 @@ public void testArrayReferenceBeingCorrectWithArrayGet() throws Exception { @Test(timeout = 10000) public void testArrayContains() throws CancelCommandException { ArrayHandling.array_contains a = new ArrayHandling.array_contains(); - assertCEquals(C.onstruct(true), a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(1))); - assertCEquals(C.onstruct(false), a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(55))); + assertCEquals(C.onstruct(true), a.exec(Target.UNKNOWN, env, null, commonArray, C.onstruct(1))); + assertCEquals(C.onstruct(false), a.exec(Target.UNKNOWN, env, null, commonArray, C.onstruct(55))); } @Test(timeout = 10000) public void testArraySContains() throws CancelCommandException { ArrayHandling.array_scontains a = new ArrayHandling.array_scontains(); - assertCEquals(C.onstruct(true), a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(1))); - assertCEquals(C.onstruct(false), a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(55))); - assertCEquals(C.onstruct(false), a.exec(Target.UNKNOWN, env, commonArray, new CString("2", Target.UNKNOWN))); + assertCEquals(C.onstruct(true), a.exec(Target.UNKNOWN, env, null, commonArray, C.onstruct(1))); + assertCEquals(C.onstruct(false), a.exec(Target.UNKNOWN, env, null, commonArray, C.onstruct(55))); + assertCEquals(C.onstruct(false), a.exec(Target.UNKNOWN, env, null, commonArray, new CString("2", Target.UNKNOWN))); } @Test(expected = Exception.class, timeout = 10000) public void testArrayContainsEx() throws CancelCommandException { ArrayHandling.array_contains a = new ArrayHandling.array_contains(); - a.exec(Target.UNKNOWN, env, C.Int(0), C.Int(1)); + a.exec(Target.UNKNOWN, env, null, C.Int(0), C.Int(1)); } @Test(timeout = 10000) public void testArrayGet() throws CancelCommandException { ArrayHandling.array_get a = new ArrayHandling.array_get(); - assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(0))); + assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, null, commonArray, C.onstruct(0))); } @Test(expected = Exception.class, timeout = 10000) public void testArrayGetEx() throws CancelCommandException { ArrayHandling.array_get a = new ArrayHandling.array_get(); - a.exec(Target.UNKNOWN, env, C.Int(0), C.Int(1)); + a.exec(Target.UNKNOWN, env, null, C.Int(0), C.Int(1)); } @Test(expected = ConfigRuntimeException.class, timeout = 10000) public void testArrayGetBad() throws CancelCommandException { ArrayHandling.array_get a = new ArrayHandling.array_get(); - a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(55)); + a.exec(Target.UNKNOWN, env, null, commonArray, C.onstruct(55)); } @Test(timeout = 10000) public void testArrayPush() throws CancelCommandException { ArrayHandling.array_push a = new ArrayHandling.array_push(); - assertReturn(a.exec(Target.UNKNOWN, env, commonArray, C.onstruct(4)), C.VOID); + assertReturn(a.exec(Target.UNKNOWN, env, null, commonArray, C.onstruct(4)), C.VOID); assertCEquals(C.onstruct(1), commonArray.get(0, Target.UNKNOWN)); assertCEquals(C.onstruct(2), commonArray.get(1, Target.UNKNOWN)); assertCEquals(C.onstruct(3), commonArray.get(2, Target.UNKNOWN)); @@ -178,7 +178,7 @@ public void testArrayPush2() throws Exception { @Test(expected = Exception.class) public void testArrayPushEx() throws CancelCommandException { ArrayHandling.array_push a = new ArrayHandling.array_push(); - a.exec(Target.UNKNOWN, env, C.Int(0), C.Int(1)); + a.exec(Target.UNKNOWN, env, null, C.Int(0), C.Int(1)); } @Test(timeout = 10000) diff --git a/src/test/java/com/laytonsmith/core/functions/BasicLogicTest.java b/src/test/java/com/laytonsmith/core/functions/BasicLogicTest.java index 5fc508e83c..bf5563b69c 100644 --- a/src/test/java/com/laytonsmith/core/functions/BasicLogicTest.java +++ b/src/test/java/com/laytonsmith/core/functions/BasicLogicTest.java @@ -205,48 +205,48 @@ public void testOr2() throws Exception { @Test(timeout = 10000) public void testNot() throws CancelCommandException { BasicLogic.not a = new BasicLogic.not(); - assertCFalse(a.exec(Target.UNKNOWN, env, cTrue)); - assertCTrue(a.exec(Target.UNKNOWN, env, cFalse)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, cTrue)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, cFalse)); } @Test(timeout = 10000) public void testGt() throws CancelCommandException { BasicLogic.gt a = new BasicLogic.gt(); - assertCFalse(a.exec(Target.UNKNOWN, env, argOne, argOne2)); - assertCTrue(a.exec(Target.UNKNOWN, env, argTwo, argOne)); - assertCFalse(a.exec(Target.UNKNOWN, env, argOne, argTwo)); - assertCFalse(a.exec(Target.UNKNOWN, env, argNegOne, argOne)); - assertCTrue(a.exec(Target.UNKNOWN, env, argOne, argNegOne)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, argOne, argOne2)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, argTwo, argOne)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, argOne, argTwo)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, argNegOne, argOne)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, argOne, argNegOne)); } @Test(timeout = 10000) public void testGte() throws CancelCommandException { BasicLogic.gte a = new BasicLogic.gte(); - assertCTrue(a.exec(Target.UNKNOWN, env, argOne, argOne2)); - assertCTrue(a.exec(Target.UNKNOWN, env, argTwo, argOne)); - assertCFalse(a.exec(Target.UNKNOWN, env, argOne, argTwo)); - assertCFalse(a.exec(Target.UNKNOWN, env, argNegOne, argOne)); - assertCTrue(a.exec(Target.UNKNOWN, env, argOne, argNegOne)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, argOne, argOne2)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, argTwo, argOne)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, argOne, argTwo)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, argNegOne, argOne)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, argOne, argNegOne)); } @Test(timeout = 10000) public void testLt() throws CancelCommandException { BasicLogic.lt a = new BasicLogic.lt(); - assertCFalse(a.exec(Target.UNKNOWN, env, argOne, argOne2)); - assertCFalse(a.exec(Target.UNKNOWN, env, argTwo, argOne)); - assertCTrue(a.exec(Target.UNKNOWN, env, argOne, argTwo)); - assertCTrue(a.exec(Target.UNKNOWN, env, argNegOne, argOne)); - assertCFalse(a.exec(Target.UNKNOWN, env, argOne, argNegOne)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, argOne, argOne2)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, argTwo, argOne)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, argOne, argTwo)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, argNegOne, argOne)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, argOne, argNegOne)); } @Test(timeout = 10000) public void testLte() throws CancelCommandException { BasicLogic.lte a = new BasicLogic.lte(); - assertCTrue(a.exec(Target.UNKNOWN, env, argOne, argOne2)); - assertCFalse(a.exec(Target.UNKNOWN, env, argTwo, argOne)); - assertCTrue(a.exec(Target.UNKNOWN, env, argOne, argTwo)); - assertCTrue(a.exec(Target.UNKNOWN, env, argNegOne, argOne)); - assertCFalse(a.exec(Target.UNKNOWN, env, argOne, argNegOne)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, argOne, argOne2)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, argTwo, argOne)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, argOne, argTwo)); + assertCTrue(a.exec(Target.UNKNOWN, env, null, argNegOne, argOne)); + assertCFalse(a.exec(Target.UNKNOWN, env, null, argOne, argNegOne)); } @Test(timeout = 10000) diff --git a/src/test/java/com/laytonsmith/core/functions/EchoesTest.java b/src/test/java/com/laytonsmith/core/functions/EchoesTest.java index 5bcf2f94d6..03e1a2e0ea 100644 --- a/src/test/java/com/laytonsmith/core/functions/EchoesTest.java +++ b/src/test/java/com/laytonsmith/core/functions/EchoesTest.java @@ -68,7 +68,7 @@ public void testDocs() { @Test(timeout = 10000) public void testChat() throws CancelCommandException { Echoes.chat a = new Echoes.chat(); - a.exec(Target.UNKNOWN, env, C.onstruct("Hello World!")); + a.exec(Target.UNKNOWN, env, null, C.onstruct("Hello World!")); verify(fakePlayer).chat("Hello World!"); } @@ -78,7 +78,7 @@ public void testBroadcast() throws NoSuchFieldException, InstantiationException, Echoes.broadcast a = new Echoes.broadcast(); when(fakePlayer.getServer()).thenReturn(fakeServer); CommandHelperPlugin.myServer = fakeServer; - a.exec(Target.UNKNOWN, env, C.onstruct("Hello World!")); + a.exec(Target.UNKNOWN, env, null, C.onstruct("Hello World!")); verify(fakeServer).broadcastMessage("Hello World!"); } @@ -130,7 +130,7 @@ public void testRGBColor() throws Exception { } private static final String LOWERCASE_A = - new color().exec(Target.UNKNOWN, null, new CString("a", Target.UNKNOWN)).val(); + new color().exec(Target.UNKNOWN, null, null, new CString("a", Target.UNKNOWN)).val(); @Test public void testColorize1() throws Exception { @@ -164,7 +164,7 @@ public void testColorize6() throws Exception { @Test public void testColorizeRGB() throws Exception { - String expectedColor = new color().exec(Target.UNKNOWN, null, new CString("#ff11aa", Target.UNKNOWN)).val(); + String expectedColor = new color().exec(Target.UNKNOWN, null, null, new CString("#ff11aa", Target.UNKNOWN)).val(); assertEquals(expectedColor + "Hi", SRun("colorize('&#ff11aaHi', '&')", fakePlayer)); } diff --git a/src/test/java/com/laytonsmith/core/functions/MathTest.java b/src/test/java/com/laytonsmith/core/functions/MathTest.java index a65e637e11..a8fe1f42b0 100644 --- a/src/test/java/com/laytonsmith/core/functions/MathTest.java +++ b/src/test/java/com/laytonsmith/core/functions/MathTest.java @@ -74,28 +74,28 @@ public void tearDown() { @Test(timeout = 10000) public void testAbs() { Math.abs a = new Math.abs(); - assertCEquals(C.onstruct(5), a.exec(Target.UNKNOWN, env, C.onstruct(5))); - assertCEquals(C.onstruct(3), a.exec(Target.UNKNOWN, env, C.onstruct(-3))); - assertCEquals(C.onstruct(0), a.exec(Target.UNKNOWN, env, C.onstruct(0))); - assertCEquals(C.onstruct(3.5), a.exec(Target.UNKNOWN, env, C.onstruct(-3.5))); + assertCEquals(C.onstruct(5), a.exec(Target.UNKNOWN, env, null, C.onstruct(5))); + assertCEquals(C.onstruct(3), a.exec(Target.UNKNOWN, env, null, C.onstruct(-3))); + assertCEquals(C.onstruct(0), a.exec(Target.UNKNOWN, env, null, C.onstruct(0))); + assertCEquals(C.onstruct(3.5), a.exec(Target.UNKNOWN, env, null, C.onstruct(-3.5))); } @Test(timeout = 10000) public void testAdd() { Math.add a = new Math.add(); - assertCEquals(C.onstruct(7), a.exec(Target.UNKNOWN, env, C.onstruct(5), C.onstruct(2))); - assertCEquals(C.onstruct(6), a.exec(Target.UNKNOWN, env, C.onstruct(3), C.onstruct(3))); - assertCEquals(C.onstruct(-4), a.exec(Target.UNKNOWN, env, C.onstruct(-3), C.onstruct(-1))); - assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, C.onstruct(1), C.onstruct(0))); - assertCEquals(C.onstruct(562949953421310L), a.exec(Target.UNKNOWN, env, C.onstruct(281474976710655L), C.onstruct(281474976710655L))); - assertCEquals(C.onstruct(3.1415), a.exec(Target.UNKNOWN, env, C.onstruct(3), C.onstruct(0.1415))); + assertCEquals(C.onstruct(7), a.exec(Target.UNKNOWN, env, null, C.onstruct(5), C.onstruct(2))); + assertCEquals(C.onstruct(6), a.exec(Target.UNKNOWN, env, null, C.onstruct(3), C.onstruct(3))); + assertCEquals(C.onstruct(-4), a.exec(Target.UNKNOWN, env, null, C.onstruct(-3), C.onstruct(-1))); + assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, null, C.onstruct(1), C.onstruct(0))); + assertCEquals(C.onstruct(562949953421310L), a.exec(Target.UNKNOWN, env, null, C.onstruct(281474976710655L), C.onstruct(281474976710655L))); + assertCEquals(C.onstruct(3.1415), a.exec(Target.UNKNOWN, env, null, C.onstruct(3), C.onstruct(0.1415))); } @Test(timeout = 10000) public void testDec() throws Exception { Math.dec a = new Math.dec(); - IVariable v = (IVariable) a.exec(Target.UNKNOWN, env, new IVariable(Auto.TYPE, "var", C.onstruct(1), Target.UNKNOWN, env)); - IVariable v2 = (IVariable) a.exec(Target.UNKNOWN, env, new IVariable(Auto.TYPE, "var2", C.onstruct(2.5), Target.UNKNOWN, env)); + IVariable v = (IVariable) a.exec(Target.UNKNOWN, env, null, new IVariable(Auto.TYPE, "var", C.onstruct(1), Target.UNKNOWN, env)); + IVariable v2 = (IVariable) a.exec(Target.UNKNOWN, env, null, new IVariable(Auto.TYPE, "var2", C.onstruct(2.5), Target.UNKNOWN, env)); assertCEquals(C.onstruct(0), v.ival()); assertCEquals(C.onstruct(1.5), v2.ival()); StaticTest.SRun("assign(@var, 0) dec(@var, 2) msg(@var)", fakePlayer); @@ -105,16 +105,16 @@ public void testDec() throws Exception { @Test(timeout = 10000) public void testDivide() { Math.divide a = new Math.divide(); - assertCEquals(C.onstruct(2.5), a.exec(Target.UNKNOWN, env, C.onstruct(5), C.onstruct(2))); - assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, C.onstruct(3), C.onstruct(3))); - assertCEquals(C.onstruct(3), a.exec(Target.UNKNOWN, env, C.onstruct(-3), C.onstruct(-1))); + assertCEquals(C.onstruct(2.5), a.exec(Target.UNKNOWN, env, null, C.onstruct(5), C.onstruct(2))); + assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, null, C.onstruct(3), C.onstruct(3))); + assertCEquals(C.onstruct(3), a.exec(Target.UNKNOWN, env, null, C.onstruct(-3), C.onstruct(-1))); } @Test(timeout = 10000) public void testInc() throws Exception { Math.inc a = new Math.inc(); - IVariable v = (IVariable) a.exec(Target.UNKNOWN, env, new IVariable(Auto.TYPE, "var", C.onstruct(1), Target.UNKNOWN, env)); - IVariable v2 = (IVariable) a.exec(Target.UNKNOWN, env, new IVariable(Auto.TYPE, "var2", C.onstruct(2.5), Target.UNKNOWN, env)); + IVariable v = (IVariable) a.exec(Target.UNKNOWN, env, null, new IVariable(Auto.TYPE, "var", C.onstruct(1), Target.UNKNOWN, env)); + IVariable v2 = (IVariable) a.exec(Target.UNKNOWN, env, null, new IVariable(Auto.TYPE, "var2", C.onstruct(2.5), Target.UNKNOWN, env)); assertCEquals(C.onstruct(2), v.ival()); assertCEquals(C.onstruct(3.5), v2.ival()); StaticTest.SRun("assign(@var, 0) inc(@var, 2) msg(@var)", fakePlayer); @@ -130,50 +130,50 @@ public void testArrayGetInc() throws Exception { @Test(timeout = 10000) public void testMod() { Math.mod a = new Math.mod(); - assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, C.onstruct(5), C.onstruct(2))); - assertCEquals(C.onstruct(0), a.exec(Target.UNKNOWN, env, C.onstruct(3), C.onstruct(3))); - assertCEquals(C.onstruct(-1), a.exec(Target.UNKNOWN, env, C.onstruct(-3), C.onstruct(-2))); + assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, null, C.onstruct(5), C.onstruct(2))); + assertCEquals(C.onstruct(0), a.exec(Target.UNKNOWN, env, null, C.onstruct(3), C.onstruct(3))); + assertCEquals(C.onstruct(-1), a.exec(Target.UNKNOWN, env, null, C.onstruct(-3), C.onstruct(-2))); } @Test(timeout = 10000) public void testMultiply() { Math.multiply a = new Math.multiply(); - assertCEquals(C.onstruct(10), a.exec(Target.UNKNOWN, env, C.onstruct(5), C.onstruct(2))); - assertCEquals(C.onstruct(9), a.exec(Target.UNKNOWN, env, C.onstruct(3), C.onstruct(3))); - assertCEquals(C.onstruct(6), a.exec(Target.UNKNOWN, env, C.onstruct(-3), C.onstruct(-2))); - assertCEquals(C.onstruct(5), a.exec(Target.UNKNOWN, env, C.onstruct(10), C.onstruct(0.5))); - assertCEquals(C.onstruct(-562949953421311L), a.exec(Target.UNKNOWN, env, C.onstruct(281474976710655L), C.onstruct(281474976710655L))); - assertCEquals(C.onstruct(5312385410449346020L), a.exec(Target.UNKNOWN, env, C.onstruct(9876543210L), C.onstruct(9876543210L))); + assertCEquals(C.onstruct(10), a.exec(Target.UNKNOWN, env, null, C.onstruct(5), C.onstruct(2))); + assertCEquals(C.onstruct(9), a.exec(Target.UNKNOWN, env, null, C.onstruct(3), C.onstruct(3))); + assertCEquals(C.onstruct(6), a.exec(Target.UNKNOWN, env, null, C.onstruct(-3), C.onstruct(-2))); + assertCEquals(C.onstruct(5), a.exec(Target.UNKNOWN, env, null, C.onstruct(10), C.onstruct(0.5))); + assertCEquals(C.onstruct(-562949953421311L), a.exec(Target.UNKNOWN, env, null, C.onstruct(281474976710655L), C.onstruct(281474976710655L))); + assertCEquals(C.onstruct(5312385410449346020L), a.exec(Target.UNKNOWN, env, null, C.onstruct(9876543210L), C.onstruct(9876543210L))); } @Test(timeout = 10000) public void testPow() { Math.pow a = new Math.pow(); - assertCEquals(C.onstruct(25), a.exec(Target.UNKNOWN, env, C.onstruct(5), C.onstruct(2))); - assertCEquals(C.onstruct(27), a.exec(Target.UNKNOWN, env, C.onstruct(3), C.onstruct(3))); - assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, C.onstruct(-1), C.onstruct(-2))); + assertCEquals(C.onstruct(25), a.exec(Target.UNKNOWN, env, null, C.onstruct(5), C.onstruct(2))); + assertCEquals(C.onstruct(27), a.exec(Target.UNKNOWN, env, null, C.onstruct(3), C.onstruct(3))); + assertCEquals(C.onstruct(1), a.exec(Target.UNKNOWN, env, null, C.onstruct(-1), C.onstruct(-2))); } @Test(timeout = 10000) public void testRand1() { Math.rand a = new Math.rand(); for(int i = 0; i < 1000; i++) { - long j = ArgumentValidation.getInt(a.exec(Target.UNKNOWN, env, C.onstruct(10)), t); + long j = ArgumentValidation.getInt(a.exec(Target.UNKNOWN, env, null, C.onstruct(10)), t); if(!(j < 10 && j >= 0)) { fail("Expected a number between 0 and 10, but got " + j); } - j = ArgumentValidation.getInt(a.exec(Target.UNKNOWN, env, C.onstruct(10), C.onstruct(20)), t); + j = ArgumentValidation.getInt(a.exec(Target.UNKNOWN, env, null, C.onstruct(10), C.onstruct(20)), t); if(!(j < 20 && j >= 10)) { fail("Expected a number between 10 and 20, but got " + j); } } try { - a.exec(Target.UNKNOWN, env, C.onstruct(20), C.onstruct(10)); + a.exec(Target.UNKNOWN, env, null, C.onstruct(20), C.onstruct(10)); fail("Didn't expect this test to pass"); } catch (ConfigRuntimeException e) { } try { - a.exec(Target.UNKNOWN, env, C.onstruct(-1)); + a.exec(Target.UNKNOWN, env, null, C.onstruct(-1)); fail("Didn't expect this test to pass"); } catch (ConfigRuntimeException e) { } @@ -188,25 +188,25 @@ public void testRand2() throws Exception { @Test(timeout = 10000) public void testSubtract() { Math.subtract a = new Math.subtract(); - assertCEquals(C.onstruct(3), a.exec(Target.UNKNOWN, env, C.onstruct(5), C.onstruct(2))); - assertCEquals(C.onstruct(0), a.exec(Target.UNKNOWN, env, C.onstruct(3), C.onstruct(3))); - assertCEquals(C.onstruct(-1), a.exec(Target.UNKNOWN, env, C.onstruct(-3), C.onstruct(-2))); - assertCEquals(C.onstruct(3), a.exec(Target.UNKNOWN, env, C.onstruct(3.1415), C.onstruct(0.1415))); - assertCEquals(C.onstruct(281474976710655L), a.exec(Target.UNKNOWN, env, C.onstruct(562949953421310L), C.onstruct(281474976710655L))); + assertCEquals(C.onstruct(3), a.exec(Target.UNKNOWN, env, null, C.onstruct(5), C.onstruct(2))); + assertCEquals(C.onstruct(0), a.exec(Target.UNKNOWN, env, null, C.onstruct(3), C.onstruct(3))); + assertCEquals(C.onstruct(-1), a.exec(Target.UNKNOWN, env, null, C.onstruct(-3), C.onstruct(-2))); + assertCEquals(C.onstruct(3), a.exec(Target.UNKNOWN, env, null, C.onstruct(3.1415), C.onstruct(0.1415))); + assertCEquals(C.onstruct(281474976710655L), a.exec(Target.UNKNOWN, env, null, C.onstruct(562949953421310L), C.onstruct(281474976710655L))); } @Test(timeout = 10000) public void testFloor() { Math.floor a = new Math.floor(); - assertCEquals(C.onstruct(3), a.exec(Target.UNKNOWN, env, C.onstruct(3.8415))); - assertCEquals(C.onstruct(-4), a.exec(Target.UNKNOWN, env, C.onstruct(-3.1415))); + assertCEquals(C.onstruct(3), a.exec(Target.UNKNOWN, env, null, C.onstruct(3.8415))); + assertCEquals(C.onstruct(-4), a.exec(Target.UNKNOWN, env, null, C.onstruct(-3.1415))); } @Test(timeout = 10000) public void testCeil() { Math.ceil a = new Math.ceil(); - assertCEquals(C.onstruct(4), a.exec(Target.UNKNOWN, env, C.onstruct(3.1415))); - assertCEquals(C.onstruct(-3), a.exec(Target.UNKNOWN, env, C.onstruct(-3.1415))); + assertCEquals(C.onstruct(4), a.exec(Target.UNKNOWN, env, null, C.onstruct(3.1415))); + assertCEquals(C.onstruct(-3), a.exec(Target.UNKNOWN, env, null, C.onstruct(-3.1415))); } @Test(timeout = 10000) diff --git a/src/test/java/com/laytonsmith/core/functions/StringHandlingTest.java b/src/test/java/com/laytonsmith/core/functions/StringHandlingTest.java index 93aed265f5..35297f5e2f 100644 --- a/src/test/java/com/laytonsmith/core/functions/StringHandlingTest.java +++ b/src/test/java/com/laytonsmith/core/functions/StringHandlingTest.java @@ -41,16 +41,16 @@ public void tearDown() { @Test(timeout = 10000) public void testConcat() throws Exception { StringHandling.concat a = new StringHandling.concat(); - assertCEquals(C.onstruct("1234"), a.exec(Target.UNKNOWN, null, C.onstruct(1), C.onstruct(2), C.onstruct(3), C.onstruct(4))); - assertCEquals(C.onstruct("astring"), a.exec(Target.UNKNOWN, null, C.onstruct("a"), C.String("string"))); + assertCEquals(C.onstruct("1234"), a.exec(Target.UNKNOWN, null, null, C.onstruct(1), C.onstruct(2), C.onstruct(3), C.onstruct(4))); + assertCEquals(C.onstruct("astring"), a.exec(Target.UNKNOWN, null, null, C.onstruct("a"), C.String("string"))); assertEquals("05", SRun("'0' . 5", null)); } @Test(timeout = 10000) public void testLength() { StringHandling.length a = new StringHandling.length(); - assertCEquals(C.onstruct(5), a.exec(Target.UNKNOWN, null, C.onstruct("12345"))); - assertCEquals(C.onstruct(2), a.exec(Target.UNKNOWN, null, C.Array(C.onstruct(0), C.onstruct(1)))); + assertCEquals(C.onstruct(5), a.exec(Target.UNKNOWN, null, null, C.onstruct("12345"))); + assertCEquals(C.onstruct(2), a.exec(Target.UNKNOWN, null, null, C.Array(C.onstruct(0), C.onstruct(1)))); } @Test//(timeout = 10000) @@ -58,8 +58,8 @@ public void testParseArgs() throws Exception { SRun("msg(parse_args('o \"\\\\t\"', true))", fakePlayer); verify(fakePlayer).sendMessage("{o, \\t}"); StringHandling.parse_args a = new StringHandling.parse_args(); - assertCEquals(C.Array(C.onstruct("one"), C.onstruct("two")), a.exec(Target.UNKNOWN, null, C.onstruct("one two"))); - assertCEquals(C.Array(C.onstruct("one"), C.onstruct("two")), a.exec(Target.UNKNOWN, null, C.onstruct("one two"))); + assertCEquals(C.Array(C.onstruct("one"), C.onstruct("two")), a.exec(Target.UNKNOWN, null, null, C.onstruct("one two"))); + assertCEquals(C.Array(C.onstruct("one"), C.onstruct("two")), a.exec(Target.UNKNOWN, null, null, C.onstruct("one two"))); SRun("msg(parse_args('one \"two\"', true))", fakePlayer); verify(fakePlayer).sendMessage("{one, two}"); } @@ -71,9 +71,9 @@ public void testRead() { @Test(timeout = 10000) public void testReplace() { StringHandling.replace a = new StringHandling.replace(); - assertCEquals(C.onstruct("yay"), a.exec(Target.UNKNOWN, null, C.onstruct("yayathing"), C.onstruct("athing"), C.onstruct(""))); - assertCEquals(C.onstruct("yaymonkey"), a.exec(Target.UNKNOWN, null, C.onstruct("yayathing"), C.onstruct("athing"), C.onstruct("monkey"))); - assertCEquals(C.onstruct("yayathing"), a.exec(Target.UNKNOWN, null, C.onstruct("yayathing"), C.onstruct("wut"), C.onstruct("chicken"))); + assertCEquals(C.onstruct("yay"), a.exec(Target.UNKNOWN, null, null, C.onstruct("yayathing"), C.onstruct("athing"), C.onstruct(""))); + assertCEquals(C.onstruct("yaymonkey"), a.exec(Target.UNKNOWN, null, null, C.onstruct("yayathing"), C.onstruct("athing"), C.onstruct("monkey"))); + assertCEquals(C.onstruct("yayathing"), a.exec(Target.UNKNOWN, null, null, C.onstruct("yayathing"), C.onstruct("wut"), C.onstruct("chicken"))); } @Test(timeout = 10000) @@ -86,30 +86,30 @@ public void testSconcat() throws Exception { @Test(timeout = 10000) public void testSubstr() { StringHandling.substr a = new StringHandling.substr(); - assertCEquals(C.onstruct("urge"), a.exec(Target.UNKNOWN, null, C.onstruct("hamburger"), C.onstruct(4), C.onstruct(8))); - assertCEquals(C.onstruct("mile"), a.exec(Target.UNKNOWN, null, C.onstruct("smiles"), C.onstruct(1), C.onstruct(5))); - assertCEquals(C.onstruct("ning"), a.exec(Target.UNKNOWN, null, C.onstruct("lightning"), C.onstruct(5))); + assertCEquals(C.onstruct("urge"), a.exec(Target.UNKNOWN, null, null, C.onstruct("hamburger"), C.onstruct(4), C.onstruct(8))); + assertCEquals(C.onstruct("mile"), a.exec(Target.UNKNOWN, null, null, C.onstruct("smiles"), C.onstruct(1), C.onstruct(5))); + assertCEquals(C.onstruct("ning"), a.exec(Target.UNKNOWN, null, null, C.onstruct("lightning"), C.onstruct(5))); } @Test(timeout = 10000) public void testToUpper() { StringHandling.to_upper a = new StringHandling.to_upper(); - assertCEquals(C.onstruct("TESTING 123"), a.exec(Target.UNKNOWN, null, C.onstruct("testing 123"))); - assertCEquals(C.onstruct("TESTING 123"), a.exec(Target.UNKNOWN, null, C.onstruct("TeStInG 123"))); + assertCEquals(C.onstruct("TESTING 123"), a.exec(Target.UNKNOWN, null, null, C.onstruct("testing 123"))); + assertCEquals(C.onstruct("TESTING 123"), a.exec(Target.UNKNOWN, null, null, C.onstruct("TeStInG 123"))); } @Test(timeout = 10000) public void testToLower() { StringHandling.to_lower a = new StringHandling.to_lower(); - assertCEquals(C.onstruct("testing 123"), a.exec(Target.UNKNOWN, null, C.onstruct("TESTING 123"))); - assertCEquals(C.onstruct("testing 123"), a.exec(Target.UNKNOWN, null, C.onstruct("TeStInG 123"))); + assertCEquals(C.onstruct("testing 123"), a.exec(Target.UNKNOWN, null, null, C.onstruct("TESTING 123"))); + assertCEquals(C.onstruct("testing 123"), a.exec(Target.UNKNOWN, null, null, C.onstruct("TeStInG 123"))); } @Test(timeout = 10000) public void testTrim() { StringHandling.trim a = new StringHandling.trim(); - assertCEquals(C.onstruct("test 123"), a.exec(Target.UNKNOWN, null, C.onstruct(" test 123 "))); - assertCEquals(C.onstruct("test 123"), a.exec(Target.UNKNOWN, null, C.onstruct("test 123"))); + assertCEquals(C.onstruct("test 123"), a.exec(Target.UNKNOWN, null, null, C.onstruct(" test 123 "))); + assertCEquals(C.onstruct("test 123"), a.exec(Target.UNKNOWN, null, null, C.onstruct("test 123"))); } @Test diff --git a/src/test/java/com/laytonsmith/testing/RandomTests.java b/src/test/java/com/laytonsmith/testing/RandomTests.java index 553a00bf39..998db8df57 100644 --- a/src/test/java/com/laytonsmith/testing/RandomTests.java +++ b/src/test/java/com/laytonsmith/testing/RandomTests.java @@ -362,7 +362,7 @@ public void done(String output) { public void testVoidAndReturnedVoidAreTheExactSame() throws Exception { try { Environment env = Static.GenerateStandaloneEnvironment(true); - Mixed returnedVoid = new ArrayHandling.array_insert().exec(Target.UNKNOWN, env, + Mixed returnedVoid = new ArrayHandling.array_insert().exec(Target.UNKNOWN, env, null, C.Array(), C.String(""), C.Int(0)); Construct voidKeyword = Static.resolveConstruct("void", Target.UNKNOWN); assertTrue(returnedVoid == voidKeyword); diff --git a/src/test/java/com/laytonsmith/testing/StaticTest.java b/src/test/java/com/laytonsmith/testing/StaticTest.java index 8a88f118f8..bcadb0ad89 100644 --- a/src/test/java/com/laytonsmith/testing/StaticTest.java +++ b/src/test/java/com/laytonsmith/testing/StaticTest.java @@ -289,7 +289,7 @@ public static void TestExec(Function f, MCCommandSender p, String commandType) t } } try { - f.exec(Target.UNKNOWN, env, con); + Function.ExecuteFunction(f, Target.UNKNOWN, env, con); } catch (CancelCommandException e) { } catch (ConfigRuntimeException e) { if(f.getName().equals("throw")) { @@ -364,7 +364,7 @@ public static Object Val(Mixed c) { */ public static void assertCEquals(Mixed expected, Mixed actual) throws CancelCommandException { equals e = new equals(); - CBoolean ret = (CBoolean) e.exec(Target.UNKNOWN, null, expected, actual); + CBoolean ret = (CBoolean) e.exec(Target.UNKNOWN, null, null, expected, actual); if(ret.getBoolean() == false) { throw new AssertionError("Expected " + expected + " and " + actual + " to be equal to each other"); } @@ -379,7 +379,7 @@ public static void assertCEquals(Mixed expected, Mixed actual) throws CancelComm */ public static void assertCNotEquals(Mixed expected, Mixed actual) throws CancelCommandException { equals e = new equals(); - CBoolean ret = (CBoolean) e.exec(Target.UNKNOWN, null, expected, actual); + CBoolean ret = (CBoolean) e.exec(Target.UNKNOWN, null, null, expected, actual); if(ret.getBoolean() == true) { throw new AssertionError("Did not expect " + expected + " and " + actual + " to be equal to each other"); } From 53ead85a126ffc4ce50fe9ab4800fc213d1ea471 Mon Sep 17 00:00:00 2001 From: LadyCailin Date: Wed, 18 Feb 2026 15:56:59 +0100 Subject: [PATCH 2/2] Small fixes --- src/main/java/com/laytonsmith/core/functions/Compiler.java | 2 +- .../java/com/laytonsmith/core/functions/ControlFlow.java | 1 + src/main/java/com/laytonsmith/core/functions/Math.java | 4 ++-- .../com/laytonsmith/core/functions/PlayerManagement.java | 6 +++--- src/main/java/com/laytonsmith/core/functions/World.java | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/laytonsmith/core/functions/Compiler.java b/src/main/java/com/laytonsmith/core/functions/Compiler.java index 238e923619..47ff8d62d8 100644 --- a/src/main/java/com/laytonsmith/core/functions/Compiler.java +++ b/src/main/java/com/laytonsmith/core/functions/Compiler.java @@ -1068,7 +1068,7 @@ public Boolean runAsync() { @Override public Mixed exec(Target t, Environment environment, GenericParameters generics, Mixed... args) throws ConfigRuntimeException { - throw new UnsupportedOperationException(getName()+ " should have been compiled out. If you are reaching" + throw new UnsupportedOperationException(getName() + " should have been compiled out. If you are reaching" + " this, an error has occurred in the parser. Please report this error to the developers."); } diff --git a/src/main/java/com/laytonsmith/core/functions/ControlFlow.java b/src/main/java/com/laytonsmith/core/functions/ControlFlow.java index 04f273f6c9..6f109abe7c 100644 --- a/src/main/java/com/laytonsmith/core/functions/ControlFlow.java +++ b/src/main/java/com/laytonsmith/core/functions/ControlFlow.java @@ -2874,6 +2874,7 @@ public Mixed exec(Target t, Environment environment, GenericParameters generics, for(int i = 1; i < args2.length; i++) { args2[i] = ca.get(i - 1, t); } + // TODO: This probably needs to change once generics are added return super.exec(t, environment, null, args2); } diff --git a/src/main/java/com/laytonsmith/core/functions/Math.java b/src/main/java/com/laytonsmith/core/functions/Math.java index 2a0e6a477a..54a2f17d45 100644 --- a/src/main/java/com/laytonsmith/core/functions/Math.java +++ b/src/main/java/com/laytonsmith/core/functions/Math.java @@ -522,7 +522,7 @@ public Set optimizationOptions() { * * @return */ - protected static Mixed doIncrementDecrement(ParseTree[] nodes, + private static Mixed doIncrementDecrement(ParseTree[] nodes, Script parent, Environment env, Target t, Function func, boolean pre, boolean inc) { if(nodes[0].getData() instanceof CFunction && ((CFunction) nodes[0].getData()).hasFunction()) { @@ -597,7 +597,7 @@ protected static Mixed doIncrementDecrement(ParseTree[] nodes, for(int i = 0; i < args.length; i++) { args[i] = parent.eval(nodes[i], env); } - return Function.ExecuteFunction(func, t, env, args); + return func.exec(t, env, null, args); } @api diff --git a/src/main/java/com/laytonsmith/core/functions/PlayerManagement.java b/src/main/java/com/laytonsmith/core/functions/PlayerManagement.java index c1fc00040f..f2570cdd1c 100644 --- a/src/main/java/com/laytonsmith/core/functions/PlayerManagement.java +++ b/src/main/java/com/laytonsmith/core/functions/PlayerManagement.java @@ -2046,7 +2046,7 @@ public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed.. m = Static.GetPlayer(args[0].val(), t); } Static.AssertPlayerNonNull(m, t); - int texp = m.getExpAtLevel()+ java.lang.Math.round(m.getExpToLevel() * m.getExp()); + int texp = m.getExpAtLevel() + java.lang.Math.round(m.getExpToLevel() * m.getExp()); return new CInt(texp, t); } } @@ -5111,7 +5111,7 @@ public Mixed exec(Target t, Environment environment, GenericParameters generics, + " requires a player argument when ran from a non-player", t); } } - return new CInt((op == null ? 0 : op.getFirstPlayed()), t);// Return 0 for fake/null command senders. + return new CInt((op == null ? 0 : op.getFirstPlayed()), t); // Return 0 for fake/null command senders. } @Override @@ -5178,7 +5178,7 @@ public Mixed exec(Target t, Environment environment, GenericParameters generics, + " requires a player argument when ran from a non-player", t); } } - return new CInt((op == null ? 0 : op.getLastPlayed()), t);// Return 0 for fake/null command senders. + return new CInt((op == null ? 0 : op.getLastPlayed()), t); // Return 0 for fake/null command senders. } @Override diff --git a/src/main/java/com/laytonsmith/core/functions/World.java b/src/main/java/com/laytonsmith/core/functions/World.java index 3fc2944565..2a52f73c86 100644 --- a/src/main/java/com/laytonsmith/core/functions/World.java +++ b/src/main/java/com/laytonsmith/core/functions/World.java @@ -1383,7 +1383,7 @@ public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed.. MCPlayer p = env.getEnv(CommandHelperEnvironment.class).GetPlayer(); MCLocation loc = ObjectGenerator.GetGenerator().location(args[0], p != null ? p.getWorld() : null, t); - MCMaterial mat= StaticLayer.GetMaterial(args[1].val()); + MCMaterial mat = StaticLayer.GetMaterial(args[1].val()); if(mat == null) { mat = Static.ParseItemNotation(getName(), args[1].val(), 1, t).getType(); }