NametagEdit

721k Downloads

Developer API not working - craftbukkit 1.10

nodingneu opened this issue ยท 8 comments

commented

Simplified, this is my PlayerListener class:

package io.github.theonlygusti.wizardserver;

import com.nametagedit.plugin.NametagEdit;
// ... import all the bukkit things - I've verified that the bukket-side of the code works

public class PlayerListener implements Listener {
  @EventHandler
  public void onPlayerJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    // get (String)rank from a database - I know this works, I use it elsewhere
    NametagEdit.getApi().setPrefix(player, rank);
  }
}

and this is my simplified pom.xml:

<repository>
  <id>upstream</id>
  <url>http://ci.playmc.cc/plugin/repository/everything/</url>
</repository>
<!-- ... -->
<dependency>
  <groupId>com.nametagedit</groupId>
  <artifactId>nametagedit</artifactId>
  <version>4.1.0</version>
</dependency>

Basically, I would like to prepend a player's rank to their names above their heads whenever a player joins. However, it doesn't work, and instead throws an error - maven compiles it perfectly, but my 1.10 craftbukkit server throws an error whenever a player joins.

Here's the error:

Caused by: java.lang.NoClassDefFoundError: com/nametagedit/plugin/NametagEdit
        at io.github.theonlygusti.wizardserver.PlayerListener.onPlayerJoin(PlayerListener.java:80) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_91]
        ... 17 more

I'm hoping I've made an obvious mistake, so that this is quick to fix.

commented

Hmm, is NametagEdit installed on the server? Is your plugin attempting to load the class before NametagEdit is loaded? Try putting

softdepend: [NametagEdit]

in your plugin.yml.

commented

Ok whoops

commented

Turns out I didn't have it installed - I had it as a maven dependency, but maven was depending on the runtime environment to expose my plugin to it, which craftbukkit wasn't doing.

commented

However, NametagEdit is now being imported properly, but NametagEdit.getApi().setPrefix(player, rank); is throwing a NullPointerException.

commented

Please use Jenkins build 35 or above. Download here:
http://ci.playmc.cc/job/NametagEdit/35/

commented

What do I put into my pom.xml?

commented
commented

It has been 5 days without a followup. Please reopen if you need help.