Giter VIP home page Giter VIP logo

Comments (13)

nodingneu avatar nodingneu commented on June 5, 2024

Note: MyPlugin extends org.bukkit.plugin.java.JavaPlugin but does not have its own constructor.

from nicknamer.

nodingneu avatar nodingneu commented on June 5, 2024

It would be most helpful if you could just show me how I am meant to use your plugin's API to set a player's name above their heads.

from nicknamer.

InventivetalentDev avatar InventivetalentDev commented on June 5, 2024

There are examples on how it's intended to use the simple nick API in the plugin's description.
You cannot create new instances of classes extending JavaPlugin, Bukkit does not allow that, that's why you get an exception.
You are also not supposed to create a new instance of the SimpleNickManager. If you want to use it, you can get its instance via NickNamerAPI.getNickManager().

from nicknamer.

nodingneu avatar nodingneu commented on June 5, 2024

OK so I changed the lines

SimpleNickManager nameAboveHead = new SimpleNickManager(new MyPlugin());
nameAboveHead.setNick(uuid, rank + player.getName());

to the line

NickNamerAPI.getNickManager().setNick(uuid, rank + player.getName());

and I imported org.inventivetalent.nicknamer.api.NickNamerAPI

Now craftbukkit throws this error on a player's join event:

Caused by: java.lang.NullPointerException
        at io.github.theonlygusti.wizardserver.PlayerListener.onPlayerJoin(PlayerListener.java:77) ~[?:?]

from nicknamer.

InventivetalentDev avatar InventivetalentDev commented on June 5, 2024

What's on line 77 of your PlayerListener class?

from nicknamer.

nodingneu avatar nodingneu commented on June 5, 2024
NickNamerAPI.getNickManager().setNick(uuid, rank + player.getName());

from nicknamer.

InventivetalentDev avatar InventivetalentDev commented on June 5, 2024

Probably the NickManager or player is null.
Make sure you have the NickNamer plugin installed and declared as a dependency in your plugin.yml.

from nicknamer.

nodingneu avatar nodingneu commented on June 5, 2024

I don't want to have to do that, why isn't referencing the dependency via Maven enough?

from nicknamer.

InventivetalentDev avatar InventivetalentDev commented on June 5, 2024

Because you are using the NickManager.

As I said, an example on how to use just the simple api, without the plugin is in the plugin's description.

from nicknamer.

nodingneu avatar nodingneu commented on June 5, 2024

I'm sorry for being a pain, but I literally have no idea how to use the API. I just added this to my PlayerListener class:

@EventHandler
public void on(NickDisguiseEvent event) {
  event.setNick("inventivetalent");
}

it does nothing, and it is literally all I can see in the example you keep referencing.

from nicknamer.

InventivetalentDev avatar InventivetalentDev commented on June 5, 2024

Did you register your events properly? Does the event get called at all?

If you're still trying to do it without NickNamer installed, I think you need to register it using APIManager. The instructions should be somewhere in the description.

from nicknamer.

nodingneu avatar nodingneu commented on June 5, 2024

There are no instructions, and no I don't think that the method is getting called.

from nicknamer.

InventivetalentDev avatar InventivetalentDev commented on June 5, 2024

Well, I must have removed them at some point. You can take a look at the PacketListenerAPI example, just add the dependencies (plugin.yml, pom.xml) and register NickNamerAPI.class

from nicknamer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.