mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-03 14:26:27 +00:00
Begin command rework
This commit is contained in:
39
src/main/java/com/dfsek/terra/command/OreCommand.java
Normal file
39
src/main/java/com/dfsek/terra/command/OreCommand.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.dfsek.terra.command;
|
||||
|
||||
import com.dfsek.terra.config.genconfig.OreConfig;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class OreCommand extends PlayerCommand {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull Player sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
Block bl = sender.getTargetBlockExact(25);
|
||||
OreConfig ore = OreConfig.fromID(args[0]);
|
||||
if(ore == null) {
|
||||
sender.sendMessage("Unable to find Ore");
|
||||
return true;
|
||||
}
|
||||
if(bl == null) {
|
||||
sender.sendMessage("Block out of range");
|
||||
return true;
|
||||
}
|
||||
ore.doVein(bl.getLocation(), new Random());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.dfsek.terra.command.Command> getSubCommands() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "ore";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user