added more sided dialog, added api and added PlayerHandler
This commit is contained in:
1 parent
9f63680d79
commit
4e6255483b
11 files changed
+635
-3
No files matched your search
@@ -0,0 +1,61 @@
|
||||
package eu.mhsl.craftattack.loginServer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class DialogState {
|
||||
public enum Page { secret, data, consent }
|
||||
|
||||
private final List<Page> pages;
|
||||
private int pageIndex = 0;
|
||||
|
||||
String secret = "";
|
||||
String firstName = "";
|
||||
String secondName = "";
|
||||
String birthday = "";
|
||||
String phoneNumber = "";
|
||||
boolean privacyAccepted = false;
|
||||
boolean logsAccepted = false;
|
||||
boolean rulesAccepted = false;
|
||||
|
||||
private DialogState(List<Page> pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
public static DialogState create() {
|
||||
boolean isAfterStart = Main.globalConfig
|
||||
.node("server", "is-after-start")
|
||||
.getBoolean(false);
|
||||
|
||||
return new DialogState(isAfterStart
|
||||
? List.of(Page.secret, Page.data, Page.consent)
|
||||
: List.of(Page.data, Page.consent));
|
||||
}
|
||||
|
||||
public Page currentPage() {
|
||||
return pages.get(pageIndex);
|
||||
}
|
||||
|
||||
public int pageNumber() {
|
||||
return pageIndex + 1;
|
||||
}
|
||||
|
||||
public int pageCount() {
|
||||
return pages.size();
|
||||
}
|
||||
|
||||
public boolean isFirstPage() {
|
||||
return pageIndex == 0;
|
||||
}
|
||||
|
||||
public boolean isLastPage() {
|
||||
return pageIndex == pages.size() - 1;
|
||||
}
|
||||
|
||||
public void nextPage() {
|
||||
pageIndex = Math.min(pages.size() - 1, pageIndex + 1);
|
||||
}
|
||||
|
||||
public void previousPage() {
|
||||
pageIndex = Math.max(0, pageIndex - 1);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user