mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-14 11:46:06 +00:00
implement block & check functions
This commit is contained in:
@@ -4,6 +4,8 @@ import com.dfsek.terra.api.math.vector.Location;
|
||||
import com.dfsek.terra.api.structures.parser.Parser;
|
||||
import com.dfsek.terra.api.structures.parser.exceptions.ParseException;
|
||||
import com.dfsek.terra.api.structures.parser.lang.Block;
|
||||
import com.dfsek.terra.api.structures.script.builders.BlockFunctionBuilder;
|
||||
import com.dfsek.terra.api.structures.script.builders.CheckFunctionBuilder;
|
||||
import com.dfsek.terra.bukkit.BukkitWorld;
|
||||
import com.dfsek.terra.bukkit.command.DebugCommand;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@@ -37,7 +39,15 @@ public class LoadRawCommand extends LoadCommand implements DebugCommand {
|
||||
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
|
||||
try {
|
||||
Parser parser = new Parser(IOUtils.toString(new FileInputStream(new File(getMain().getDataFolder(), "test.tesf"))));
|
||||
parser.addFunction("block", new BlockFunctionBuilder(getMain()))
|
||||
.addFunction("check", new CheckFunctionBuilder(getMain()));
|
||||
|
||||
System.out.println("Parsing...");
|
||||
|
||||
Block main = parser.parse();
|
||||
|
||||
System.out.println("Done parsing");
|
||||
|
||||
main.apply(new Location(new BukkitWorld(sender.getWorld()), sender.getLocation().getX(), sender.getLocation().getY(), sender.getLocation().getZ()));
|
||||
|
||||
} catch(IOException | ParseException e) {
|
||||
|
||||
Reference in New Issue
Block a user