mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-03 14:26:27 +00:00
Refactor commands
This commit is contained in:
@@ -5,20 +5,18 @@ import com.dfsek.terra.command.profile.ProfileCommand;
|
||||
import com.dfsek.terra.command.structure.StructureCommand;
|
||||
import com.dfsek.terra.config.genconfig.BiomeConfig;
|
||||
import com.dfsek.terra.config.genconfig.OreConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class TerraCommand implements CommandExecutor, TabExecutor {
|
||||
private final List<com.dfsek.terra.command.Command> commands = Arrays.asList(new ReloadCommand(),
|
||||
private final List<com.dfsek.terra.command.type.Command> commands = Arrays.asList(new ReloadCommand(),
|
||||
new BiomeCommand(),
|
||||
new OreCommand(),
|
||||
new ProfileCommand(),
|
||||
@@ -29,7 +27,7 @@ public class TerraCommand implements CommandExecutor, TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if(args.length > 0) {
|
||||
for(com.dfsek.terra.command.Command c : commands) {
|
||||
for(com.dfsek.terra.command.type.Command c : commands) {
|
||||
if(c.getName().equals(args[0])) return c.execute(sender, command, label, Arrays.stream(args, 1, args.length).toArray(String[]::new));
|
||||
}
|
||||
sender.sendMessage("Invalid command.");
|
||||
|
||||
Reference in New Issue
Block a user