Skip to content

Commit cb89c79

Browse files
committed
chore: update dependencies
1 parent 85c3b8c commit cb89c79

File tree

6 files changed

+27
-36
lines changed

6 files changed

+27
-36
lines changed

gradle/libs.versions.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
[versions]
22

33
# plugins
4-
shadow = "9.2.2"
5-
spotless = "8.0.0"
4+
shadow = "9.3.2"
5+
spotless = "8.3.0"
66
nexusPublish = "2.0.0"
7-
checkstyleTools = "12.1.1"
7+
checkstyleTools = "13.3.0"
88

99
# general
1010
gson = "2.13.2"
1111
geantyref = "1.3.16"
12-
annotations = "26.0.2-1"
12+
annotations = "26.1.0"
1313
netty = "4.1.117.Final"
1414

1515
# platform api versions
1616
sponge = "10.0.0"
17-
paper = "1.21.10-R0.1-SNAPSHOT"
18-
minestom = "2025.10.31-1.21.10"
17+
paper = "1.21.11-R0.1-SNAPSHOT"
18+
minestom = "2026.03.03-1.21.11"
1919

2020
# fabric
2121
minecraft = "1.21.11"
22-
fabricLoom = "1.14.5"
23-
fabricLoader = "0.18.2"
24-
fabricApi = "0.139.4+1.21.11"
22+
fabricLoom = "1.15.4"
23+
fabricLoader = "0.18.4"
24+
fabricApi = "0.141.3+1.21.11"
2525

2626
# platform extensions
27-
packetEvents = "2.10.1"
27+
packetEvents = "2.11.2"
2828
protocolLib = "9417eee444"
2929

3030

gradle/wrapper/gradle-wrapper.jar

542 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

