Creating custom yml files for each player

Discussion in 'Plugin Help/Development/Requests' started by Christophernjsp, Jun 27, 2015.

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

    Christophernjsp

    I have started to code the plugin the way that makes sense to me and I get this error and my source is provided below.
    Code:
    [22:09:39 ERROR]: Could not pass event PlayerJoinEvent to PlayerData2 v1.0.0-B1
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PlayerList.onPlayerJoin(PlayerList.java:272) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PlayerList.a(PlayerList.java:156) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.LoginListener.b(LoginListener.java:109) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.LoginListener.c(LoginListener.java:41) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.NetworkManager.a(NetworkManager.java:159) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.ServerConnection.c(ServerConnection.java:82) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:800) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at java.lang.Thread.run(Thread.java:722) [?:1.7.0_07]
    Caused by: java.lang.NullPointerException
            at com.chaka15205.playerdata2.data.Data.<init>(Data.java:23) ~[?:?]
            at com.chaka15205.playerdata2.data.Manager.createPlayerData(Manager.java:19) ~[?:?]
            at com.chaka15205.playerdata2.listener.PlayerListener.onPlayerJoin(PlayerListener.java:22) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_07]
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_07]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_07]
            at java.lang.reflect.Method.invoke(Method.java:601) ~[?:1.7.0_07]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            ... 14 more
    
    The plugins source is here, https://github.com/OmniWorldMC/PlayerData2
     
  2. Offline

    caderape

    Data is a class assigned for each player. You don't have to put static.
    When you call the 'new data()' you call a new instance of this class.
    That mean each player will have his own class. So call it in your onEnable is useless.

    - plugin.saveResource(uuid + ".yml", true);
    Just use the method createNewFile.
     
  3. Offline

    Christophernjsp

    I have updated the code of the Data class.

    I now get this exception on join.
    Code:
    [00:28:57 ERROR]: Could not pass event PlayerJoinEvent to PlayerData2 v1.0.0-B2
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PlayerList.onPlayerJoin(PlayerList.java:272) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.PlayerList.a(PlayerList.java:156) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.LoginListener.b(LoginListener.java:109) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.LoginListener.c(LoginListener.java:41) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.NetworkManager.a(NetworkManager.java:159) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.ServerConnection.c(ServerConnection.java:82) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:800) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot.jar:git-Spigot-c3c767f-33d5de3]
            at java.lang.Thread.run(Thread.java:722) [?:1.7.0_07]
    Caused by: java.lang.NullPointerException
            at com.chaka15205.playerdata2.data.Data.createNewDataFile(Data.java:21) ~[?:?]
            at com.chaka15205.playerdata2.data.Manager.createPlayerData(Manager.java:20) ~[?:?]
            at com.chaka15205.playerdata2.listener.PlayerListener.onPlayerJoin(PlayerListener.java:22) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_07]
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_07]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_07]
            at java.lang.reflect.Method.invoke(Method.java:601) ~[?:1.7.0_07]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
            ... 14 more
    
    The source is in the same place
     
  4. Offline

    nverdier

  5. Offline

    Christophernjsp

    Last edited by a moderator: Jun 27, 2015
Thread Status:
Not open for further replies.

Share This Page