Permalink
Browse files

All non-function, non-event code is updated now

  • Loading branch information...
LadyCailin committed Nov 15, 2018
1 parent 4c738d0 commit a66f9ac87363942563aa99d7b51316aec08194bb
Showing with 493 additions and 387 deletions.
  1. +3 −2 src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCCommand.java
  2. +3 −3 src/main/java/com/laytonsmith/abstraction/bukkit/events/BukkitAbstractEventMixin.java
  3. +31 −31 src/main/java/com/laytonsmith/core/ArgumentValidation.java
  4. +30 −22 src/main/java/com/laytonsmith/core/MethodScriptCompiler.java
  5. +48 −47 src/main/java/com/laytonsmith/core/ObjectGenerator.java
  6. +2 −2 src/main/java/com/laytonsmith/core/Optimizable.java
  7. +23 −13 src/main/java/com/laytonsmith/core/ParseTree.java
  8. +2 −2 src/main/java/com/laytonsmith/core/PlatformResolver.java
  9. +10 −9 src/main/java/com/laytonsmith/core/Procedure.java
  10. +37 −31 src/main/java/com/laytonsmith/core/Script.java
  11. +36 −35 src/main/java/com/laytonsmith/core/Static.java
  12. +2 −1 src/main/java/com/laytonsmith/core/compiler/MethodScriptStaticCompiler.java
  13. +36 −36 src/main/java/com/laytonsmith/core/constructs/CArray.java
  14. +9 −8 src/main/java/com/laytonsmith/core/constructs/CByteArray.java
  15. +6 −6 src/main/java/com/laytonsmith/core/constructs/CClosure.java
  16. +1 −1 src/main/java/com/laytonsmith/core/constructs/CFunction.java
  17. +6 −5 src/main/java/com/laytonsmith/core/constructs/CIClosure.java
  18. +1 −1 src/main/java/com/laytonsmith/core/constructs/CIdentifier.java
  19. +14 −13 src/main/java/com/laytonsmith/core/constructs/CMutablePrimitive.java
  20. +0 −5 src/main/java/com/laytonsmith/core/constructs/CNull.java
  21. +10 −9 src/main/java/com/laytonsmith/core/constructs/CSlice.java
  22. +10 −9 src/main/java/com/laytonsmith/core/constructs/CString.java
  23. +62 −7 src/main/java/com/laytonsmith/core/constructs/Construct.java
  24. +4 −4 src/main/java/com/laytonsmith/core/constructs/IVariable.java
  25. +4 −4 src/main/java/com/laytonsmith/core/events/AbstractEvent.java
  26. +13 −12 src/main/java/com/laytonsmith/core/events/BoundEvent.java
  27. +4 −4 src/main/java/com/laytonsmith/core/events/Event.java
  28. +2 −2 src/main/java/com/laytonsmith/core/events/EventMixinInterface.java
  29. +3 −2 src/main/java/com/laytonsmith/core/events/drivers/BlockEvents.java
  30. +18 −17 src/main/java/com/laytonsmith/core/events/drivers/PlayerEvents.java
  31. +6 −5 src/main/java/com/laytonsmith/core/events/drivers/ServerEvents.java
  32. +7 −7 src/main/java/com/laytonsmith/core/exceptions/CRE/AbstractCREException.java
  33. +4 −4 src/main/java/com/laytonsmith/core/exceptions/ConfigRuntimeException.java
  34. +3 −2 src/main/java/com/laytonsmith/core/exceptions/MarshalException.java
  35. +2 −1 src/main/java/com/laytonsmith/core/functions/DataHandling.java
  36. +8 −5 src/main/java/com/laytonsmith/core/functions/Function.java
  37. +2 −2 src/main/java/com/laytonsmith/core/functions/FunctionList.java
  38. +2 −2 src/main/java/com/laytonsmith/core/functions/bash/BashPlatformResolver.java
  39. +5 −0 src/main/java/com/laytonsmith/core/natives/interfaces/AbstractMixedInterfaceRunner.java
  40. +1 −2 src/main/java/com/laytonsmith/core/natives/interfaces/ArrayAccess.java
  41. +5 −0 src/main/java/com/laytonsmith/core/natives/interfaces/MEnumType.java
  42. +3 −1 src/main/java/com/laytonsmith/core/natives/interfaces/Mixed.java
  43. +2 −1 src/main/java/com/laytonsmith/tools/Manager.java
  44. +3 −2 src/main/java/com/laytonsmith/tools/ShellEventMixin.java
  45. +10 −10 src/test/java/com/laytonsmith/testing/StaticTest.java
