Solved Event Help

Discussion in 'Spigot Plugin Development' started by YoloSanta, Jun 10, 2017.

  1. Hey guys I need help when I was coding this, I ran into an error I get this error when I put this code into the class
    Code (Text):
    menu.show(e.getPlayer());
    Send some help? Or tell me what to add here to fix it.

    Main
    Listener
     
  2. Can you post the error please?
     
  3. What is your error (Send the whole error)

    EDIT: xD @Jobsms and I send a message at the same time...
     
  4. All it says is "e cannot be resolved"

    Im getting the mc error right now...
     
  5. Oh...

    What Event is it?
     
  6. @YoloSanta I got it!, You are using
    Code (Text):
    e.getPlayer()
    in a Command
    boolean

    Use
    Code (Text):
    menu.show(player);
    You have this:
    Code (Text):
    Player player = (Player) sender;
    That gets the player from sender

    e.getPlayer() is only for events
     
  7. @Steve.Rock @Jobsms Heres the error log
    Code (Text):
    [12:32:59] [Server thread/INFO]: snidfnjsdnf issued server command: /gm
    [12:32:59] [Server thread/ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'gm' in plugin MenuInv v1.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[craftbukkit.jar:git-Bukkit-6e3cec8]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:140) ~[craftbukkit.jar:git-Bukkit-6e3cec8]
        at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:629) ~[craftbukkit.jar:git-Bukkit-6e3cec8]
        at net.minecraft.server.v1_11_R1.PlayerConnection.handleCommand(PlayerConnection.java:1295) [craftbukkit.jar:git-Bukkit-6e3cec8]
        at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1155) [craftbukkit.jar:git-Bukkit-6e3cec8]
        at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(SourceFile:37) [craftbukkit.jar:git-Bukkit-6e3cec8]
        at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(SourceFile:9) [craftbukkit.jar:git-Bukkit-6e3cec8]
        at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13) [craftbukkit.jar:git-Bukkit-6e3cec8]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_121]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_121]
        at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46) [craftbukkit.jar:git-Bukkit-6e3cec8]
        at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:695) [craftbukkit.jar:git-Bukkit-6e3cec8]
        at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:360) [craftbukkit.jar:git-Bukkit-6e3cec8]
        at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:650) [craftbukkit.jar:git-Bukkit-6e3cec8]
        at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:554) [craftbukkit.jar:git-Bukkit-6e3cec8]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
    Caused by: java.lang.Error: Unresolved compilation problem:
        e cannot be resolved

        at me.imanthe.plugins.gamemodegui.MenuInv.onCommand(MenuInv.java:28) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[craftbukkit.jar:git-Bukkit-6e3cec8]
        ... 15 more
    [12:33:03] [Server thread/INFO]: Stopping the server
    [12:33:03] [Server thread/INFO]: Stopping server
    [12:33:03] [Server thread/INFO]: [MenuInv] Disabling MenuInv v1.0
    So how would I be able to fix it?

    Testing your way @Steve.Rock
     
  8. Change
    Code (Text):
    menu.show(e.getplayer);
    To
    Code (Text):
    menu.show(player);
    In The Main Command class
     
  9. Thanks for the help, Here is the fix for people in the future looking for help.
     
    • Agree Agree x 1