Edit command fixed.

This commit is contained in:
Brianna O'Keefe 2019-03-09 18:08:52 -05:00
parent e02b6bc8cc
commit 8edbdceef9

View File

@ -4,6 +4,7 @@ import com.songoda.ultimatekits.UltimateKits;
import com.songoda.ultimatekits.command.AbstractCommand;
import com.songoda.ultimatekits.gui.GUIBlockEditor;
import com.songoda.ultimatekits.gui.GUIKitEditor;
import com.songoda.ultimatekits.kit.KitBlockData;
import com.songoda.ultimatekits.utils.Methods;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
@ -19,11 +20,11 @@ public class CommandEdit extends AbstractCommand {
protected ReturnType runCommand(UltimateKits instance, CommandSender sender, String... args) {
Player player = (Player) sender;
Block block = player.getTargetBlock(null, 200);
String loc = Methods.serializeLocation(block);
KitBlockData kitBlockData = instance.getKitManager().getKit(block.getLocation());
if (args.length > 2) return ReturnType.SYNTAX_ERROR;
if (args.length == 1) {
if (instance.getConfig().getString("data.block." + loc) == null) {
if (kitBlockData == null) {
player.sendMessage(Methods.formatText(instance.getReferences().getPrefix() + "&8This block does not contain a kit."));
return ReturnType.FAILURE;
}