Structure location is fast now

This commit is contained in:
dfsek
2020-10-08 22:44:12 -07:00
parent 6ec7ab9c72
commit 506e1e0e23
6 changed files with 65 additions and 13 deletions

View File

@@ -52,7 +52,7 @@ public class LocateCommand extends WorldCommand {
@Override
public String getName() {
return tp ? "tp" : "locate";
return tp ? "teleport" : "locate";
}
@Override

View File

@@ -0,0 +1,50 @@
package com.dfsek.terra.command.structure;
import com.dfsek.terra.command.type.DebugCommand;
import com.dfsek.terra.command.type.WorldCommand;
import com.dfsek.terra.structure.StructureSpawnRequirement;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
public class SpawnCommand extends WorldCommand implements DebugCommand {
@Override
public boolean execute(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args, World world) {
Location p = sender.getLocation();
int x = p.getBlockX();
int y = p.getBlockY();
int z = p.getBlockZ();
boolean air = StructureSpawnRequirement.AIR.matches(world, x, y, z);
boolean ground = StructureSpawnRequirement.LAND.matches(world, x, y, z);
boolean sea = StructureSpawnRequirement.OCEAN.matches(world, x, y, z);
sender.sendMessage("AIR: " + air + "\nLAND: " + ground + "\nOCEAN: " + sea);
return true;
}
@Override
public String getName() {
return "spawn";
}
@Override
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
return Collections.emptyList();
}
@Override
public int arguments() {
return 0;
}
@Override
public List<String> getTabCompletions(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
return Collections.emptyList();
}
}

View File

@@ -20,7 +20,7 @@ public class StructureCommand extends PlayerCommand {
@Override
public List<com.dfsek.terra.command.type.Command> getSubCommands() {
return Arrays.asList(new ExportCommand(), new LoadCommand(), new LocateCommand(false), new LocateCommand(true));
return Arrays.asList(new ExportCommand(), new LoadCommand(), new LocateCommand(false), new LocateCommand(true), new SpawnCommand());
}
@Override