99import io .papermc .paper .command .brigadier .argument .resolvers .BlockPositionResolver ;
1010import io .papermc .paper .math .BlockPosition ;
1111import net .kyori .adventure .text .Component ;
12+ import net .kyori .adventure .text .format .TextColor ;
13+ import net .kyori .adventure .util .TriState ;
1214import net .minecraft .server .level .ServerLevel ;
1315import net .minecraft .world .level .ChunkPos ;
1416import org .bukkit .Chunk ;
1517import org .bukkit .Location ;
18+ import org .bukkit .Material ;
1619import org .bukkit .block .Block ;
20+ import org .bukkit .block .BlockFace ;
21+ import org .bukkit .block .Sign ;
22+ import org .bukkit .block .data .type .WallSign ;
23+ import org .bukkit .block .sign .Side ;
1724import org .bukkit .craftbukkit .CraftWorld ;
25+ import org .bukkit .entity .EntityType ;
26+ import org .bukkit .entity .Mob ;
27+ import org .bukkit .event .entity .CreatureSpawnEvent ;
28+ import org .bukkit .inventory .ItemType ;
1829import org .slf4j .Logger ;
1930import org .slf4j .LoggerFactory ;
2031import world .kitpvp .testplugin .arena .ArenaResetHandler ;
@@ -31,6 +42,52 @@ public class TestCommand {
3142 public static void register (Commands commands ) {
3243 commands .register (
3344 Commands .literal ("test" )
45+ .then (Commands .literal ("spawn_all_entities" )
46+ .executes ((ctx ) -> {
47+ EntityType [] entityTypes = EntityType .values ();
48+ int index = 0 ;
49+ for (EntityType entityType : entityTypes ) {
50+ if (!entityType .isSpawnable ())
51+ continue ;
52+
53+ Location location = ctx .getSource ().getLocation ().add (2 * index , 0 , 0 );
54+
55+ ctx .getSource ().getLocation ().getWorld ().spawnEntity (location , entityType , CreatureSpawnEvent .SpawnReason .COMMAND , (entity ) -> {
56+ entity .setGravity (false );
57+ entity .setCustomNameVisible (true );
58+ entity .setPersistent (true );
59+ entity .customName (Component .text (entityType .name (), TextColor .color (0xffba00 )));
60+ if (entity instanceof Mob mob ) {
61+ mob .setDespawnInPeacefulOverride (TriState .FALSE );
62+ mob .setAI (false );
63+
64+
65+ mob .getEquipment ().setHelmet (ItemType .CHAINMAIL_HELMET .createItemStack ((meta ) -> {
66+ meta .setUnbreakable (true );
67+ }));
68+ }
69+
70+ });
71+ location .clone ().subtract (0 , 1 , 0 ).getBlock ().setType (Material .STONE );
72+
73+ Block block = location .clone ().subtract (0 , 1 , 1 ).getBlock ();
74+ block .setType (Material .OAK_WALL_SIGN );
75+
76+ if (block .getState () instanceof Sign sign && block .getBlockData () instanceof WallSign wallSign ) {
77+ wallSign .setFacing (BlockFace .SOUTH );
78+ sign .getSide (Side .FRONT ).setGlowingText (true );
79+ sign .getSide (Side .FRONT ).line (0 , Component .text (entityType .name (), TextColor .color (0xffba00 )));
80+
81+ block .setBlockData (wallSign );
82+ sign .update ();
83+ }
84+
85+ index ++;
86+ }
87+
88+
89+ return Command .SINGLE_SUCCESS ;
90+ }))
3491 .then (Commands .literal ("light_level" )
3592 .executes ((context ) -> {
3693 var location = context .getSource ().getLocation ();
0 commit comments