Turtles
-
Turtles wiki
-------------------------------------------------------------------------------------------------------------------------------------------------------
» How to craft a turtle?
» Learn TurtleScript code
TurtleScript is easy to learn. Only need to put at the end of every command a semicolon.
The main plugin comes with 8 commands, you can grow this number with addons.
» Print
- Print a message to the owner of the turtle.
- Usage » print <message>;
- Move the turtle to a direction.
- Usage » move <up/down/north/south/east/west>;
- The turtle dig a block.
- Usage » dig <up/down/north/south/east/west>;
- Select an item from turtle's bag.
- Usage » select <0-8>;
- The turtle place the selected block.
- Usage » place <up/down/north/south/east/west>;
- Require » Selected item.
- The turtle drops the selected item.
- Usage » drop;
- Require » Selected item.
- Pick an item from the ground.
- Usage » suck <up/down/north/south/east/west>;
- Jump to another line from the code.
- Usage » goto <line (0-...)>;
» Placeholders
» Block type
- Get the block type.
- Usage » %block <up/down/north/south/east/west> type%
- Get the name/UUID from the owner.
- Usage » %owner <name/uuid>%
» Extend TurtleScript with custom commands
» Main class
Code (Text):package com.dootie.turtles;
import com.dootie.turtles.executer.CommandResolver;
import org.bukkit.plugin.java.JavaPlugin;
public class HelloTurtle extends JavaPlugin {
@Override
public void onEnable() {
// Register the command
CommandResolver.commands.put("hello", new CommandHello());
}
}
Code (Text):package com.dootie.turtles;
import com.dootie.turtles.executer.Executer;
import com.dootie.turtles.executer.command.Command;
public class CommandHello extends Command {
@Override
public void execute(Executer executer, String[] arguments){
if(arguments.length > 0){
// Send an error
executer.getTurtle().sendError("Too many arguments");
// If it's a big error you can cancel the script execution with
executer.stop();
}else{
// Print hello to the owner
executer.getTurtle().sendMessage(" Hello!");
}
}
}
Code (Text):# Return Hello;
hello;
# Return an error;
hello invalid arguments;
» Main class
Code (Text):package com.dootie.turtles;
import com.dootie.turtles.executer.PlaceholderResolver;
import org.bukkit.plugin.java.JavaPlugin;
public class HelloTurtle extends JavaPlugin {
@Override
public void onEnable() {
// Register the placeholder
PlaceholderResolver.placeholders.put("%hello%", new PlaceHello());
}
}
Code (Text):package com.dootie.turtles;
import com.dootie.turtles.repository.Turtle;
import com.dootie.turtles.executer.placeholders.Placeholder;
public class PlaceHello extends Placeholder {
@Override
public String execute(Turtle turtle){
return "Hello";
}
}
Code (Text):# Return Hello
print %hello%; - Loading...
- Loading...
XenCarta PRO
© Jason Axelrod from 8WAYRUN.COM