SPIGOT-2540: Add nullability annotations to entire Bukkit API
By: Darkyenus <darkyenus@gmail.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.bukkit.conversations;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -51,7 +53,7 @@ public class Conversation {
|
||||
* @param forWhom The entity for whom this conversation is mediating.
|
||||
* @param firstPrompt The first prompt in the conversation graph.
|
||||
*/
|
||||
public Conversation(Plugin plugin, Conversable forWhom, Prompt firstPrompt) {
|
||||
public Conversation(@Nullable Plugin plugin, @NotNull Conversable forWhom, @Nullable Prompt firstPrompt) {
|
||||
this(plugin, forWhom, firstPrompt, new HashMap<Object, Object>());
|
||||
}
|
||||
|
||||
@@ -64,7 +66,7 @@ public class Conversation {
|
||||
* @param initialSessionData Any initial values to put in the conversation
|
||||
* context sessionData map.
|
||||
*/
|
||||
public Conversation(Plugin plugin, Conversable forWhom, Prompt firstPrompt, Map<Object, Object> initialSessionData) {
|
||||
public Conversation(@Nullable Plugin plugin, @NotNull Conversable forWhom, @Nullable Prompt firstPrompt, @NotNull Map<Object, Object> initialSessionData) {
|
||||
this.firstPrompt = firstPrompt;
|
||||
this.context = new ConversationContext(plugin, forWhom, initialSessionData);
|
||||
this.modal = true;
|
||||
@@ -79,6 +81,7 @@ public class Conversation {
|
||||
*
|
||||
* @return The entity.
|
||||
*/
|
||||
@NotNull
|
||||
public Conversable getForWhom() {
|
||||
return context.getForWhom();
|
||||
}
|
||||
@@ -133,6 +136,7 @@ public class Conversation {
|
||||
*
|
||||
* @return The ConversationPrefix in use.
|
||||
*/
|
||||
@NotNull
|
||||
public ConversationPrefix getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
@@ -143,7 +147,7 @@ public class Conversation {
|
||||
*
|
||||
* @param prefix The ConversationPrefix to use.
|
||||
*/
|
||||
void setPrefix(ConversationPrefix prefix) {
|
||||
void setPrefix(@NotNull ConversationPrefix prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
@@ -152,7 +156,7 @@ public class Conversation {
|
||||
*
|
||||
* @param canceller The {@link ConversationCanceller} to add.
|
||||
*/
|
||||
void addConversationCanceller(ConversationCanceller canceller) {
|
||||
void addConversationCanceller(@NotNull ConversationCanceller canceller) {
|
||||
canceller.setConversation(this);
|
||||
this.cancellers.add(canceller);
|
||||
}
|
||||
@@ -162,6 +166,7 @@ public class Conversation {
|
||||
*
|
||||
* @return The list.
|
||||
*/
|
||||
@NotNull
|
||||
public List<ConversationCanceller> getCancellers() {
|
||||
return cancellers;
|
||||
}
|
||||
@@ -171,6 +176,7 @@ public class Conversation {
|
||||
*
|
||||
* @return The ConversationContext.
|
||||
*/
|
||||
@NotNull
|
||||
public ConversationContext getContext() {
|
||||
return context;
|
||||
}
|
||||
@@ -192,6 +198,7 @@ public class Conversation {
|
||||
*
|
||||
* @return The current state of the conversation.
|
||||
*/
|
||||
@NotNull
|
||||
public ConversationState getState() {
|
||||
if (currentPrompt != null) {
|
||||
return ConversationState.STARTED;
|
||||
@@ -208,7 +215,7 @@ public class Conversation {
|
||||
*
|
||||
* @param input The user's chat text.
|
||||
*/
|
||||
public void acceptInput(String input) {
|
||||
public void acceptInput(@NotNull String input) {
|
||||
if (currentPrompt != null) {
|
||||
|
||||
// Echo the user's input
|
||||
@@ -235,7 +242,7 @@ public class Conversation {
|
||||
*
|
||||
* @param listener The listener to add.
|
||||
*/
|
||||
public synchronized void addConversationAbandonedListener(ConversationAbandonedListener listener) {
|
||||
public synchronized void addConversationAbandonedListener(@NotNull ConversationAbandonedListener listener) {
|
||||
abandonedListeners.add(listener);
|
||||
}
|
||||
|
||||
@@ -244,7 +251,7 @@ public class Conversation {
|
||||
*
|
||||
* @param listener The listener to remove.
|
||||
*/
|
||||
public synchronized void removeConversationAbandonedListener(ConversationAbandonedListener listener) {
|
||||
public synchronized void removeConversationAbandonedListener(@NotNull ConversationAbandonedListener listener) {
|
||||
abandonedListeners.remove(listener);
|
||||
}
|
||||
|
||||
@@ -262,7 +269,7 @@ public class Conversation {
|
||||
*
|
||||
* @param details Details about why the conversation was abandoned
|
||||
*/
|
||||
public synchronized void abandon(ConversationAbandonedEvent details) {
|
||||
public synchronized void abandon(@NotNull ConversationAbandonedEvent details) {
|
||||
if (!abandoned) {
|
||||
abandoned = true;
|
||||
currentPrompt = null;
|
||||
|
||||
Reference in New Issue
Block a user