mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2025-04-03 10:16:26 +02:00
Adds some missing command argument checks
This commit is contained in:
parent
0c58860026
commit
49eb0ac82c
@ -21,6 +21,10 @@ public class EditArenaCommand implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arguments.length < 2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
DropperArena specifiedArena = Dropper.getInstance().getArenaHandler().getArena(arguments[0]);
|
DropperArena specifiedArena = Dropper.getInstance().getArenaHandler().getArena(arguments[0]);
|
||||||
if (specifiedArena == null) {
|
if (specifiedArena == null) {
|
||||||
commandSender.sendMessage("Unable to find the specified dropper arena.");
|
commandSender.sendMessage("Unable to find the specified dropper arena.");
|
||||||
|
@ -3,15 +3,19 @@ package net.knarcraft.dropper.command;
|
|||||||
import net.knarcraft.dropper.Dropper;
|
import net.knarcraft.dropper.Dropper;
|
||||||
import net.knarcraft.dropper.arena.DropperArenaSession;
|
import net.knarcraft.dropper.arena.DropperArenaSession;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.TabExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The command used to leave the current dropper arena
|
* The command used to leave the current dropper arena
|
||||||
*/
|
*/
|
||||||
public class LeaveArenaCommand implements CommandExecutor {
|
public class LeaveArenaCommand implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||||
@ -32,4 +36,11 @@ public class LeaveArenaCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||||
|
@NotNull String[] arguments) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,11 @@ public class RemoveArenaCommand implements CommandExecutor {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||||
@NotNull String[] arguments) {
|
@NotNull String[] arguments) {
|
||||||
|
// Abort if no name was specified
|
||||||
|
if (arguments.length < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the specified arena
|
// Get the specified arena
|
||||||
DropperArena targetArena = Dropper.getInstance().getArenaHandler().getArena(arguments[0]);
|
DropperArena targetArena = Dropper.getInstance().getArenaHandler().getArena(arguments[0]);
|
||||||
if (targetArena == null) {
|
if (targetArena == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user