tr7zw / Item-NBT-API

Add custom NBT tags to Items/Tiles/Entities without NMS!
https://www.spigotmc.org/resources/item-entity-tile-nbt-api.7939/
MIT License
559 stars 76 forks source link

It shows that the NBTAPI package has not been moved although from what I see I DID move it according to what the guide said... (Shading The Plugin Problem) #296

Closed MSitiSoftware closed 3 weeks ago

MSitiSoftware commented 3 weeks ago

Here's what I added and what is currently written in my pom.xml file that I guess is supposedly related to the NBTAPI shading: This in :

<plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-shade-plugin</artifactId>
       <version>3.6.0</version>
       <executions>
         <execution>
           <id>shade</id>
           <phase>package</phase>
           <goals>
             <goal>shade</goal>
           </goals>
         </execution>
       </executions>
       <configuration>
         <relocations>
           <relocation>
             <pattern>de.tr7zw.changeme.nbtapi</pattern>
             <shadedPattern>me.negai.wanddesigner.nbtapi</shadedPattern>
           </relocation>
         </relocations>
       </configuration>
  </plugin>

And this in dependencies:

<dependency>
      <groupId>de.tr7zw</groupId>
      <artifactId>item-nbt-api</artifactId>
      <version>2.13.1</version>
    </dependency>

And this on onEnable method in the plugin's main class:

        @Override
    public void onEnable() {
        if (!NBT.preloadApi()) {
                getLogger().warning("NBT-API wasn't initialized properly, disabling the plugin");
                getPluginLoader().disablePlugin(this);
                return;
            }
         }

Here is what it showed in the logs image

tr7zw commented 3 weeks ago

Look inside the jar, also do you actually build with maven and not the ide?

MSitiSoftware commented 3 weeks ago

Look inside the jar, also do you actually build with maven and not the ide?

What do you mean by looking inside the jar? And no I don't build with the IDE I build it with maven can it be the problem that causes this?

tr7zw commented 3 weeks ago

Look inside the jar if it is actually relocated or not. Like the actual file paths.

MSitiSoftware commented 3 weeks ago

Look inside the jar if it is actually relocated or not. Like the actual file paths.

image Oh I think now I see, there are 2 packages here, me.negai.wanddesigner (my package) and de.tr7zw.changeme.nbtapi... I guess it means it wasn't relocated right?

tr7zw commented 3 weeks ago

Correct. That means it didn't work/run. Check the output when running the mvn clean install command.

MSitiSoftware commented 3 weeks ago

Correct. That means it didn't work/run. Check the output when running the mvn clean install command.

I succeeded in fixing this, thank you so much for helping!