SPIGOT-2540: Add nullability annotations to entire Bukkit API
By: Darkyenus <darkyenus@gmail.com>
This commit is contained in:
@@ -2,6 +2,8 @@ package org.bukkit.conversations;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* PlayerNamePrompt is the base class for any prompt that requires the player
|
||||
@@ -10,18 +12,19 @@ import org.bukkit.plugin.Plugin;
|
||||
public abstract class PlayerNamePrompt extends ValidatingPrompt {
|
||||
private Plugin plugin;
|
||||
|
||||
public PlayerNamePrompt(Plugin plugin) {
|
||||
public PlayerNamePrompt(@NotNull Plugin plugin) {
|
||||
super();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInputValid(ConversationContext context, String input) {
|
||||
protected boolean isInputValid(@NotNull ConversationContext context, @NotNull String input) {
|
||||
return plugin.getServer().getPlayer(input) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
protected Prompt acceptValidatedInput(@NotNull ConversationContext context, @NotNull String input) {
|
||||
return acceptValidatedInput(context, plugin.getServer().getPlayer(input));
|
||||
}
|
||||
|
||||
@@ -33,5 +36,6 @@ public abstract class PlayerNamePrompt extends ValidatingPrompt {
|
||||
* @param input The user's player name response.
|
||||
* @return The next {@link Prompt} in the prompt graph.
|
||||
*/
|
||||
protected abstract Prompt acceptValidatedInput(ConversationContext context, Player input);
|
||||
@Nullable
|
||||
protected abstract Prompt acceptValidatedInput(@NotNull ConversationContext context, @NotNull Player input);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user