Fixed double client commands

This commit is contained in:
Anuken
2020-01-24 22:48:05 -05:00
parent 1ab81fa4ab
commit 081edde1f2
6 changed files with 62 additions and 42 deletions

View File

@@ -2,8 +2,8 @@ package mindustry.annotations.impl;
import com.sun.source.tree.*; import com.sun.source.tree.*;
import com.sun.source.util.*; import com.sun.source.util.*;
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.code.Scope; import com.sun.tools.javac.code.Scope;
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.tree.*; import com.sun.tools.javac.tree.*;
@@ -33,16 +33,16 @@ public class CallSuperAnnotationProcessor extends AbstractProcessor{
if(e.getAnnotation(OverrideCallSuper.class) != null) return false; if(e.getAnnotation(OverrideCallSuper.class) != null) return false;
CodeAnalyzerTreeScanner codeScanner = new CodeAnalyzerTreeScanner(); CodeAnalyzerTreeScanner codeScanner = new CodeAnalyzerTreeScanner();
codeScanner.setMethodName(e.getSimpleName().toString()); codeScanner.methodName = e.getSimpleName().toString();
TreePath tp = trees.getPath(e.getEnclosingElement()); TreePath tp = trees.getPath(e.getEnclosingElement());
codeScanner.scan(tp, trees); codeScanner.scan(tp, trees);
if(codeScanner.isCallSuperUsed()){ if(codeScanner.callSuperUsed){
List list = codeScanner.getMethod().getBody().getStatements(); List list = codeScanner.method.getBody().getStatements();
if(!doesCallSuper(list, codeScanner.getMethodName())){ if(!doesCallSuper(list, codeScanner.methodName)){
processingEnv.getMessager().printMessage(Kind.ERROR, "Overriding method '" + codeScanner.getMethodName() + "' must explicitly call super method from its parent class.", e); processingEnv.getMessager().printMessage(Kind.ERROR, "Overriding method '" + codeScanner.methodName + "' must explicitly call super method from its parent class.", e);
} }
} }
} }
@@ -146,20 +146,5 @@ public class CallSuperAnnotationProcessor extends AbstractProcessor{
return super.visitMethod(methodTree, trees); return super.visitMethod(methodTree, trees);
} }
public void setMethodName (String methodName) {
this.methodName = methodName;
}
public String getMethodName () {
return methodName;
}
public MethodTree getMethod () {
return method;
}
public boolean isCallSuperUsed () {
return callSuperUsed;
}
} }
} }

View File

@@ -0,0 +1,9 @@
- Added new icons w/ smooth scaling
- Added liquid void (Contributed by @GioIacca9)
- Added bridge opacity slider (Contributed by @Quezler)
- Added "underflow" gate (opposite of overflow gate)
- Added "emojis" for most blocks and items into the font
- Added new tech tree layout w/ better mod support
- Added game log file, stored in data folder
- Added new separator sprite/animation
- Added list of affinity tiles to stats of certain blocks

View File

@@ -0,0 +1,9 @@
- Added new icons w/ smooth scaling
- Added liquid void (Contributed by @GioIacca9)
- Added bridge opacity slider (Contributed by @Quezler)
- Added "underflow" gate (opposite of overflow gate)
- Added "emojis" for most blocks and items into the font
- Added new tech tree layout w/ better mod support
- Added game log file, stored in data folder
- Added new separator sprite/animation
- Added list of affinity tiles to stats of certain blocks

View File

@@ -0,0 +1,9 @@
- Added new icons w/ smooth scaling
- Added liquid void (Contributed by @GioIacca9)
- Added bridge opacity slider (Contributed by @Quezler)
- Added "underflow" gate (opposite of overflow gate)
- Added "emojis" for most blocks and items into the font
- Added new tech tree layout w/ better mod support
- Added game log file, stored in data folder
- Added new separator sprite/animation
- Added list of affinity tiles to stats of certain blocks

View File

@@ -0,0 +1,9 @@
- Added new icons w/ smooth scaling
- Added liquid void (Contributed by @GioIacca9)
- Added bridge opacity slider (Contributed by @Quezler)
- Added "underflow" gate (opposite of overflow gate)
- Added "emojis" for most blocks and items into the font
- Added new tech tree layout w/ better mod support
- Added game log file, stored in data folder
- Added new separator sprite/animation
- Added list of affinity tiles to stats of certain blocks

View File

@@ -829,7 +829,6 @@ public class ServerControl implements ApplicationListener{
}); });
mods.eachClass(p -> p.registerServerCommands(handler)); mods.eachClass(p -> p.registerServerCommands(handler));
mods.eachClass(p -> p.registerClientCommands(netServer.clientCommands));
} }
private void readCommands(){ private void readCommands(){