dmulloy2 / ProtocolLib

Provides read and write access to the Minecraft protocol with Bukkit.
GNU General Public License v2.0
1.04k stars 257 forks source link

ProtocolManager is null #3304

Open XandorSportel opened 1 week ago

XandorSportel commented 1 week ago

Describe the bug ProtocolManager = null

To Reproduce Steps to reproduce the behavior:

  1. Add "depend: [ProtocolLib]" to plugin.yml
  2. Add the ProtocolLib Maven Repository
  3. Load ProtocolManager in onLoad()
    
    private ProtocolManager protocolManager;

@Override public void onLoad() { if (ProtocolLibrary.getProtocolManager() == null) { Bukkit.getLogger().severe("ProtocolLib not found!"); } protocolManager = ProtocolLibrary.getProtocolManager(); }


**Expected behavior**
I can use the protocol manager.

**Screenshots**
![ss1](https://github.com/user-attachments/assets/8cc2a983-6087-41bd-981c-308682e4f054)
![ss2](https://github.com/user-attachments/assets/e7aa452a-c5c8-48cf-b364-92db72be3061)

**Version Info**
[/protocol dump pastebin](https://pastebin.com/DjGuAt3Y)

**Additional context**
```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>net.carbonnetwork</groupId>
    <artifactId>TestPlugin</artifactId>
    <version>0.1.0-dev+b7</version>
    <packaging>jar</packaging>

    <name>TestPlugin</name>

    <properties>
        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <defaultGoal>clean package</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.5.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>papermc-repo</id>
            <url>https://repo.papermc.io/repository/maven-public/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
        <repository>
            <id>dmulloy2-repo</id>
            <url>https://repo.dmulloy2.net/repository/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.20.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.comphenix.protocol</groupId>
            <artifactId>ProtocolLib</artifactId>
            <version>5.3.0</version>
        </dependency>
    </dependencies>
</project>
mdaffa48 commented 1 day ago

You need to add <scope>provided</scope> into the ProtocolLib dependency on your pom.xml