summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsUpdate')
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java9
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/AdvancedMode.java20
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java23
3 files changed, 35 insertions, 17 deletions
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
index 5f2ff42ea..3f0c4c233 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java
@@ -14,7 +14,7 @@ public abstract class AbstractState
this.stateMap = stateMap;
}
- public AbstractState getState(final Class<? extends AbstractState> stateClass)
+ public <T extends AbstractState> T getState(final Class<? extends T> stateClass)
{
if (!stateMap.containsKey(stateClass))
{
@@ -33,7 +33,7 @@ public abstract class AbstractState
throw new RuntimeException(ex);
}
}
- return stateMap.get(stateClass);
+ return (T)stateMap.get(stateClass);
}
public abstract AbstractState getNextState();
@@ -86,7 +86,10 @@ public abstract class AbstractState
/**
* Do something based on the answer, that the user gave.
*/
- public abstract void doWork(WorkListener workListener);
+ public void doWork(final WorkListener listener)
+ {
+ listener.onWorkDone();
+ }
public boolean isAbortion()
{
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AdvancedMode.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AdvancedMode.java
new file mode 100644
index 000000000..88d9efc4a
--- /dev/null
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/AdvancedMode.java
@@ -0,0 +1,20 @@
+package com.earth2me.essentials.update.states;
+
+import org.bukkit.entity.Player;
+
+
+public class AdvancedMode extends AbstractYesNoState
+{
+ public AdvancedMode(final StateMap states)
+ {
+ super(states, EssentialsChat.class);
+ }
+
+ @Override
+ public void askQuestion(final Player sender)
+ {
+ sender.sendMessage("This installation mode has a lot of options.");
+ sender.sendMessage("Do you want use the advanced mode to see all questions?");
+ sender.sendMessage("Otherwise the default values will be used.");
+ }
+}
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java
index 1401f7191..6666ff371 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java
@@ -1,10 +1,6 @@
package com.earth2me.essentials.update.states;
-import com.earth2me.essentials.update.WorkListener;
-import com.earth2me.essentials.update.tasks.InstallModule;
-import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
-import org.bukkit.plugin.Plugin;
public class EssentialsChatSettings extends AbstractYesNoState
@@ -15,20 +11,19 @@ public class EssentialsChatSettings extends AbstractYesNoState
}
@Override
- public void askQuestion(final Player sender)
+ public boolean guessAnswer()
{
- sender.sendMessage("Would you like to configure EssentialsChat to prefix ingame messages with their group?");
+ if (getState(AdvancedMode.class).getAnswer())
+ {
+ setAnswer(false);
+ return true;
+ }
+ return false;
}
@Override
- public void doWork(final WorkListener listener)
+ public void askQuestion(final Player sender)
{
- if (getAnswer())
- {
- //TODO: Configure plugin
-
- return;
- }
- listener.onWorkDone();
+ sender.sendMessage("Would you like to configure EssentialsChat to prefix ingame messages with their group?");
}
}