.YML Saving UUID Error

Discussion in 'Plugin Help/Development/Requests' started by Eggspurt, Apr 8, 2015.

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

    Eggspurt

    My main class

    http://paste.ee/p/SG6NS

    When the player joins the server it creates a .YML file with their unique ID. Which works fine... The errors occur when we have more than 1 player I guess it gets confused and it does not save or work at all properly.

    Heres the rest of the code.

    http://paste.ee/p/fHSuf //When they break a block it's suppose to give them a point

    Which gives this error

    Code:
    [00:17:34 ERROR]: Could not pass event BlockBreakEvent to eScore v1.0
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:297) ~[craftbukkit.jar:git-Bukkit-63e28b1]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[craftbukkit.jar:git-Bukkit-63e28b1]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:501) [craftbukkit.jar:git-Bukkit-63e28b1]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:486) [craftbukkit.jar:git-Bukkit-63e28b1]
            at net.minecraft.server.v1_8_R2.PlayerInteractManager.breakBlock(PlayerI
    nteractManager.java:285) [craftbukkit.jar:git-Bukkit-63e28b1]
            at net.minecraft.server.v1_8_R2.PlayerInteractManager.a(PlayerInteractMa
    nager.java:121) [craftbukkit.jar:git-Bukkit-63e28b1]
            at net.minecraft.server.v1_8_R2.PlayerConnection.a(PlayerConnection.java
    :583) [craftbukkit.jar:git-Bukkit-63e28b1]
            at net.minecraft.server.v1_8_R2.PacketPlayInBlockDig.a(SourceFile:40) [c
    raftbukkit.jar:git-Bukkit-63e28b1]
            at net.minecraft.server.v1_8_R2.PacketPlayInBlockDig.a(SourceFile:10) [c
    raftbukkit.jar:git-Bukkit-63e28b1]
            at net.minecraft.server.v1_8_R2.PlayerConnectionUtils$1.run(SourceFile:1
    3) [craftbukkit.jar:git-Bukkit-63e28b1]
            at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [
    ?:1.8.0_25]
            at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_25]
            at net.minecraft.server.v1_8_R2.SystemUtils.a(SourceFile:60) [craftbukki
    t.jar:git-Bukkit-63e28b1]
            at net.minecraft.server.v1_8_R2.MinecraftServer.A(MinecraftServer.java:6
    70) [craftbukkit.jar:git-Bukkit-63e28b1]
            at net.minecraft.server.v1_8_R2.DedicatedServer.A(DedicatedServer.java:3
    36) [craftbukkit.jar:git-Bukkit-63e28b1]
            at net.minecraft.server.v1_8_R2.MinecraftServer.z(MinecraftServer.java:6
    26) [craftbukkit.jar:git-Bukkit-63e28b1]
            at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java
    :534) [craftbukkit.jar:git-Bukkit-63e28b1]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_25]
    Caused by: java.lang.NullPointerException
            at bukkit.Eggspurt.me.Util.Points.addPoints(Points.java:18) ~[?:?]
            at bukkit.Eggspurt.me.Classes.PointGiver.blockPoints(PointGiver.java:25)
     ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0
    _25]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0
    _25]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .8.0_25]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:295) ~[craftbukkit.jar:git-Bukkit-63e28b1]
            ... 17 more
    http://paste.ee/p/DrxDC //My points class to give and check points

    I been working at this all day, any help would be appreciated.
     
  2. Offline

    mythbusterma

    @Eggspurt

    at bukkit.Eggspurt.me.Util.Points.addPoints(Points.java:18) ~[?:?]

    Something on line 18 is null. Make it not null.

    Also, don't use bukkit as a package name, and packages are always lower case.
     
  3. Offline

    Eggspurt

    S
    The code is in the post I don't see what's null I'm in my phone Though thanks for the help
     
  4. Offline

    nj2miami

    You did not initialize "public static FileConfiguration stats;" in Main.

    Side note / suggestion: Do yourself a HUGE favor and practice some better naming conventions.

    1. Your package should be me.eggspurt.whatever_plugin_this_is - Should not have caps and should not reference Bukkit and please don't name it Classes
    2. There is really no reason to make your FileConfig public or static, simply pass on the reference to your other classes as needed and you can just grab it with a getter if you really need to or pass it along as needed
    3. new File("plugins/CRStats/"+uuid+".yml"); -> change that to 'new File(main_reference.getDataFolder(), player.getUniqueUUID() + ".yml")'

    You have many flaws in conventional naming, basic Java usage and Bukkit implementation. I see a lot of copy/paste code there because stylistically it varies. Learn what you code first and foremost. EVen if you are only doing it for Minecraft, you will get far better feedback from those here if you can show you grasp the basics of Java at a minimum.

    You error was very easy to spot, but you need to understand the trace stack.

    Caused by: java.lang.NullPointerException
    at bukkit.Eggspurt.me.Util.Points.addPoints(Points.java:18) ~[?:?]
    at bukkit.Eggspurt.me.Classes.PointGiver.blockPoints(PointGiver.java:25)
    ~[?:?]

    The error is a NPE at 18 in addPoints.
    Line 18: Main.stats.set("CRP", getPoints(player)+1); points back to Main.stats
    public static FileConfiguration stats; in Main is never initialized
     
  5. it is
    Code:java
    1. player.getUniqueId()

    UUID means UniversallyUniqueIDentifier
     
  6. Offline

    nj2miami

    Wow, great contribution to the thread.
     
  7. Offline

    pie_flavor

    @Eggspurt Both of them returned PNF. Use pastebin.com for your pastes, they never expire and you can syntax highlight for Java. But we can't troubleshoot if your code's disappeared.
     
Thread Status:
Not open for further replies.

Share This Page