@@ -20,6 +20,7 @@
import com.laytonsmith.core.exceptions.ConfigRuntimeException;
import com.laytonsmith.core.exceptions.FunctionReturnException;
import com.laytonsmith.core.functions.Commands;
import com.laytonsmith.core.natives.interfaces.Mixed;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.command.Command;
@@ -218,11 +219,11 @@ public String toString() {
if(fret instanceof CArray) {
List<String> ret = new ArrayList<>();
if(((CArray) fret).inAssociativeMode()) {
for(Construct key : ((CArray) fret).keySet()) {
for(Mixed key : ((CArray) fret).keySet()) {
ret.add(((CArray) fret).get(key, Target.UNKNOWN).val());
}
} else {
for(Construct value : ((CArray) fret).asList()) {
for(Mixed value : ((CArray) fret).asList()) {
ret.add(value.val());
}
}
@@ -3,12 +3,12 @@
import com.laytonsmith.abstraction.bukkit.BukkitMCServer;
import com.laytonsmith.core.Static;
import com.laytonsmith.core.constructs.CString;
import com.laytonsmith.core.constructs.Construct;
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.events.AbstractEvent;
import com.laytonsmith.core.events.BindableEvent;
import com.laytonsmith.core.events.EventMixinInterface;
import com.laytonsmith.core.exceptions.EventException;
import com.laytonsmith.core.natives.interfaces.Mixed;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.entity.Entity;
@@ -40,8 +40,8 @@ public void cancel(BindableEvent e, boolean state) {
}
@Override
public Map<String, Construct> evaluate_helper(BindableEvent event) throws EventException {
Map<String, Construct> map = new HashMap<>();
public Map<String, Mixed> evaluate_helper(BindableEvent event) throws EventException {
Map<String, Mixed> map = new HashMap<>();
map.put("event_type", new CString(mySuper.getName(), Target.UNKNOWN));
String macro;
Object e = event._GetObject();
@@ -17,10 +17,10 @@
import com.laytonsmith.core.constructs.CNull;
import com.laytonsmith.core.constructs.CNumber;
import com.laytonsmith.core.constructs.CString;
import com.laytonsmith.core.constructs.Construct;
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.exceptions.ConfigRuntimeException;
import com.laytonsmith.core.natives.interfaces.ArrayAccess;
import com.laytonsmith.core.natives.interfaces.Mixed;
import java.util.regex.Pattern;
@@ -49,7 +49,7 @@ private ArgumentValidation() {
* @throws ConfigRuntimeException A FormatException is thrown if it doesn't contain the appropriate value and the
* defaultItem is null.
*/
public static Construct getItemFromArray(CArray object, String key, Target t, Construct defaultItem) throws ConfigRuntimeException {
public static Mixed getItemFromArray(CArray object, String key, Target t, Mixed defaultItem) throws ConfigRuntimeException {
if(object.containsKey(key)) {
return object.get(key, t);
} else if(defaultItem == null) {
@@ -66,7 +66,7 @@ public static Construct getItemFromArray(CArray object, String key, Target t, Co
* @param t
* @return
*/
public static CArray getArray(Construct construct, Target t) {
public static CArray getArray(Mixed construct, Target t) {
if(construct instanceof CArray) {
return ((CArray) construct);
} else {
@@ -75,7 +75,7 @@ public static CArray getArray(Construct construct, Target t) {
}
/**
* Works like the other get* methods, but works in a more generic way for other types of Constructs.
* Works like the other get* methods, but works in a more generic way for other types of Mixeds.
*
* @param <T> The type expected.
* @param construct The generic object
@@ -85,11 +85,11 @@ public static CArray getArray(Construct construct, Target t) {
* @param clazz The type expected.
* @return The properly cast object.
* @deprecated Use
* {@link #getObject(com.laytonsmith.core.constructs.Construct, com.laytonsmith.core.constructs.Target, java.lang.Class)}
* {@link #getObject(Mixed, com.laytonsmith.core.constructs.Target, java.lang.Class)}
* instead, as that gets the expected class name automatically.
*/
@Deprecated
public static <T extends Construct> T getObject(Construct construct, Target t, String expectedClassName, Class<T> clazz) {
public static <T extends Mixed> T getObject(Mixed construct, Target t, String expectedClassName, Class<T> clazz) {
if(clazz.isAssignableFrom(construct.getClass())) {
return (T) construct;
} else {
@@ -98,7 +98,7 @@ public static CArray getArray(Construct construct, Target t) {
}
/**
* Works like the other get* methods, but works in a more generic way for other types of Constructs. It also assumes
* Works like the other get* methods, but works in a more generic way for other types of Mixeds. It also assumes
* that the class specified is tagged with a typeof annotation, thereby preventing the need for the
* expectedClassName like the deprecated version uses.
*
@@ -114,7 +114,7 @@ public static CArray getArray(Construct construct, Target t) {
* @param clazz The type expected.
* @return The properly cast object.
*/
public static <T extends Construct> T getObject(Construct construct, Target t, Class<T> clazz) {
public static <T extends Mixed> T getObject(Mixed construct, Target t, Class<T> clazz) {
if(clazz.isAssignableFrom(construct.getClass())) {
return (T) construct;
} else {
@@ -134,7 +134,7 @@ public static CArray getArray(Construct construct, Target t) {
* @param t
* @return
*/
public static double getNumber(Construct c, Target t) {
public static double getNumber(Mixed c, Target t) {
if(c instanceof CMutablePrimitive) {
c = ((CMutablePrimitive) c).get();
}
@@ -191,10 +191,10 @@ public static double getNumber(Construct c, Target t) {
/**
* Validates that a construct's value is a number or string that can be returned by GetNumber()
*
* @param c Construct
* @param c Mixed
* @return boolean
*/
public static boolean isNumber(Construct c) {
public static boolean isNumber(Mixed c) {
return c instanceof CNumber || VALID_DOUBLE.matcher(c.val()).matches();
}
@@ -205,7 +205,7 @@ public static boolean isNumber(Construct c) {
* @param t
* @return
*/
public static double getDouble(Construct c, Target t) {
public static double getDouble(Mixed c, Target t) {
if(c instanceof CMutablePrimitive) {
c = ((CMutablePrimitive) c).get();
}
@@ -225,7 +225,7 @@ public static double getDouble(Construct c, Target t) {
* @param t
* @return
*/
public static float getDouble32(Construct c, Target t) {
public static float getDouble32(Mixed c, Target t) {
if(c instanceof CMutablePrimitive) {
c = ((CMutablePrimitive) c).get();
}
@@ -246,7 +246,7 @@ public static float getDouble32(Construct c, Target t) {
* @param t
* @return
*/
public static long getInt(Construct c, Target t) {
public static long getInt(Mixed c, Target t) {
if(c instanceof CMutablePrimitive) {
c = ((CMutablePrimitive) c).get();
}
@@ -281,7 +281,7 @@ public static long getInt(Construct c, Target t) {
* @param t
* @return
*/
public static int getInt32(Construct c, Target t) {
public static int getInt32(Mixed c, Target t) {
if(c instanceof CMutablePrimitive) {
c = ((CMutablePrimitive) c).get();
}
@@ -302,7 +302,7 @@ public static int getInt32(Construct c, Target t) {
* @param t
* @return
*/
public static short getInt16(Construct c, Target t) {
public static short getInt16(Mixed c, Target t) {
if(c instanceof CMutablePrimitive) {
c = ((CMutablePrimitive) c).get();
}
@@ -323,7 +323,7 @@ public static short getInt16(Construct c, Target t) {
* @param t
* @return
*/
public static byte getInt8(Construct c, Target t) {
public static byte getInt8(Mixed c, Target t) {
if(c instanceof CMutablePrimitive) {
c = ((CMutablePrimitive) c).get();
}
@@ -344,7 +344,7 @@ public static byte getInt8(Construct c, Target t) {
* @param t
* @return
*/
public static boolean getBoolean(Construct c, Target t) {
public static boolean getBoolean(Mixed c, Target t) {
if(c instanceof CMutablePrimitive) {
c = ((CMutablePrimitive) c).get();
}
@@ -376,7 +376,7 @@ public static boolean getBoolean(Construct c, Target t) {
* @param t
* @return
*/
public static CByteArray getByteArray(Construct c, Target t) {
public static CByteArray getByteArray(Mixed c, Target t) {
if(c instanceof CByteArray) {
return (CByteArray) c;
} else if(c instanceof CNull) {
@@ -386,7 +386,7 @@ public static CByteArray getByteArray(Construct c, Target t) {
}
}
public static CClassType getClassType(Construct c, Target t) {
public static CClassType getClassType(Mixed c, Target t) {
if(c instanceof CClassType) {
return (CClassType) c;
} else {
@@ -395,14 +395,14 @@ public static CClassType getClassType(Construct c, Target t) {
}
/**
* Returns a String object from the given construct. Note that no validation is done, because all Constructs can be
* Returns a String object from the given construct. Note that no validation is done, because all Mixeds can be
* toString'd, but this method is provided for consistency sake.
*
* @param c
* @param t
* @return
*/
public static String getString(Construct c, Target t) {
public static String getString(Mixed c, Target t) {
return c.val();
}
@@ -412,8 +412,8 @@ public static String getString(Construct c, Target t) {
* @param c
* @return
*/
public static boolean anyDoubles(Construct... c) {
for(Construct c1 : c) {
public static boolean anyDoubles(Mixed... c) {
for(Mixed c1 : c) {
if(c1 instanceof CDouble) {
return true;
}
@@ -427,8 +427,8 @@ public static boolean anyDoubles(Construct... c) {
* @param c
* @return
*/
public static boolean anyStrings(Construct... c) {
for(Construct c1 : c) {
public static boolean anyStrings(Mixed... c) {
for(Mixed c1 : c) {
if(c1 instanceof CString) {
return true;
}
@@ -442,8 +442,8 @@ public static boolean anyStrings(Construct... c) {
* @param c
* @return
*/
public static boolean anyNulls(Construct... c) {
for(Construct c1 : c) {
public static boolean anyNulls(Mixed... c) {
for(Mixed c1 : c) {
if(c1 instanceof CNull) {
return true;
}
@@ -457,8 +457,8 @@ public static boolean anyNulls(Construct... c) {
* @param c
* @return
*/
public static boolean anyBooleans(Construct... c) {
for(Construct c1 : c) {
public static boolean anyBooleans(Mixed... c) {
for(Mixed c1 : c) {
if(c1 instanceof CBoolean) {
return true;
}
@@ -479,7 +479,7 @@ public static boolean anyBooleans(Construct... c) {
* describes the valid options. If the value is an MEnum, then the name defined there will be used, otherwise the
* class name will be used.
*/
public static <T extends Enum<T>> T getEnum(Construct c, Class<T> enumClass, Target t) {
public static <T extends Enum<T>> T getEnum(Mixed c, Class<T> enumClass, Target t) {
String val = c.val();
try {
return Enum.valueOf(enumClass, val);
Oops, something went wrong.

0 comments on commit a66f9ac

Please sign in to comment.