NEW Error

Discussion in 'Plugin Development' started by badboysteee98, Jun 1, 2014.

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

    badboysteee98

    So my Plugin that I have had since 1.7.2 has just broken and gave a random NPE for some reason

    Code:
    Code:java
    1. for(String Before : this.plugin.getConfig().getStringList("Before")) {


    That is the error line

    Strack Trace:
    PHP:
    [22:18:17 ERROR]: Could not pass event PlayerJoinEvent to PrisonCore v1.3
    org
    .bukkit.event.EventException
            at org
    .bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va
    :294) ~[craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a
    :62) ~[craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava
    :501) [craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava
    :486) [craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.PlayerList.c(PlayerList.java:251) [craft
    bukkit
    -1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.PlayerList.a(PlayerList.java:138) [craft
    bukkit
    -1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.LoginListener.c(LoginListener.java:76) [
    craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.LoginListener.a(LoginListener.java:42) [
    craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:151
    ) [craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.ServerConnection.c(SourceFile:134) [craf
    tbukkit
    -1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:6
    67
    ) [craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:2
    60
    ) [craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:5
    58
    ) [craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java
    :469) [craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            
    at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:6
    28
    ) [craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
    Caused byjava.lang.NullPointerException
            at com
    .ste.PriconCore.PrisonListener.onPlayerJoinEvent(PrisonListener.ja
    va
    :113) ~[?:?]
            
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0
    _51
    ]
            
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0
    _51
    ]
            
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .7.0_51
    ]
            
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
            
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va
    :292) ~[craftbukkit-1.7.9.jar:git-Bukkit-1.7.2-R0.3-21-g1ab090e-b3050jnks]
            ... 
    14 more
    All help is grateful
     
  2. Offline

    br456

    badboysteee98
    Could you give the whole class that has the error
     
  3. Offline

    Bram0101

    badboysteee98
    I think the stringlist "Before" is null. Is there a part cold Before in the config?
     
  4. Offline

    badboysteee98

    br456 Yea

    Code:java
    1. @EventHandler
    2. public void onPlayerJoinEvent(PlayerJoinEvent e) {
    3.  
    4. Player p = e.getPlayer();
    5.  
    6. e.setJoinMessage(ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + "+" + ChatColor.DARK_GRAY + "] " + ChatColor.AQUA + p.getName());
    7.  
    8. String message = "Welcome back %player%";
    9. message = message.replace("%player%", p.getName());
    10.  
    11. if(!p.hasPlayedBefore()) {
    12. for(String Welcome : this.plugin.getConfig().getStringList("Welcome")) {
    13.  
    14. Welcome = Welcome.replace("%player%", p.getName());
    15. p.sendMessage(ChatColor.translateAlternateColorCodes('&', Welcome));
    16.  
    17. }
    18. }
    19.  
    20. else {
    21. for(String Before : this.plugin.getConfig().getStringList("Before")) {
    22.  
    23. Before = Before.replace("%player%", p.getName());
    24. p.sendMessage(ChatColor.translateAlternateColorCodes('&', Before));
    25.  
    26. }
    27. }
    28.  
    29. }


    Not whole class just the whole event

    Welcome works :/ @Bram0101

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 30, 2016
Thread Status:
Not open for further replies.

Share This Page