mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-16 22:01:07 +00:00
work on fabric commands
This commit is contained in:
@@ -10,5 +10,6 @@ public final class CommandUtil {
|
||||
manager.register("profile", ProfileCommand.class);
|
||||
manager.register("reload", ReloadCommand.class);
|
||||
manager.register("addons", AddonsCommand.class);
|
||||
manager.register("version", VersionCommand.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.dfsek.terra.api.command.CommandTemplate;
|
||||
import com.dfsek.terra.api.command.annotation.Command;
|
||||
import com.dfsek.terra.api.command.annotation.Subcommand;
|
||||
import com.dfsek.terra.api.platform.CommandSender;
|
||||
import com.dfsek.terra.commands.structure.SpawnCommand;
|
||||
import com.dfsek.terra.commands.structure.StructureExportCommand;
|
||||
import com.dfsek.terra.commands.structure.StructureLoadCommand;
|
||||
|
||||
@@ -18,6 +19,11 @@ import com.dfsek.terra.commands.structure.StructureLoadCommand;
|
||||
clazz = StructureLoadCommand.class,
|
||||
value = "load",
|
||||
aliases = "ld"
|
||||
),
|
||||
@Subcommand(
|
||||
clazz = SpawnCommand.class,
|
||||
value = "spawn",
|
||||
aliases = "s"
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.dfsek.terra.commands;
|
||||
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.command.CommandTemplate;
|
||||
import com.dfsek.terra.api.command.annotation.Command;
|
||||
import com.dfsek.terra.api.injection.annotations.Inject;
|
||||
import com.dfsek.terra.api.platform.CommandSender;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
|
||||
@Command
|
||||
public class VersionCommand implements CommandTemplate {
|
||||
@Inject
|
||||
private TerraPlugin main;
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender) {
|
||||
String terraVersion = main.getVersion();
|
||||
LangUtil.send("command.version", sender, terraVersion, main.platformName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.dfsek.terra.commands.structure;
|
||||
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.command.CommandTemplate;
|
||||
import com.dfsek.terra.api.command.annotation.Command;
|
||||
import com.dfsek.terra.api.command.annotation.type.DebugCommand;
|
||||
import com.dfsek.terra.api.command.annotation.type.PlayerCommand;
|
||||
import com.dfsek.terra.api.command.annotation.type.WorldCommand;
|
||||
import com.dfsek.terra.api.injection.annotations.Inject;
|
||||
import com.dfsek.terra.api.math.vector.Location;
|
||||
import com.dfsek.terra.api.platform.CommandSender;
|
||||
import com.dfsek.terra.api.platform.entity.Player;
|
||||
import com.dfsek.terra.api.structures.parser.lang.constants.NumericConstant;
|
||||
import com.dfsek.terra.api.structures.script.TerraImplementationArguments;
|
||||
import com.dfsek.terra.api.structures.script.functions.CheckFunction;
|
||||
import com.dfsek.terra.api.structures.structure.Rotation;
|
||||
import com.dfsek.terra.api.structures.structure.buffer.StructureBuffer;
|
||||
import com.dfsek.terra.api.structures.tokenizer.Position;
|
||||
import com.dfsek.terra.api.util.FastRandom;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@DebugCommand
|
||||
@PlayerCommand
|
||||
@WorldCommand
|
||||
@Command
|
||||
public class SpawnCommand implements CommandTemplate {
|
||||
@Inject
|
||||
private TerraPlugin main;
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender) {
|
||||
Player player = (Player) sender;
|
||||
Location p = player.getLocation();
|
||||
int x = p.getBlockX();
|
||||
int y = p.getBlockY();
|
||||
int z = p.getBlockZ();
|
||||
Position dummy = new Position(0, 0);
|
||||
|
||||
String check = new CheckFunction(main, new NumericConstant(0, dummy), new NumericConstant(0, dummy), new NumericConstant(0, dummy), dummy).apply(new TerraImplementationArguments(new StructureBuffer(
|
||||
new com.dfsek.terra.api.math.vector.Location(player.getWorld(), x, y, z)
|
||||
), Rotation.NONE, new FastRandom(), 0), new HashMap<>());
|
||||
|
||||
sender.sendMessage("Found: " + check);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,9 @@ import com.dfsek.terra.api.platform.entity.Player;
|
||||
import com.dfsek.terra.api.structures.script.StructureScript;
|
||||
import com.dfsek.terra.api.structures.structure.Rotation;
|
||||
import com.dfsek.terra.api.util.FastRandom;
|
||||
import com.dfsek.terra.commands.structure.argument.ScriptArgumentParser;
|
||||
import com.dfsek.terra.commands.structure.completer.RotationCompleter;
|
||||
import com.dfsek.terra.commands.structure.completer.ScriptCompleter;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@@ -34,7 +37,8 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||
value = "rotation",
|
||||
required = false,
|
||||
tabCompleter = RotationCompleter.class,
|
||||
argumentParser = IntegerArgumentParser.class
|
||||
argumentParser = IntegerArgumentParser.class,
|
||||
defaultValue = "0"
|
||||
)
|
||||
},
|
||||
switches = {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.commands.structure;
|
||||
package com.dfsek.terra.commands.structure.argument;
|
||||
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.command.arg.ArgumentParser;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.commands.structure;
|
||||
package com.dfsek.terra.commands.structure.completer;
|
||||
|
||||
import com.dfsek.terra.api.command.tab.TabCompleter;
|
||||
import com.dfsek.terra.api.platform.CommandSender;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.commands.structure;
|
||||
package com.dfsek.terra.commands.structure.completer;
|
||||
|
||||
import com.dfsek.terra.api.TerraPlugin;
|
||||
import com.dfsek.terra.api.command.tab.TabCompleter;
|
||||
Reference in New Issue
Block a user