Fix Iris entity spawn delegation

This commit is contained in:
Brian Neumann-Fopiano
2026-07-29 18:10:55 -04:00
parent 74741ac83e
commit 7ad4909518
14 changed files with 150 additions and 35 deletions
@@ -971,7 +971,7 @@ public class Iris extends VolmitPlugin implements Listener, ReloadAware {
final Location spawn = w.getSpawnLocation();
for (Player i : getServer().getOnlinePlayers()) {
final Runnable playerTask = () -> {
i.setGameMode(GameMode.SPECTATOR);
i.setGameMode(GameMode.CREATIVE);
BukkitPlatform.teleportAsync(i, spawn);
};
if (!J.runEntity(i, playerTask)) {
@@ -657,7 +657,7 @@ public class CommandStudio implements DirectorExecutor {
.getTarget()
.getWorld();
BukkitPlatform.teleportAsync(player, BukkitWorldBinding.spawnLocation(studioWorld))
.thenRun(() -> player.setGameMode(GameMode.SPECTATOR));
.thenRun(() -> player.setGameMode(GameMode.CREATIVE));
}
@Director(description = "Update your dimension projects VSCode workspace", descriptionKey = "iris.director.commandstudio.director.update_your_dimension_projects_vscode_workspace")
@@ -0,0 +1,24 @@
package art.arcane.iris.core.runtime;
import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class StudioPlayerModeContractTest {
@Test
public void studioEntryKeepsPlayersEligibleForNaturalSpawning() throws IOException {
String plugin = Files.readString(Path.of("src/main/java/art/arcane/iris/Iris.java"));
String commands = Files.readString(Path.of(
"src/main/java/art/arcane/iris/core/commands/CommandStudio.java"));
assertFalse(plugin.contains("GameMode.SPECTATOR"));
assertFalse(commands.contains("GameMode.SPECTATOR"));
assertTrue(plugin.contains("GameMode.CREATIVE"));
assertTrue(commands.contains("GameMode.CREATIVE"));
}
}