mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2024-12-05 00:43:15 +01: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;
|
||||
}
|
||||
|
||||
if (arguments.length < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DropperArena specifiedArena = Dropper.getInstance().getArenaHandler().getArena(arguments[0]);
|
||||
if (specifiedArena == null) {
|
||||
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.arena.DropperArenaSession;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
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
|
||||
*/
|
||||
public class LeaveArenaCommand implements CommandExecutor {
|
||||
public class LeaveArenaCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||
@ -32,4 +36,11 @@ public class LeaveArenaCommand implements CommandExecutor {
|
||||
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
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||
@NotNull String[] arguments) {
|
||||
// Abort if no name was specified
|
||||
if (arguments.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the specified arena
|
||||
DropperArena targetArena = Dropper.getInstance().getArenaHandler().getArena(arguments[0]);
|
||||
if (targetArena == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user