mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-21 20:42:16 +00:00
- Fixed crash when using mt command from server console
- Forum command now leads to the new forums - Checked in some missing files from previous commit
This commit is contained in:
1 parent
1b72abb2b4
commit
e644398505
17 files changed
+923
-9
No files matched your search
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package stanhebben.zenscript.expression;
|
||||
|
||||
import stanhebben.zenscript.compiler.IEnvironmentMethod;
|
||||
import stanhebben.zenscript.type.ZenType;
|
||||
import stanhebben.zenscript.util.ZenPosition;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class ExpressionStringContains extends Expression {
|
||||
private final Expression haystack;
|
||||
private final Expression needle;
|
||||
|
||||
public ExpressionStringContains(ZenPosition position, Expression haystack, Expression needle) {
|
||||
super(position);
|
||||
|
||||
this.haystack = haystack;
|
||||
this.needle = needle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZenType getType() {
|
||||
return ZenType.STRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compile(boolean result, IEnvironmentMethod environment) {
|
||||
haystack.compile(result, environment);
|
||||
needle.compile(result, environment);
|
||||
|
||||
if (result) {
|
||||
environment.getOutput().invokeVirtual(String.class, "contains", CharSequence.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package stanhebben.zenscript.expression;
|
||||
|
||||
import stanhebben.zenscript.compiler.IEnvironmentMethod;
|
||||
import stanhebben.zenscript.type.ZenType;
|
||||
import stanhebben.zenscript.util.ZenPosition;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stan
|
||||
*/
|
||||
public class ExpressionStringIndex extends Expression {
|
||||
private final Expression source;
|
||||
private final Expression index;
|
||||
|
||||
public ExpressionStringIndex(ZenPosition position, Expression source, Expression index) {
|
||||
super(position);
|
||||
|
||||
this.source = source;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZenType getType() {
|
||||
return ZenType.STRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compile(boolean result, IEnvironmentMethod environment) {
|
||||
source.compile(result, environment);
|
||||
index.compile(result, environment);
|
||||
|
||||
if (result) {
|
||||
environment.getOutput().dup();
|
||||
environment.getOutput().iConst1();
|
||||
environment.getOutput().iAdd();
|
||||
environment.getOutput().invokeVirtual(String.class, "substring", String.class, int.class, int.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user