Permalink
Browse files

Merge branch 'master' into new-html-docs

Supermerge!

Fixed a number of merge conflicts due to spacing issues. Hopefully that
is the last time I have to do that.
  • Loading branch information...
LadyCailin committed Nov 8, 2017
2 parents f935722 + 15e4836 commit e0c028c24007e11d4159548d1340af9e772f2684
Showing with 4,171 additions and 3,802 deletions.
  1. +4 −3 src/main/java/com/laytonsmith/PureUtilities/ClassLoading/Annotations/CacheAnnotations.java
  2. +100 −68 src/main/java/com/laytonsmith/PureUtilities/Common/Annotations/AnnotationChecks.java
  3. +2 −0 src/main/java/com/laytonsmith/abstraction/MCPlayer.java
  4. +35 −2 src/main/java/com/laytonsmith/abstraction/bukkit/entities/BukkitMCCommandMinecart.java
  5. +14 −0 src/main/java/com/laytonsmith/abstraction/bukkit/entities/BukkitMCPlayer.java
  6. +3 −1 src/main/java/com/laytonsmith/abstraction/entities/MCCommandMinecart.java
  7. +8 −6 src/main/java/com/laytonsmith/commandhelper/CommandHelperPlugin.java
  8. +15 −4 src/main/java/com/laytonsmith/commandhelper/CommandHelperServerListener.java
  9. +3 −0 src/main/java/com/laytonsmith/core/AliasCore.java
  10. +5 −4 src/main/java/com/laytonsmith/core/Procedure.java
  11. +763 −767 src/main/java/com/laytonsmith/core/Static.java
  12. +2 −1 src/main/java/com/laytonsmith/core/compiler/ProcedureDefinition.java
  13. +2 −1 src/main/java/com/laytonsmith/core/compiler/ProcedureUsage.java
  14. +2 −2 src/main/java/com/laytonsmith/core/compiler/keywords/AutoKeyword.java
  15. +29 −28 src/main/java/com/laytonsmith/core/compiler/keywords/ClosureKeyword.java
  16. +29 −28 src/main/java/com/laytonsmith/core/compiler/keywords/IClosureKeyword.java
  17. +9 −0 src/main/java/com/laytonsmith/core/constructs/Auto.java
  18. +565 −543 src/main/java/com/laytonsmith/core/constructs/CArray.java
  19. +1 −1 src/main/java/com/laytonsmith/core/constructs/CBareString.java
  20. +4 −1 src/main/java/com/laytonsmith/core/constructs/CBoolean.java
  21. +2 −1 src/main/java/com/laytonsmith/core/constructs/CBrace.java
  22. +2 −1 src/main/java/com/laytonsmith/core/constructs/CBracket.java
  23. +13 −6 src/main/java/com/laytonsmith/core/constructs/CByteArray.java
  24. +81 −143 src/main/java/com/laytonsmith/core/constructs/CClassType.java
  25. +137 −136 src/main/java/com/laytonsmith/core/constructs/CClosure.java
  26. +4 −1 src/main/java/com/laytonsmith/core/constructs/CDouble.java
  27. +2 −1 src/main/java/com/laytonsmith/core/constructs/CEntry.java
  28. +2 −1 src/main/java/com/laytonsmith/core/constructs/CFunction.java
  29. +96 −93 src/main/java/com/laytonsmith/core/constructs/CIClosure.java
  30. +2 −1 src/main/java/com/laytonsmith/core/constructs/CIdentifier.java
  31. +4 −1 src/main/java/com/laytonsmith/core/constructs/CInt.java
  32. +2 −1 src/main/java/com/laytonsmith/core/constructs/CKeyword.java
  33. +2 −1 src/main/java/com/laytonsmith/core/constructs/CLabel.java
  34. +2 −1 src/main/java/com/laytonsmith/core/constructs/CLock.java
  35. +6 −3 src/main/java/com/laytonsmith/core/constructs/CMutablePrimitive.java
  36. +3 −0 src/main/java/com/laytonsmith/core/constructs/CNull.java
  37. +10 −6 src/main/java/com/laytonsmith/core/constructs/CNumber.java
  38. +1 −1 src/main/java/com/laytonsmith/core/constructs/CNumberRunner.java
  39. +2 −1 src/main/java/com/laytonsmith/core/constructs/CPreIdentifier.java
  40. +11 −6 src/main/java/com/laytonsmith/core/constructs/CPrimitive.java
  41. +2 −1 src/main/java/com/laytonsmith/core/constructs/CPrimitiveRunner.java
  42. +5 −1 src/main/java/com/laytonsmith/core/constructs/CResource.java
  43. +4 −1 src/main/java/com/laytonsmith/core/constructs/CSlice.java
  44. +7 −4 src/main/java/com/laytonsmith/core/constructs/CString.java
  45. +2 −1 src/main/java/com/laytonsmith/core/constructs/CSymbol.java
  46. +3 −0 src/main/java/com/laytonsmith/core/constructs/CVoid.java
  47. +2 −1 src/main/java/com/laytonsmith/core/constructs/Command.java
  48. +230 −229 src/main/java/com/laytonsmith/core/constructs/Construct.java
  49. +20 −19 src/main/java/com/laytonsmith/core/constructs/IVariable.java
  50. +1 −1 src/main/java/com/laytonsmith/core/constructs/IVariableList.java
  51. +2 −1 src/main/java/com/laytonsmith/core/constructs/NewIVariable.java
  52. +2 −1 src/main/java/com/laytonsmith/core/constructs/Variable.java
  53. +13 −0 src/main/java/com/laytonsmith/core/environments/CommandHelperEnvironment.java
  54. +2 −2 src/main/java/com/laytonsmith/core/events/BoundEvent.java
  55. +87 −87 src/main/java/com/laytonsmith/core/exceptions/CRE/AbstractCREException.java
  56. +9 −6 src/main/java/com/laytonsmith/core/exceptions/CRE/CREBadEntityException.java
  57. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREBadEntityTypeException.java
  58. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREBindException.java
  59. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CRECastException.java
  60. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREEnchantmentException.java
  61. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREError.java
  62. +10 −7 src/main/java/com/laytonsmith/core/exceptions/CRE/CREEventException.java
  63. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREException.java
  64. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREFormatException.java
  65. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREIOException.java
  66. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREIllegalArgumentException.java
  67. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREIncludeException.java
  68. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREIndexOverflowException.java
  69. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREInsufficientArgumentsException.java
  70. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREInsufficientPermissionException.java
  71. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREInvalidPluginException.java
  72. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREInvalidProcedureException.java
  73. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREInvalidWorldException.java
  74. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CRELengthException.java
  75. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CRENotFoundException.java
  76. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CRENullPointerException.java
  77. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREOAuthException.java
  78. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREPlayerOfflineException.java
  79. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREPluginChannelException.java
  80. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREPluginInternalException.java
  81. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CRERangeException.java
  82. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREReadOnlyException.java
  83. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CRESQLException.java
  84. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREScoreboardException.java
  85. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CRESecurityException.java
  86. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREShellException.java
  87. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREStackOverflowError.java
  88. +7 −3 src/main/java/com/laytonsmith/core/exceptions/CRE/CREThrowable.java
  89. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREUnageableMobException.java
  90. +3 −0 src/main/java/com/laytonsmith/core/exceptions/CRE/CREUntameableMobException.java
  91. +7 −7 src/main/java/com/laytonsmith/core/functions/CompositeFunction.java
  92. +7 −6 src/main/java/com/laytonsmith/core/functions/DataHandling.java
  93. +717 −647 src/main/java/com/laytonsmith/core/functions/Echoes.java
  94. +2 −0 src/main/java/com/laytonsmith/core/functions/EntityManagement.java
  95. +3 −3 src/main/java/com/laytonsmith/core/functions/Exceptions.java
  96. +873 −863 src/main/java/com/laytonsmith/core/functions/Meta.java
  97. +2 −1 src/main/java/com/laytonsmith/core/functions/PlayerManagement.java
  98. +12 −6 src/main/java/com/laytonsmith/core/functions/Weather.java
  99. +4 −0 src/main/java/com/laytonsmith/core/natives/interfaces/ArrayAccess.java
  100. +1 −1 src/main/java/com/laytonsmith/core/natives/interfaces/ArrayAccessRunner.java
  101. +4 −0 src/main/java/com/laytonsmith/core/natives/interfaces/Mixed.java
  102. +1 −1 src/main/java/com/laytonsmith/core/natives/interfaces/SizableRunner.java
  103. +10 −5 src/main/java/com/laytonsmith/core/natives/interfaces/Sizeable.java
  104. +1 −1 src/main/java/com/laytonsmith/tools/Interpreter.java
  105. +32 −7 src/test/java/com/laytonsmith/core/constructs/TestCClassType.java
  106. +8 −10 src/test/java/com/laytonsmith/core/functions/MathTest.java
  107. +2 −1 src/test/java/com/laytonsmith/testing/C.java
  108. +2 −13 src/test/java/com/laytonsmith/testing/RandomTests.java
