mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-25 16:51:54 +01:00
Abort update text
This commit is contained in:
parent
76f8cb96ca
commit
7622c5c510
@ -8,12 +8,12 @@ public abstract class AbstractState
|
||||
{
|
||||
private transient boolean abortion = false;
|
||||
private final transient StateMap stateMap;
|
||||
|
||||
|
||||
public AbstractState(final StateMap stateMap)
|
||||
{
|
||||
this.stateMap = stateMap;
|
||||
}
|
||||
|
||||
|
||||
public <T extends AbstractState> T getState(final Class<? extends T> stateClass)
|
||||
{
|
||||
if (!stateMap.containsKey(stateClass))
|
||||
@ -35,7 +35,7 @@ public abstract class AbstractState
|
||||
}
|
||||
return (T)stateMap.get(stateClass);
|
||||
}
|
||||
|
||||
|
||||
public abstract AbstractState getNextState();
|
||||
|
||||
/**
|
||||
@ -60,13 +60,15 @@ public abstract class AbstractState
|
||||
* @return true, if the answer could be recognized as a valid answer
|
||||
*/
|
||||
public abstract boolean reactOnAnswer(String answer);
|
||||
|
||||
|
||||
public final AbstractState reactOnAnswer(final Player sender, final String answer)
|
||||
{
|
||||
final String trimmedAnswer = answer.trim();
|
||||
if (trimmedAnswer.equalsIgnoreCase("quit")
|
||||
|| trimmedAnswer.equalsIgnoreCase("bye")
|
||||
|| trimmedAnswer.equalsIgnoreCase("abort"))
|
||||
|| trimmedAnswer.equalsIgnoreCase("abort")
|
||||
|| trimmedAnswer.equalsIgnoreCase("cancel")
|
||||
|| trimmedAnswer.equalsIgnoreCase("exit"))
|
||||
{
|
||||
abort();
|
||||
return null;
|
||||
@ -88,7 +90,7 @@ public abstract class AbstractState
|
||||
{
|
||||
sender.sendMessage(ex.toString());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,12 +100,12 @@ public abstract class AbstractState
|
||||
{
|
||||
listener.onWorkDone();
|
||||
}
|
||||
|
||||
|
||||
public boolean isAbortion()
|
||||
{
|
||||
return abortion;
|
||||
}
|
||||
|
||||
|
||||
protected void abort()
|
||||
{
|
||||
abortion = true;
|
||||
|
@ -61,11 +61,11 @@ public class Changelog extends AbstractState
|
||||
}
|
||||
if (pages > 1)
|
||||
{
|
||||
sender.sendMessage("Select a page by typing the numbers 1 to " + pages + " to view all changes and then type confirm to update Essentials.");
|
||||
sender.sendMessage("Select a page by typing the numbers 1 to " + pages + " to view all changes and then type confirm or abort.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Type confirm to update Essentials.");
|
||||
sender.sendMessage("Type confirm to update Essentials or abort to cancel the update.");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user