Solved Vault NPE

Discussion in 'Spigot Plugin Development' started by CrafterChris, May 24, 2019.

  1. I feel really silly asking about this but I couldn't find a fix.
    I'm trying to use Vault's chat prefix and suffix stuff, so I hooked into it.
    Code (Text):

    private Chat chat;

    private boolean setupChat() {
       RegisteredServiceProvider<Chat> rsp = getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class);
       chat = rsp.getProvider();
       return chat != null;
    }

    public Chat getChat() {
       return chat;
    }
     
    This is my onEnable.
    Code (Text):

    @Override
    public void onEnable() {
     
       so("&cCORE&7: &fCore Plugin Version &c" + version + " &fEnabling!");

       this.setupChat();
       so("&cCORE&7: &fVault hooked!");
    }
     
    It NPE's on rsp.getProvider
    Code (Text):

    24.05 00:28:27 [Server] ERROR Error occurred while enabling Core v0.0.1 (Is it up to date?) 24.05 00:28:27
    [Server] INFO java.lang.NullPointerException: null 24.05 00:28:27
    [Server] INFO at com.core.java.essentials.Main.setupChat(Main.java:388) ~[?:?] 24.05 00:28:27
    [Server] INFO at com.core.java.essentials.Main.onEnable(Main.java:297) ~[?:?] 24.05 00:28:27
    [Server] INFO at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.14.1.jar:git-Paper-23] 24.05 00:28:27
    [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:338) ~[patched_1.14.1.jar:git-Paper-23] 24.05 00:28:27
    [Server] INFO at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:419) ~[patched_1.14.1.jar:git-Paper-23] 24.05 00:28:27
    [Server] INFO at org.bukkit.craftbukkit.v1_14_R1.CraftServer.enablePlugin(CraftServer.java:464) ~[patched_1.14.1.jar:git-Paper-23] 24.05 00:28:27
    [Server] INFO at org.bukkit.craftbukkit.v1_14_R1.CraftServer.enablePlugins(CraftServer.java:378) ~[patched_1.14.1.jar:git-Paper-23] 24.05 00:28:27
    [Server] INFO at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:464) ~[patched_1.14.1.jar:git-Paper-23] 24.05 00:28:27
    [Server] INFO at net.minecraft.server.v1_14_R1.DedicatedServer.init(DedicatedServer.java:280) ~[patched_1.14.1.jar:git-Paper-23] 24.05 00:28:27
    [Server] INFO at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:843) ~[patched_1.14.1.jar:git-Paper-23] 24.05 00:28:27
    [Server] INFO at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]
     
    Here's the plugin yml
    Code (Text):

    depend: [WorldEdit, ViaVersion, Vault]
     
    Vault is confirmed to load before it. So, no idea what's wrong...
     
  2. You need a chat plugin on your server
     
  3. Is there a tutorial for creating a chat plugin through Vault, I'm not finding one.
     
  4. Um no? You literally need to download a chat plugin for Vault to hook into. Get EssentialsXChat or something
     
  5. So there's no resources whatsoever on creating my own EssentialsXChat?
     
  6. ..... You need a chat plugin which Vault supports. @xTrollxDudex gave you a suggestion. Are you ..................
     
  7. I'm just wondering at this point if there's any resources available to guide the development of my own chat plugin? Rather than installing a pre-existing one, I'd like to implement one on my own for the learning experience. From what I've gathered it isn't something you can just go about doing, so in the worst case, sure I'll install a chat formatter.
     
  8. Apologies, your intentions weren't clear from the outset. Are you trying to create a chat plugin? You're the one implementing the Chat instance then. See https://bukkit.org/threads/services-api-intro.26998/. Getting a registered Chat provider is for plugins that want to hook into it.
     
    • Agree Agree x 1
  9. Sorry for being unclear, thanks for the tip, marking as solved.
     

Share This Page