@@ -28,7 +28,7 @@
*
*/
public class CacheAnnotations {
public static void main(String[] args) throws Exception {
File outputDir = new File(args[0]);
File scanDir = new File(args[1]);
@@ -50,7 +50,8 @@ public static void main(String[] args) throws Exception {
ClassDiscovery.getDefaultInstance().addDiscoveryLocation(cacheFile);
StreamUtils.GetSystemOut().println("-- Checking for custom compile errors --");
AnnotationChecks.checkForceImplementation();
AnnotationChecks.checkForTypeInTypeofClasses();
Implementation.setServerType(Implementation.Type.SHELL);
List<String> uhohs = new ArrayList<>();
Set<Class> apiClasses = new HashSet<>();
@@ -91,7 +92,7 @@ public static void main(String[] args) throws Exception {
if(!m.getName().equals("getName")){
if(c.getAnnotation(typeof.class) != null && !isGetNameExempt){
uhohs.add(c.getName() + " must implement " + m.getName() + "().");
}
}
}
} catch (SecurityException ex) {
throw new Error(ex);
@@ -1,7 +1,12 @@
package com.laytonsmith.PureUtilities.Common.Annotations;
import com.laytonsmith.PureUtilities.ClassLoading.ClassDiscovery;
import com.laytonsmith.PureUtilities.ClassLoading.ClassMirror.ClassMirror;
import com.laytonsmith.PureUtilities.ClassLoading.ClassMirror.FieldMirror;
import com.laytonsmith.PureUtilities.Common.ReflectionUtils;
import com.laytonsmith.PureUtilities.Common.StringUtils;
import com.laytonsmith.annotations.typeof;
import com.laytonsmith.core.constructs.CClassType;
import java.lang.reflect.Constructor;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
@@ -14,87 +19,114 @@
import java.util.Set;
/**
* This class is run by maven at compile time, and checks to ensure that the various
* annotations referenced here are checked, and fail if any of the parameters are missing.
* This class is run by maven at compile time, and checks to ensure that the various annotations referenced here are
* checked, and fail if any of the parameters are missing.
*/
public class AnnotationChecks {
@SuppressWarnings("UnnecessaryLabelOnBreakStatement")
public static void checkForceImplementation() throws Exception{
Set<String> uhohs = new HashSet<>();
Set<Constructor<?>> set = ClassDiscovery.getDefaultInstance().loadConstructorsWithAnnotation(ForceImplementation.class);
for(Constructor<?> cons : set){
Class superClass = cons.getDeclaringClass();
Set<Class> s = ClassDiscovery.getDefaultInstance().loadClassesThatExtend(superClass);
checkImplements: for(Class c : s){
// c is the class we want to check to make sure it implements cons
for(Constructor cCons : c.getDeclaredConstructors()){
if(Arrays.equals(cons.getParameterTypes(), cCons.getParameterTypes())){
continue checkImplements;
}
}
if(c.isMemberClass() && (c.getModifiers() & Modifier.STATIC) == 0){
// Ok, so, an inner, non static class actually passes the super class's reference to the constructor as
// the first parameter, at a byte code level. So this is a different type of error, or at least, a different
// error message will be helpful.
uhohs.add(c.getName() + " must be static.");
} else {
uhohs.add(c.getName() + " must implement the constructor with signature (" + getSignature(cons) + "), but doesn't.");
}
}
public static void checkForTypeInTypeofClasses() throws Exception {
Set<ClassMirror<?>> classes = ClassDiscovery.getDefaultInstance().getClassesWithAnnotation(typeof.class);
Set<String> errors = new HashSet<>();
for (ClassMirror<?> clazz : classes) {
try {
// Make sure that TYPE has the same type as the typeof annotation
CClassType TYPE = (CClassType) ReflectionUtils.get(clazz.loadClass(), "TYPE");
if (TYPE == null) {
errors.add("TYPE is null? " + clazz.getClassName());
continue;
}
if (!TYPE.val().equals(clazz.getAnnotation(typeof.class).getValue("value"))) {
errors.add(clazz.getClassName() + "'s TYPE value is different than the typeof annotation on it");
}
} catch (ReflectionUtils.ReflectionException ex) {
errors.add(clazz.getClassName() + " needs to add the following:\n\t@SuppressWarnings(\"FieldNameHidesFieldInSuperclass\")\n"
+ "\tpublic static final CClassType TYPE = CClassType.get(\"" + clazz.getAnnotation(typeof.class).getValue("value") + "\");");
}
}
if (!errors.isEmpty()) {
throw new Exception("\n" + StringUtils.Join(errors, "\n"));
}
}
Set<Method> set2 = ClassDiscovery.getDefaultInstance().loadMethodsWithAnnotation(ForceImplementation.class);
for(Method cons : set2){
Class superClass = cons.getDeclaringClass();
@SuppressWarnings("unchecked")
Set<Class<?>> s = ClassDiscovery.getDefaultInstance().loadClassesThatExtend(superClass);
checkImplements: for(Class<?> c : s){
// First, check if maybe it has a InterfaceRunner for it
findRunner: for(Class<?> ir : ClassDiscovery.getDefaultInstance().loadClassesWithAnnotation(InterfaceRunnerFor.class)) {
InterfaceRunnerFor ira = ir.getAnnotation(InterfaceRunnerFor.class);
if(ira.value() == c) {
// Aha! It does. Set c to ir, then break this for loop.
// The runner for this class will act in the stead of this
// class.
c = ir;
break findRunner;
}
}
// c is the class we want to check to make sure it implements cons
for(Method cCons : c.getDeclaredMethods()){
if(cCons.getName().equals(cons.getName()) && Arrays.equals(cons.getParameterTypes(), cCons.getParameterTypes())){
continue checkImplements;
}
}
uhohs.add(c.getName() + " must implement the method with signature " + cons.getName() + "(" + getSignature(cons) + "), but doesn't.");
}
@SuppressWarnings("UnnecessaryLabelOnBreakStatement")
public static void checkForceImplementation() throws Exception {
Set<String> uhohs = new HashSet<>();
Set<Constructor<?>> set = ClassDiscovery.getDefaultInstance().loadConstructorsWithAnnotation(ForceImplementation.class);
for (Constructor<?> cons : set) {
Class superClass = cons.getDeclaringClass();
Set<Class> s = ClassDiscovery.getDefaultInstance().loadClassesThatExtend(superClass);
checkImplements:
for (Class c : s) {
// c is the class we want to check to make sure it implements cons
for (Constructor cCons : c.getDeclaredConstructors()) {
if (Arrays.equals(cons.getParameterTypes(), cCons.getParameterTypes())) {
continue checkImplements;
}
}
if (c.isMemberClass() && (c.getModifiers() & Modifier.STATIC) == 0) {
// Ok, so, an inner, non static class actually passes the super class's reference to the constructor as
// the first parameter, at a byte code level. So this is a different type of error, or at least, a different
// error message will be helpful.
uhohs.add(c.getName() + " must be static.");
} else {
uhohs.add(c.getName() + " must implement the constructor with signature (" + getSignature(cons) + "), but doesn't.");
}
}
}
if(!uhohs.isEmpty()){
List<String> uhohsList = new ArrayList<>(uhohs);
Collections.sort(uhohsList);
throw new Exception("There " + StringUtils.PluralHelper(uhohs.size(), "error") + ". The following classes need to implement various methods:\n" + StringUtils.Join(uhohs, "\n"));
Set<Method> set2 = ClassDiscovery.getDefaultInstance().loadMethodsWithAnnotation(ForceImplementation.class);
for (Method cons : set2) {
Class superClass = cons.getDeclaringClass();
@SuppressWarnings("unchecked")
Set<Class<?>> s = ClassDiscovery.getDefaultInstance().loadClassesThatExtend(superClass);
checkImplements:
for (Class<?> c : s) {
// First, check if maybe it has a InterfaceRunner for it
findRunner:
for (Class<?> ir : ClassDiscovery.getDefaultInstance().loadClassesWithAnnotation(InterfaceRunnerFor.class)) {
InterfaceRunnerFor ira = ir.getAnnotation(InterfaceRunnerFor.class);
if (ira.value() == c) {
// Aha! It does. Set c to ir, then break this for loop.
// The runner for this class will act in the stead of this
// class.
c = ir;
break findRunner;
}
}
// c is the class we want to check to make sure it implements cons
for (Method cCons : c.getDeclaredMethods()) {
if (cCons.getName().equals(cons.getName()) && Arrays.equals(cons.getParameterTypes(), cCons.getParameterTypes())) {
continue checkImplements;
}
}
uhohs.add(c.getName() + " must implement the method with signature " + cons.getName() + "(" + getSignature(cons) + "), but doesn't.");
}
}
if (!uhohs.isEmpty()) {
List<String> uhohsList = new ArrayList<>(uhohs);
Collections.sort(uhohsList);
throw new Exception("There " + StringUtils.PluralHelper(uhohs.size(), "error") + ". The following classes need to implement various methods:\n" + StringUtils.Join(uhohs, "\n"));
}
}
private static String getSignature(Member executable){
List<String> l = new ArrayList<>();
private static String getSignature(Member executable) {
List<String> l = new ArrayList<>();
// for(Class cc : executable.getParameterTypes()){
// l.add(cc.getName());
// }
if(executable instanceof Method){
for(Class cc : ((Method)executable).getParameterTypes()){
l.add(cc.getName());
}
} else if(executable instanceof Constructor){
for(Class cc : ((Constructor)executable).getParameterTypes()){
l.add(cc.getName());
}
} else {
throw new Error("Unexpected executable type");
}
return StringUtils.Join(l, ", ");
if (executable instanceof Method) {
for (Class cc : ((Method) executable).getParameterTypes()) {
l.add(cc.getName());
}
} else if (executable instanceof Constructor) {
for (Class cc : ((Constructor) executable).getParameterTypes()) {
l.add(cc.getName());
}
} else {
throw new Error("Unexpected executable type");
}
return StringUtils.Join(l, ", ");
}
}
@@ -80,6 +80,8 @@
public void sendResourcePack(String url);
public void sendTitle(String title, String subtitle, int fadein, int stay, int fadeout);
public void setAllowFlight(boolean flight);
public void setCompassTarget(MCLocation l);
@@ -1,11 +1,12 @@
package com.laytonsmith.abstraction.bukkit.entities;
import com.laytonsmith.abstraction.entities.MCCommandMinecart;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Entity;
import org.bukkit.entity.minecart.CommandMinecart;
public class BukkitMCCommandMinecart extends BukkitMCMinecart
implements MCCommandMinecart {
public class BukkitMCCommandMinecart extends BukkitMCMinecart implements MCCommandMinecart {
CommandMinecart cm;
@@ -33,4 +34,36 @@ public void setName(String name) {
public void setCommand(String cmd) {
cm.setCommand(cmd);
}
@Override
public void sendMessage(String string) {
cm.sendMessage(string);
}
@Override
public boolean isOp() {
return cm.isOp();
}
@Override
public boolean hasPermission(String perm) {
return cm.hasPermission(perm);
}
@Override
public boolean isPermissionSet(String perm) {
return cm.isPermissionSet(perm);
}
@Override
public List<String> getGroups() {
// CommandMinecarts cannot be in a group.
return new ArrayList<String>();
}
@Override
public boolean inGroup(String groupName) {
// CommandMinecarts cannot be in a group.
return false;
}
}
@@ -340,6 +340,20 @@ public void sendResourcePack(String url) {
p.setResourcePack(url);
}
@Override
public void sendTitle(String title, String subtitle, int fadein, int stay, int fadeout) {
try {
p.sendTitle(title, subtitle, fadein, stay, fadeout);
} catch(NoSuchMethodError ex1){
// Probably prior to 1.11, try the deprecated method
try {
p.sendTitle(title, subtitle);
} catch(NoSuchMethodError ex2){
// Probably prior to 1.8.7, no title API
}
}
}
@Override
public void setAllowFlight(boolean flight) {
p.setAllowFlight(flight);
@@ -1,6 +1,8 @@
package com.laytonsmith.abstraction.entities;
public interface MCCommandMinecart extends MCMinecart {
import com.laytonsmith.abstraction.MCCommandSender;
public interface MCCommandMinecart extends MCMinecart, MCCommandSender {
public String getName();
public void setName(String cmd);
public String getCommand();
@@ -37,6 +37,7 @@
import com.laytonsmith.abstraction.bukkit.BukkitConvertor;
import com.laytonsmith.abstraction.bukkit.BukkitMCBlockCommandSender;
import com.laytonsmith.abstraction.bukkit.BukkitMCCommand;
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCCommandMinecart;
import com.laytonsmith.abstraction.bukkit.entities.BukkitMCPlayer;
import com.laytonsmith.abstraction.enums.MCChatColor;
import com.laytonsmith.abstraction.enums.bukkit.BukkitMCBiomeType;
@@ -87,6 +88,7 @@
import java.util.concurrent.ThreadFactory;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.entity.minecart.CommandMinecart;
/**
* Entry point for the plugin.
@@ -560,23 +562,23 @@ public boolean onCommand(CommandSender sender, Command cmd, String commandLabel,
if (sender instanceof Player) {
PlayerCommandPreprocessEvent pcpe = new PlayerCommandPreprocessEvent((Player) sender, command);
playerListener.onPlayerCommandPreprocess(pcpe);
} else if (sender instanceof ConsoleCommandSender) {
} else if (sender instanceof ConsoleCommandSender
|| sender instanceof BlockCommandSender || sender instanceof CommandMinecart) {
// Console commands and command blocks/minecarts all fire the same event, so pass them to the
// event handler that would get them if they would not have started with "/runalias".
if (command.startsWith("/")) {
command = command.substring(1);
}
ServerCommandEvent sce = new ServerCommandEvent((ConsoleCommandSender) sender, command);
ServerCommandEvent sce = new ServerCommandEvent(sender, command);
serverListener.onServerCommand(sce);
} else if(sender instanceof BlockCommandSender){
MCCommandSender s = new BukkitMCBlockCommandSender((BlockCommandSender)sender);
Static.getAliasCore().alias(command, s);
}
return true;
} else if(cmdName.equalsIgnoreCase("interpreter-on")){
if(sender instanceof ConsoleCommandSender){
int interpreterTimeout = Prefs.InterpreterTimeout();
if(interpreterTimeout != 0){
interpreterUnlockedUntil = (interpreterTimeout * 60 * 1000) + System.currentTimeMillis();
sender.sendMessage("Inpterpreter mode unlocked for " + interpreterTimeout + " minute"
sender.sendMessage("Interpreter mode unlocked for " + interpreterTimeout + " minute"
+ (interpreterTimeout==1?"":"s"));
}
} else {
Oops, something went wrong.

0 comments on commit e0c028c

Please sign in to comment.