minestom/src/main/java/com/github/juliarn/npclib/minestom/MinestomActionController.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@
4444
import net.minestom.server.entity.Player;
4545
import net.minestom.server.event.player.PlayerDisconnectEvent;
4646
import net.minestom.server.event.player.PlayerHandAnimationEvent;
47+
import net.minestom.server.event.player.PlayerInputEvent;
4748
import net.minestom.server.event.player.PlayerMoveEvent;
4849
import net.minestom.server.event.player.PlayerSpawnEvent;
49-
import net.minestom.server.event.player.PlayerStartSneakingEvent;
50-
import net.minestom.server.event.player.PlayerStopSneakingEvent;
5150
import net.minestom.server.instance.Instance;
5251
import net.minestom.server.item.ItemStack;
5352
import org.jetbrains.annotations.NotNull;
@@ -83,7 +82,7 @@ public MinestomActionController(
8382
Instance instance = player.getInstance();
8483

8584
// check if the player is within the imitate distance and spawned into an instance
86-
// in normal cases the instance check should no evaluate to false at this point
85+
// in normal cases the instance check should not evaluate to false at this point
8786
double distance = MinestomUtil.distance(event.npc(), to);
8887
if (instance != null
8988
&& distance <= this.imitateDistance
@@ -109,11 +108,10 @@ public MinestomActionController(
109108

110109
private void registerListeners() {
111110
MinecraftServer.getGlobalEventHandler().addListener(PlayerMoveEvent.class, this::handleMove);
111+
MinecraftServer.getGlobalEventHandler().addListener(PlayerInputEvent.class, this::handlePlayerInput);
112112
MinecraftServer.getGlobalEventHandler().addListener(PlayerSpawnEvent.class, this::handlePlayerInstanceSpawn);
113-
MinecraftServer.getGlobalEventHandler().addListener(PlayerStartSneakingEvent.class, this::handleStartSneak);
114-
MinecraftServer.getGlobalEventHandler().addListener(PlayerStopSneakingEvent.class, this::handleStopSneak);
115-
MinecraftServer.getGlobalEventHandler().addListener(PlayerHandAnimationEvent.class, this::handleHandAnimation);
116113
MinecraftServer.getGlobalEventHandler().addListener(PlayerDisconnectEvent.class, this::handleQuit);
114+
MinecraftServer.getGlobalEventHandler().addListener(PlayerHandAnimationEvent.class, this::handleHandAnimation);
117115
}
118116

119117
private void handleMove(@NotNull PlayerMoveEvent event) {
@@ -175,12 +173,12 @@ private void handlePlayerInstanceSpawn(@NotNull PlayerSpawnEvent event) {
175173
}
176174
}
177175

178-
private void handleStartSneak(@NotNull PlayerStartSneakingEvent event) {
179-
this.handleToggleSneak(event.getPlayer(), true);
180-
}
181-
182-
private void handleStopSneak(@NotNull PlayerStopSneakingEvent event) {
183-
this.handleToggleSneak(event.getPlayer(), false);
176+
private void handlePlayerInput(@NotNull PlayerInputEvent event) {
177+
var startedSneaking = event.hasPressedShiftKey();
178+
var stoppedSneaking = event.hasReleasedShiftKey();
179+
if (startedSneaking || stoppedSneaking) {
180+
this.handleToggleSneak(event.getPlayer(), startedSneaking);
181+
}
184182
}
185183

186184
private void handleToggleSneak(@NotNull Player player, boolean sneakActive) {

minestom/src/main/java/com/github/juliarn/npclib/minestom/protocol/MinestomProtocolAdapter.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private MinestomProtocolAdapter() {
201201
}
202202

203203
private static @NotNull Metadata.Entry<?> createMetadataEntry(@NotNull Type type, @NotNull Object value) {
204-
// check if we need to convert the value before creating the meta object
204+
// check if we need to convert the value before creating the metaobject
205205
Map.Entry<Type, UnaryOperator<Object>> converter = SERIALIZER_CONVERTERS.get(type);
206206
if (converter != null) {
207207
type = converter.getKey();
@@ -255,7 +255,7 @@ private MinestomProtocolAdapter() {
255255
public @NotNull OutboundPacket<Instance, Player, ItemStack, Object> createPlayerInfoAddPacket(
256256
@NotNull Profile.Resolved profile
257257
) {
258-
return (player, npc) -> {
258+
return (player, _) -> {
259259
List<PlayerInfoUpdatePacket.Property> properties = new ArrayList<>();
260260
for (ProfileProperty property : profile.properties()) {
261261
PlayerInfoUpdatePacket.Property prop = new PlayerInfoUpdatePacket.Property(
@@ -327,7 +327,7 @@ private MinestomProtocolAdapter() {
327327
@NotNull String channelId,
328328
byte[] payload
329329
) {
330-
return (player, npc) -> {
330+
return (player, _) -> {
331331
PluginMessagePacket packet = new PluginMessagePacket(channelId, payload);
332332
player.sendPacket(packet);
333333
};
@@ -368,20 +368,14 @@ private MinestomProtocolAdapter() {
368368
@Override
369369
public void initialize(@NotNull Platform<Instance, Player, ItemStack, Object> platform) {
370370
MinecraftServer.getGlobalEventHandler().addListener(PlayerPacketEvent.class, event -> {
371-
// check if the inbound packet is USE_ENTITY, it's the only interesting for us
372371
if (event.getPacket() instanceof ClientInteractEntityPacket packet) {
373-
// get the associated npc from the tracked entities
374372
Npc<Instance, Player, ItemStack, Object> npc = platform.npcTracker().npcById(packet.targetId());
375373
if (npc != null) {
376-
// call the correct event based on the taken action
377374
if (packet.type() instanceof ClientInteractEntityPacket.Attack) {
378375
platform.eventManager().post(DefaultAttackNpcEvent.attackNpc(npc, event.getPlayer()));
379-
} else if (packet.type() instanceof ClientInteractEntityPacket.Interact interact) {
380-
// extract the used hand from the packet
381-
InteractNpcEvent.Hand hand = HAND_CONVERTER.get(interact.hand());
382-
383-
// call the event
384-
platform.eventManager().post(DefaultInteractNpcEvent.interactNpc(npc, event.getPlayer(), hand));
376+
} else if (packet.type() instanceof ClientInteractEntityPacket.Interact(var hand)) {
377+
var convertedHand = HAND_CONVERTER.get(hand);
378+
platform.eventManager().post(DefaultInteractNpcEvent.interactNpc(npc, event.getPlayer(), convertedHand));
385379
}
386380

387381
// don't pass the packet to the server

minestom/src/main/java/com/github/juliarn/npclib/minestom/util/MinestomUtil.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import net.minestom.server.instance.Instance;
3333
import org.jetbrains.annotations.NotNull;
3434

35-
@SuppressWarnings("UnstableApiUsage")
3635
public final class MinestomUtil {
3736

3837
private MinestomUtil() {

0 commit comments

Comments
 (0)