Skip to content

Commit dbf16cf

Browse files
Update dependency net.minestom:minestom to v2025.10.11-1.21.10 (#48)
* Update dependency net.minestom:minestom to v2025.10.11-1.21.10 * Migrate some code parts --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: theEvilReaper <theEvilReaper@users.noreply.github.com>
1 parent 1941269 commit dbf16cf

3 files changed

Lines changed: 23 additions & 15 deletions

File tree

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencyResolutionManagement {
77

88
versionCatalogs {
99
create("libs") {
10-
version("minestom", "2025.10.05-1.21.8")
10+
version("minestom", "2025.10.11-1.21.10")
1111
version("junit", "6.0.0")
1212
version("junit.platform", "6.0.0")
1313

src/main/java/net/minestom/testing/Env.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
import net.minestom.server.entity.Player;
66
import net.minestom.server.event.Event;
77
import net.minestom.server.event.EventFilter;
8-
import net.minestom.server.instance.IChunkLoader;
8+
import net.minestom.server.instance.ChunkLoader;
99
import net.minestom.server.instance.Instance;
1010
import net.minestom.server.instance.block.Block;
1111
import net.minestom.server.network.player.GameProfile;
1212
import org.jetbrains.annotations.Contract;
13-
import org.jetbrains.annotations.NotNull;
1413
import org.jetbrains.annotations.Nullable;
1514

1615
import java.time.Duration;
@@ -86,7 +85,7 @@ default TestConnection createConnection() {
8685
* @param <H> the handler type
8786
* @return the {@link Collector} instance to use
8887
*/
89-
<E extends Event, H> Collector<E> trackEvent(Class<E> eventType, EventFilter<? super E, H> filter, @NotNull H actor);
88+
<E extends Event, H> Collector<E> trackEvent(Class<E> eventType, EventFilter<? super E, H> filter, H actor);
9089

9190
/**
9291
* Listen for a specific event type in the test environment.
@@ -111,7 +110,7 @@ default void tick() {
111110
* @param timeout the maximum duration to wait for the condition to be met, or null for no timeout
112111
* @return true if the condition was met, false if the timeout was reached
113112
*/
114-
default boolean tickWhile(@NotNull BooleanSupplier condition, @Nullable Duration timeout) {
113+
default boolean tickWhile(BooleanSupplier condition, @Nullable Duration timeout) {
115114
var ticker = process().ticker();
116115
final long start = System.nanoTime();
117116
while (condition.getAsBoolean()) {
@@ -131,7 +130,7 @@ default boolean tickWhile(@NotNull BooleanSupplier condition, @Nullable Duration
131130
* @param pos the position to spawn the player at
132131
* @return the created player
133132
*/
134-
default @NotNull Player createPlayer(@NotNull Instance instance, @NotNull Pos pos) {
133+
default Player createPlayer(Instance instance, Pos pos) {
135134
return createConnection().connect(instance, pos);
136135
}
137136

@@ -141,7 +140,7 @@ default boolean tickWhile(@NotNull BooleanSupplier condition, @Nullable Duration
141140
* @param instance the instance to spawn the player in
142141
* @return the created player
143142
*/
144-
default @NotNull Player createPlayer(@NotNull Instance instance) {
143+
default Player createPlayer(Instance instance) {
145144
return createPlayer(instance, Pos.ZERO);
146145
}
147146

@@ -150,7 +149,7 @@ default boolean tickWhile(@NotNull BooleanSupplier condition, @Nullable Duration
150149
*
151150
* @return the created instance
152151
*/
153-
default @NotNull Instance createFlatInstance() {
152+
default Instance createFlatInstance() {
154153
return createFlatInstance(null);
155154
}
156155

@@ -160,18 +159,27 @@ default boolean tickWhile(@NotNull BooleanSupplier condition, @Nullable Duration
160159
* @param chunkLoader the chunk loader to use for the instance
161160
* @return the created instance
162161
*/
163-
default @NotNull Instance createFlatInstance(@Nullable IChunkLoader chunkLoader) {
162+
default Instance createFlatInstance(@Nullable ChunkLoader chunkLoader) {
164163
var instance = process().instance().createInstanceContainer(chunkLoader);
165164
instance.setGenerator(unit -> unit.modifier().fillHeight(0, 40, Block.STONE));
166165
return instance;
167166
}
168167

168+
/**
169+
* Creates a new {@link Instance} which is empty and can be used in the test environment.
170+
* @param chunkLoader the chunk loader to use for the instance
171+
* @return the created instance
172+
*/
173+
default Instance createEmptyInstance(ChunkLoader chunkLoader) {
174+
return process().instance().createInstanceContainer(chunkLoader);
175+
}
176+
169177
/**
170178
* Creates a new {@link Instance} which is empty and can be used in the test environment.
171179
*
172180
* @return the created instance
173181
*/
174-
default @NotNull Instance createEmptyInstance() {
182+
default Instance createEmptyInstance() {
175183
return process().instance().createInstanceContainer();
176184
}
177185

@@ -181,7 +189,7 @@ default boolean tickWhile(@NotNull BooleanSupplier condition, @Nullable Duration
181189
*
182190
* @param instance the instance to destroy
183191
*/
184-
default void destroyInstance(@NotNull Instance instance) {
192+
default void destroyInstance(Instance instance) {
185193
destroyInstance(instance, false);
186194
}
187195

@@ -191,7 +199,7 @@ default void destroyInstance(@NotNull Instance instance) {
191199
* @param instance the instance to destroy
192200
* @param cleanUpPlayers whether to remove players from the instance
193201
*/
194-
default void destroyInstance(@NotNull Instance instance, boolean cleanUpPlayers) {
202+
default void destroyInstance(Instance instance, boolean cleanUpPlayers) {
195203
if (cleanUpPlayers && !instance.getPlayers().isEmpty()) {
196204
instance.getPlayers().forEach(Player::remove);
197205
}

src/main/java/net/minestom/testing/TestConnectionImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.concurrent.atomic.AtomicBoolean;
2323

2424
final class TestConnectionImpl implements TestConnection {
25-
2625
private final ServerProcess process;
2726
private final GameProfile gameProfile;
2827
private final PlayerConnectionImpl playerConnection = new PlayerConnectionImpl();
@@ -59,7 +58,8 @@ public Player connect(Instance instance, Pos pos) {
5958
future.complete(player);
6059
});
6160
future.join();
62-
playerConnection.setConnectionState(ConnectionState.PLAY);
61+
playerConnection.setClientState(ConnectionState.PLAY);
62+
playerConnection.setServerState(ConnectionState.PLAY);
6363
process.connection().updateWaitingPlayers();
6464
return player;
6565
}
@@ -84,7 +84,7 @@ public void sendPacket(SendablePacket packet) {
8484

8585
private ServerPacket extractPacket(final SendablePacket packet) {
8686
if (!(packet instanceof ServerPacket serverPacket))
87-
return SendablePacket.extractServerPacket(getConnectionState(), packet);
87+
return SendablePacket.extractServerPacket(getServerState(), packet);
8888

8989
final Player player = getPlayer();
9090
if (player == null) return serverPacket;

0 commit comments

Comments
 (0)