diff --git a/bedwars-api/pom.xml b/bedwars-api/pom.xml
index cb361820e..080aff6a1 100644
--- a/bedwars-api/pom.xml
+++ b/bedwars-api/pom.xml
@@ -11,6 +11,12 @@
bedwars-api
${project.parent.version}
+
+
+ prod
+
+
+
spigotmc-repo
diff --git a/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/SetupSessionListeners.java b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/SetupSessionListeners.java
new file mode 100644
index 000000000..fea8e5d88
--- /dev/null
+++ b/bedwars-api/src/main/java/com/andrei1058/bedwars/api/server/SetupSessionListeners.java
@@ -0,0 +1,6 @@
+package com.andrei1058.bedwars.api.server;
+
+public interface SetupSessionListeners {
+
+ void onWorldLoad(String worldName);
+}
diff --git a/bedwars-dev/pom.xml b/bedwars-dev/pom.xml
new file mode 100644
index 000000000..d0f9580ea
--- /dev/null
+++ b/bedwars-dev/pom.xml
@@ -0,0 +1,27 @@
+
+
+ 4.0.0
+
+ com.andrei1058.bedwars
+ BedWars1058
+ 23.12.1-SNAPSHOT
+
+
+ com.andrei1058.bedwars.dev
+ bedwars-dev
+
+
+
+ dev
+
+
+
+
+ 22
+ 22
+ UTF-8
+
+
+
\ No newline at end of file
diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/ArenaManager.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/ArenaManager.java
index 5bcb00c6d..a3a0aa6b1 100644
--- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/ArenaManager.java
+++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/ArenaManager.java
@@ -21,6 +21,7 @@
package com.andrei1058.bedwars.arena;
import com.andrei1058.bedwars.BedWars;
+import com.andrei1058.bedwars.api.arena.IArena;
import com.andrei1058.bedwars.api.arena.IGameService;
import com.andrei1058.bedwars.api.arena.constraints.ArenaConstraintViolation;
import com.andrei1058.bedwars.api.arena.constraints.ConstraintProvider;
@@ -33,6 +34,7 @@
import com.andrei1058.bedwars.configuration.ArenaConfig;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
+import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.ApiStatus;
@@ -57,6 +59,15 @@ public ArenaManager() {
constraintProviders.add(new DefaultConstraintProvider());
}
+ public static void onMapLoad(World world) {
+ for (IArena a : new LinkedList<>(Arena.getEnableQueue())) {
+ if (a.getWorldName().equalsIgnoreCase(world.getName())) {
+ a.init(world);
+ break;
+ }
+ }
+ }
+
public String generateGameID() {
SimpleDateFormat y = new SimpleDateFormat("yy"), m = new SimpleDateFormat("MM"), d = new SimpleDateFormat("dd");
diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/SetupSession.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/SetupSession.java
index afdb8fdef..3cf322c7d 100644
--- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/SetupSession.java
+++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/arena/SetupSession.java
@@ -28,6 +28,7 @@
import com.andrei1058.bedwars.api.region.Cuboid;
import com.andrei1058.bedwars.api.server.ISetupSession;
import com.andrei1058.bedwars.api.server.ServerType;
+import com.andrei1058.bedwars.api.server.SetupSessionListeners;
import com.andrei1058.bedwars.api.server.SetupType;
import com.andrei1058.bedwars.commands.bedwars.MainCommand;
import com.andrei1058.bedwars.configuration.ArenaConfig;
@@ -52,7 +53,7 @@
import static com.andrei1058.bedwars.BedWars.plugin;
import static com.andrei1058.bedwars.commands.Misc.createArmorStand;
-public class SetupSession implements ISetupSession {
+public class SetupSession implements ISetupSession, SetupSessionListeners {
private static List setupSessions = new ArrayList<>();
@@ -76,6 +77,14 @@ public SetupSession(Player player, String worldName) {
openGUI(player);
}
+ public static void onMapLoad(String name) {
+ for (SetupSession setupSession : getSetupSessions()) {
+ if (setupSession instanceof SetupSessionListeners) {
+ ((SetupSessionListeners) setupSession).onWorldLoad(name);
+ }
+ }
+ }
+
public void setSetupType(SetupType setupType) {
this.setupType = setupType;
}
@@ -131,8 +140,8 @@ public boolean isStarted() {
public boolean startSetup() {
getPlayer().sendMessage("§6 ▪ §7Loading " + getWorldName());
cm = new ArenaConfig(BedWars.plugin, getWorldName(), plugin.getDataFolder().getPath() + "/Arenas");
+
BedWars.getAPI().getRestoreAdapter().onSetupSessionStart(this);
- startWaitingLobbyParticleTask();
return true;
}
@@ -419,4 +428,11 @@ private void loadWaitingPositions() {
waitingLobbyCuboid = new Cuboid(pos1, pos2, true);
}
}
+
+ @Override
+ public void onWorldLoad(@NotNull String worldName) {
+ if (worldName.equals(this.getWorldName())) {
+ this.startWaitingLobbyParticleTask();
+ }
+ }
}
diff --git a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/WorldLoadListener.java b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/WorldLoadListener.java
index eede82fb8..eaa8d6916 100644
--- a/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/WorldLoadListener.java
+++ b/bedwars-plugin/src/main/java/com/andrei1058/bedwars/listeners/WorldLoadListener.java
@@ -20,23 +20,18 @@
package com.andrei1058.bedwars.listeners;
-import com.andrei1058.bedwars.api.arena.IArena;
-import com.andrei1058.bedwars.arena.Arena;
+import com.andrei1058.bedwars.arena.ArenaManager;
+import com.andrei1058.bedwars.arena.SetupSession;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldLoadEvent;
-
-import java.util.LinkedList;
+import org.jetbrains.annotations.NotNull;
public class WorldLoadListener implements Listener {
@EventHandler
- public void onLoad(WorldLoadEvent e) {
- for (IArena a : new LinkedList<>(Arena.getEnableQueue())) {
- if (a.getWorldName().equalsIgnoreCase(e.getWorld().getName())) {
- a.init(e.getWorld());
- return;
- }
- }
+ public void onLoad(@NotNull WorldLoadEvent e) {
+ ArenaManager.onMapLoad(e.getWorld());
+ SetupSession.onMapLoad(e.getWorld().getName());
}
}
diff --git a/pom.xml b/pom.xml
index 005233d2e..d8955d9e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,6 +14,22 @@
UTF-8
+
+
+ prod
+
+
+ dev
+
+ false
+
+ env
+ dev
+
+
+
+
+
@@ -55,6 +71,12 @@
24.0.1
provided
+
+ org.projectlombok
+ lombok
+ 1.18.32
+ provided
+
@@ -66,6 +88,20 @@
+
+ org.apache.maven.plugins
+ maven-help-plugin
+ 3.2.0
+
+
+ show-profiles
+ compile
+
+ active-profiles
+
+
+
+
org.apache.maven.plugins
maven-compiler-plugin
@@ -115,6 +151,7 @@
versionsupport_v1_20_R2
versionsupport_v1_20_R3
versionsupport_v1_20_R4
+ bedwars-dev