diff --git a/.gitignore b/.gitignore
index b425f09..c09aba6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.asset/
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
diff --git a/api/pom.xml b/api/pom.xml
index 2a4bf18..d248a86 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.4.2
+ 1.4.3
${project.jdk.version}
diff --git a/core/pom.xml b/core/pom.xml
index 28e4010..933f2d7 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.4.2
+ 1.4.3
${project.jdk.version}
diff --git a/game/api/pom.xml b/game/api/pom.xml
index e4bc22f..cfafad1 100644
--- a/game/api/pom.xml
+++ b/game/api/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.4.2
+ 1.4.3
../../pom.xml
diff --git a/game/plugin/pom.xml b/game/plugin/pom.xml
index 987428e..25e6596 100644
--- a/game/plugin/pom.xml
+++ b/game/plugin/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.4.2
+ 1.4.3
../../pom.xml
diff --git a/lobby/api/pom.xml b/lobby/api/pom.xml
index efc6978..9cced70 100644
--- a/lobby/api/pom.xml
+++ b/lobby/api/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.4.2
+ 1.4.3
../../pom.xml
diff --git a/lobby/api/src/main/java/com/artformgames/plugin/votepass/lobby/api/event/RequestCreatedEvent.java b/lobby/api/src/main/java/com/artformgames/plugin/votepass/lobby/api/event/RequestCreatedEvent.java
new file mode 100644
index 0000000..3345933
--- /dev/null
+++ b/lobby/api/src/main/java/com/artformgames/plugin/votepass/lobby/api/event/RequestCreatedEvent.java
@@ -0,0 +1,33 @@
+package com.artformgames.plugin.votepass.lobby.api.event;
+
+import com.artformgames.plugin.votepass.api.data.request.RequestInformation;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+
+public class RequestCreatedEvent extends Event {
+
+ private static final HandlerList handlerList = new HandlerList();
+
+ protected final RequestInformation request;
+
+ public RequestCreatedEvent(RequestInformation request) {
+ super(true);
+ this.request = request;
+ }
+
+ public RequestInformation getRequest() {
+ return request;
+ }
+
+ @Override
+ public @NotNull HandlerList getHandlers() {
+ return handlerList;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlerList;
+ }
+
+
+}
diff --git a/lobby/plugin/pom.xml b/lobby/plugin/pom.xml
index 4f0a2ed..f0f865c 100644
--- a/lobby/plugin/pom.xml
+++ b/lobby/plugin/pom.xml
@@ -6,7 +6,7 @@
com.artformgames
votepass-parent
- 1.4.2
+ 1.4.3
../../pom.xml
diff --git a/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/request/RequestManager.java b/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/request/RequestManager.java
index f7d06dd..479d876 100644
--- a/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/request/RequestManager.java
+++ b/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/request/RequestManager.java
@@ -29,6 +29,7 @@ public class RequestManager implements UserRequestManager {
DataSerializer.serializeAnswers(request.getAnswers()), LocalDateTime.now()
).returnGeneratedKey().execute();
+
return new RequestInformation(
id, request.getSettings().id(), user,
request.getAnswers(), new HashSet<>(),
diff --git a/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/ui/RequestingGUI.java b/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/ui/RequestingGUI.java
index c12abe0..238932d 100644
--- a/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/ui/RequestingGUI.java
+++ b/lobby/plugin/src/main/java/com/artformgames/plugin/votepass/lobby/ui/RequestingGUI.java
@@ -10,10 +10,12 @@
import com.artformgames.plugin.votepass.api.data.request.RequestAnswer;
import com.artformgames.plugin.votepass.api.data.request.RequestInformation;
import com.artformgames.plugin.votepass.core.conf.CommonConfig;
+import com.artformgames.plugin.votepass.lobby.Main;
import com.artformgames.plugin.votepass.lobby.VotePassLobbyAPI;
import com.artformgames.plugin.votepass.lobby.api.data.server.ServerQuestion;
import com.artformgames.plugin.votepass.lobby.api.data.server.ServerSettings;
import com.artformgames.plugin.votepass.lobby.api.data.user.PendingRequest;
+import com.artformgames.plugin.votepass.lobby.api.event.RequestCreatedEvent;
import com.artformgames.plugin.votepass.lobby.api.user.LobbyUserData;
import com.artformgames.plugin.votepass.lobby.conf.PluginConfig;
import com.artformgames.plugin.votepass.lobby.conf.PluginMessages;
@@ -29,6 +31,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
public class RequestingGUI extends AutoPagedGUI {
@@ -37,9 +40,12 @@ public static void open(Player player, LobbyUserData data, PendingRequest reques
questionsGUI.openGUI(player);
}
- @NotNull Player player;
- @NotNull LobbyUserData data;
- @NotNull PendingRequest pendingRequest;
+ @NotNull
+ Player player;
+ @NotNull
+ LobbyUserData data;
+ @NotNull
+ PendingRequest pendingRequest;
public RequestingGUI(@NotNull Player player, @NotNull LobbyUserData data, @NotNull PendingRequest pendingRequest) {
super(
@@ -134,15 +140,16 @@ public void onClick(Player clicker, ClickType type) {
VotePassLobbyAPI.getRequestManager()
.commit(getData().getKey(), getPendingRequest())
- .thenAccept(request -> {
+ .thenCompose(request -> {
if (request == null) {
PluginMessages.ERROR.send(player, getSettings().name());
- return;
+ return CompletableFuture.completedFuture(null);
}
getData().addRequest(request);
getData().removePendingRequest();
PluginMessages.POSTED.send(player, request.getID(), getSettings().name());
+ return Main.getInstance().callAsync(new RequestCreatedEvent(request));
});
}
};
diff --git a/pom.xml b/pom.xml
index 42c5a72..ac9f0c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
com.artformgames
votepass-parent
- 1.4.2
+ 1.4.3
api
lobby/api