Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #763

Merged
merged 3 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ Please join [the GeyserMC Discord server](https://discord.gg/geysermc) and visit

## License

MCProtocolLib is licensed under the **[MIT license](http://www.opensource.org/licenses/mit-license.html)**.
MCProtocolLib is licensed under the **[MIT license](https://opensource.org/license/mit/)**.
83 changes: 41 additions & 42 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<name>MCProtocolLib</name>
<description>MCProtocolLib is a simple library for communicating with Minecraft clients and servers.</description>
<url>http://github.com/GeyserMC/MCProtocolLib/</url>
<url>https://github.com/GeyserMC/MCProtocolLib/</url>

<scm>
<connection>scm:git:[email protected]:GeyserMC/MCProtocolLib.git</connection>
Expand All @@ -20,15 +20,15 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version>
<adventure.version>4.9.3</adventure.version>
<argLine></argLine>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<adventure.version>4.14.0</adventure.version>
</properties>

<licenses>
<license>
<name>MIT</name>
<url>http://www.opensource.org/licenses/mit-license.html</url>
<url>https://opensource.org/license/mit/</url>
<distribution>repo</distribution>
</license>
</licenses>
Expand Down Expand Up @@ -81,6 +81,7 @@
</repositories>

<dependencies>
<!-- Minecraft related libraries -->
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>opennbt</artifactId>
Expand All @@ -90,9 +91,10 @@
<dependency>
<groupId>com.github.GeyserMC</groupId>
<artifactId>mcauthlib</artifactId>
<version>6f3d6aada5</version>
<version>6621fd0</version>
<scope>compile</scope>
</dependency>
<!-- Kyori adventure -->
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-serializer-gson</artifactId>
Expand All @@ -105,12 +107,20 @@
<version>${adventure.version}</version>
<scope>compile</scope>
</dependency>
<!-- Lombok and annotations -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.7.3</version>
<scope>provided</scope>
</dependency>
<!-- Math utilities -->
<dependency>
<groupId>org.cloudburstmc.math</groupId>
<artifactId>api</artifactId>
Expand All @@ -123,48 +133,45 @@
<version>2.0</version>
<scope>compile</scope>
</dependency>
<!-- Stripped down fastutil -->
<dependency>
<groupId>com.nukkitx.fastutil</groupId>
<artifactId>fastutil-object-int-maps</artifactId>
<version>8.5.2</version>
<version>8.5.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
<groupId>com.nukkitx.fastutil</groupId>
<artifactId>fastutil-int-object-maps</artifactId>
<version>8.5.3</version>
<scope>compile</scope>
</dependency>
<!-- Netty -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.66.Final</version>
<version>4.1.99.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-haproxy</artifactId>
<version>4.1.66.Final</version>
<version>4.1.99.Final</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty.incubator</groupId>
<artifactId>netty-incubator-transport-native-io_uring</artifactId>
<version>0.0.8.Final</version>
<version>0.0.23.Final</version>
<classifier>linux-x86_64</classifier>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.nukkitx.fastutil</groupId>
<artifactId>fastutil-int-object-maps</artifactId>
<version>8.5.2</version>
<scope>compile</scope>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>

Expand All @@ -174,40 +181,32 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
<version>3.11.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<!-- Force the right file encoding during unit testing -->
<argLine>-Dfile.encoding=${project.build.sourceEncoding} @{argLine}</argLine>
</configuration>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<version>3.6.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -225,7 +224,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -238,12 +237,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<version>3.1.1</version>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.steveice10.mc.protocol.data;

import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.gson.legacyimpl.NBTLegacyHoverEventSerializer;
import net.kyori.adventure.text.serializer.json.legacyimpl.NBTLegacyHoverEventSerializer;

public final class DefaultComponentSerializer {
private static GsonComponentSerializer serializer = GsonComponentSerializer.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
@Data
@AllArgsConstructor
public class BreakBlockEventData implements LevelEventData {
private final @NonNull int blockState;
private final int blockState;
}
5 changes: 4 additions & 1 deletion src/main/java/com/github/steveice10/packetlib/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public interface Server {
* @return Value of the flag.
* @throws IllegalStateException If the flag's value isn't of the required type.
*/
@SuppressWarnings("unchecked")
<T> T getGlobalFlag(String key, T def);

/**
Expand Down Expand Up @@ -116,13 +115,16 @@ public interface Server {

/**
* Binds the listener to its host and port.
*
* @return The server.
*/
AbstractServer bind();

/**
* Binds the listener to its host and port.
*
* @param wait Whether to wait for the listener to finish binding.
* @return The server.
*/
AbstractServer bind(boolean wait);

Expand All @@ -131,6 +133,7 @@ public interface Server {
*
* @param wait Whether to wait for the listener to finish binding.
* @param callback Callback to call when the listener has finished binding.
* @return The server.
*/
AbstractServer bind(boolean wait, Runnable callback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
import com.github.steveice10.packetlib.tcp.TcpClientSession;
import com.github.steveice10.packetlib.tcp.TcpServer;
import net.kyori.adventure.text.Component;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
Expand All @@ -30,9 +31,6 @@
import static com.github.steveice10.mc.protocol.MinecraftConstants.SERVER_LOGIN_HANDLER_KEY;
import static com.github.steveice10.mc.protocol.MinecraftConstants.VERIFY_USERS_KEY;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

public class MinecraftProtocolTest {
private static final String HOST = "localhost";
Expand All @@ -49,7 +47,7 @@ public class MinecraftProtocolTest {

private static Server server;

@BeforeClass
@BeforeAll
public static void setupServer() {
server = new TcpServer(HOST, PORT, MinecraftProtocol::new);
server.setGlobalFlag(VERIFY_USERS_KEY, false);
Expand All @@ -66,10 +64,10 @@ public static void setupServer() {
session.send(JOIN_GAME_PACKET);
});

assertTrue("Could not bind server.", server.bind(true).isListening());
Assertions.assertTrue(server.bind(true).isListening(), "Could not bind server.");
}

@AfterClass
@AfterAll
public static void tearDownServer() {
if (server != null) {
server.close(true);
Expand All @@ -87,8 +85,8 @@ public void testStatus() throws InterruptedException {
session.connect();

handler.status.await(4, SECONDS);
assertNotNull("Failed to get server info.", handler.info);
assertEquals("Received incorrect server info.", SERVER_INFO, handler.info);
Assertions.assertNotNull(handler.info, "Failed to get server info.");
Assertions.assertEquals(SERVER_INFO, handler.info, "Received incorrect server info.");
} finally {
session.disconnect("Status test complete.");
}
Expand All @@ -104,8 +102,8 @@ public void testLogin() throws InterruptedException {
session.connect();

listener.login.await(4, SECONDS);
assertNotNull("Failed to log in.", listener.packet);
assertEquals("Received incorrect join packet.", JOIN_GAME_PACKET, listener.packet);
Assertions.assertNotNull(listener.packet, "Failed to log in.");
Assertions.assertEquals(JOIN_GAME_PACKET, listener.packet, "Received incorrect join packet.");
} finally {
session.disconnect("Login test complete.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -20,7 +20,7 @@
public class ChunkTest {
private final List<ChunkSection> chunkSectionsToTest = new ArrayList<>();

@Before
@BeforeEach
public void setup() {
chunkSectionsToTest.add(new ChunkSection());

Expand Down Expand Up @@ -49,18 +49,19 @@ public void testChunkSectionEncoding() throws IOException {
e.printStackTrace();
throw e;
}
Assert.assertEquals("Decoded packet does not match original: " + section + " vs " + decoded, section, decoded);

Assertions.assertEquals(section, decoded, "Decoded packet does not match original: " + section + " vs " + decoded);
}
}

@Test
public void testDeepCopy() {
for (ChunkSection section : chunkSectionsToTest) {
ChunkSection copy = new ChunkSection(section);
Assert.assertEquals("Deep copy does not match original: " + section + " vs " + copy, section, copy);
Assertions.assertEquals(section, copy, "Deep copy does not match original: " + section + " vs " + copy);

copy.setBlock(1, 1, 1, 10);
Assert.assertNotEquals("Deep copy is not deep: " + section + " vs " + copy, section, copy);
Assertions.assertNotEquals(section, copy, "Deep copy is not deep: " + section + " vs " + copy);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.Collections;

Expand All @@ -22,7 +22,7 @@ public void testEffects() {
ByteBuf buf = Unpooled.buffer();
helper.writeEffect(buf, effect);

Assert.assertEquals(effect, helper.readEffect(buf));
Assertions.assertEquals(effect, helper.readEffect(buf));
}
}
}
Loading