Solved Updating a Plugin || Can't resolve method

Discussion in 'Plugin Development' started by iChameleon, May 12, 2019.

Thread Status:
Not open for further replies.
  1. Offline

    iChameleon

    I recently updated a plugin from 1.13.2 to 1.14 by changing the Spigot version in the pom.xml and updating the CraftBukkit library. For some reason, this method that used to work:
    Code:
    player.Spigot().sendMessage(msg);
    Simply doesn't anymore. IntelliJ says it cant resolve the method "Spigot." I need to send the message to the player this way since it is a BaseComponent. I've tried adding Spigot v1.14 to my libraries, but that didn't work (figured it wouldn't, because the method is from CraftBukkit anyways). I tried importing org.bukkit.entity.Player.Spigot, but it doesn't use the import. I'm on the newest version of IntelliJ and using the MinecraftDev plugin for it. When I try to build the plugin, I get this exact error message:
    Code:
    Error:(239, 19) java: cannot find symbol
      symbol:   method Spigot()
      location: variable online of type org.bukkit.entity.Player
    
    This DESPITE the spigot Java docs saying this is a method: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.Spigot.html

    I'm out of ideas, any help is appreciated. I can also post full code if needed, but I'd rather not because it is pretty messy :p.

    *Note, I'm using the latest version of IntelliJ and MinecraftDev
     
    Last edited: May 12, 2019
  2. Spigot is different to CraftBukkit. Spigot is like CraftBukkit+1, so you need that in your pom.xml to use Spigot methods (org.spigotmc:spigot-api:VERSION I think). Also your server must be running Spigot or you'll get a NoSuchMethodException

    Sent from my SM-G903F using Tapatalk
     
  3. Offline

    iChameleon

    Last edited: May 13, 2019
Thread Status:
Not open for further replies.

Share This Page