playerLoginEvent() help

Discussion in 'Plugin Development' started by Croug, Jan 8, 2013.

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

    Croug

    Every time I run my plugin the bukkit server console says it could not pass over the playerLoginEvent. Please help,

    -Jordan

    Player listener code:
    Code:
    package tk.CalcuProcessing.CrougVousen;
     
    import java.util.logging.Logger;
     
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerLoginEvent;
     
    public class CVPlayerListener implements Listener{
        Logger log;
     
      private Main plugin;
      private CVPermHandler Perms = new CVPermHandler(this.plugin);
     
        @EventHandler
        public void onPlayerLogin(PlayerLoginEvent evt){
            Player player = evt.getPlayer();
     
            Perms.addPerm(player);
        }
     
    }
     
    
    This is the error log:
    Code:
    [SEVERE] Could not pass event PlayerLoginEvent to CrougVousen v1.0.0
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
        at net.minecraft.server.v1_4_6.PlayerList.attemptLogin(PlayerList.java:275)
        at net.minecraft.server.v1_4_6.PendingConnection.d(PendingConnection.java:121)
        at net.minecraft.server.v1_4_6.PendingConnection.c(PendingConnection.java:45)
        at net.minecraft.server.v1_4_6.DedicatedServerConnectionThread.a(DedicatedServerConnectionThread.java:44)
        at net.minecraft.server.v1_4_6.DedicatedServerConnection.b(SourceFile:29)
        at net.minecraft.server.v1_4_6.MinecraftServer.r(MinecraftServer.java:598)
        at net.minecraft.server.v1_4_6.DedicatedServer.r(DedicatedServer.java:224)
        at net.minecraft.server.v1_4_6.MinecraftServer.q(MinecraftServer.java:494)
        at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:427)
        at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:849)
    Caused by: java.lang.NullPointerException
        at tk.CalcuProcessing.CrougVousen.CVPlayerListener.onPlayerLogin(CVPlayerListener.java:19)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
        ... 13 more
     
  2. Offline

    stuntguy3000

    Could you post the whole error (stacktrace)?
     
  3. Offline

    Croug

    I updated the question
     
  4. Offline

    Lau950

    Do you have your Perm declared?
     
  5. Offline

    Croug

    Yes, right above the playerLoginEvent:
    Code:
    private static CVPermHandler Perms;
     
  6. Offline

    gomeow

    stuntguy3000 That is the whole trace.

    Croug

    Add this after private static PermSomething:
    Code:java
    1. public CVPlayerListener(CVPermHandler cvpm) {
    2. Perms = cvpm;
    3. }
     
  7. Offline

    CubixCoders

    Theres a null error at line, 19. Whats on line 19?
    Nvm, i counted down lol.
    Uh your error is WIth the Perms.addPerms(player);
    I think the problem is you arn't added any perms. You're try to add the player as a perm. Im not sure though.
     
  8. Offline

    gomeow

    That is a class (probably his main class) that he never initialized. It may be a bit confusing because having a capital case variable name is unorthodox
     
  9. Offline

    CubixCoders

    Ah i see now.
     
  10. Offline

    Croug

    Thanks for the response but I'm afraid it didn't work, I didn't think it would considering the variable perm is already assigned a value of the class object tk.CalcuProcessing.CrougVousen.CVPermHandler.java

    Two things, first, I don't know why but making my variables capital has always made the code more appealing for me to work with, second, I realize now that I didn't initialize the class, I have fixed that in my code and changed the code in the thread to reflect my current code, however, this did not eliminate any problems I was having, and as a side note, CVPermHandler.java is a sub class I made to handle all permissions events, my main class is Main.java

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 8, 2016
  11. Offline

    libraryaddict

    Try printing out everything on that line.
    System.out.print(Perms)
    Does it say 'null' in console? Perhaps thats your problem.
     
  12. Offline

    Croug

    perms is a variable referring to a class, it would never show up null
     
  13. Offline

    libraryaddict

    Yes. But why not check. Because something is null.
     
  14. Offline

    Croug

    yeah, I did some creative debugging and figured out that the plugin variable is showing up null somehow
     
Thread Status:
Not open for further replies.

Share This Page