Skip to content

Commit 9d71703

Browse files
committed
Fixed not being able to place armor stands in game
1 parent 40864e4 commit 9d71703

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Plugin/src/main/java/dev/lrxh/neptune/game/match/listener/MatchListener.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,19 @@ private Optional<Profile> getProfile(Player player) {
6868
}
6969

7070
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
71-
public void onCrystalSpawn(EntitySpawnEvent event) {
71+
public void onEntitySpawn(EntitySpawnEvent event) {
7272
if (event.getEntity() instanceof EnderCrystal crystal) {
7373
Player player = getNearbyPlayer(crystal.getLocation());
7474
if (player == null)
7575
return;
7676

7777
getMatchForPlayer(player).ifPresent(match -> match.getEntities().add(crystal));
78+
} else if (event.getEntity() instanceof ArmorStand armorStand) {
79+
Player player = getNearbyPlayer(armorStand.getLocation());
80+
if (player == null)
81+
return;
82+
83+
getMatchForPlayer(player).ifPresent(match -> match.getEntities().add(armorStand));
7884
}
7985
}
8086

Plugin/src/main/java/dev/lrxh/neptune/providers/listeners/GlobalListener.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.bukkit.Location;
1616
import org.bukkit.Material;
1717
import org.bukkit.entity.Player;
18+
import org.bukkit.entity.ArmorStand;
1819
import org.bukkit.event.EventHandler;
1920
import org.bukkit.event.EventPriority;
2021
import org.bukkit.event.Listener;
@@ -44,6 +45,9 @@ public void onCreatureSpawnEvent(CreatureSpawnEvent event) {
4445
if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.SPAWNER_EGG) || event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.EGG) || event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.BUCKET)) {
4546
return;
4647
}
48+
if (event.getEntity() instanceof ArmorStand) {
49+
return;
50+
}
4751
event.setCancelled(true);
4852
}
4953

0 commit comments

Comments
 (0)