Caused by java.lang.NullPointerException

Discussion in 'Plugin Development' started by JackTheDev, Jul 31, 2014.

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

    JackTheDev

    Hey guys,
    Just wondering if any of you knew how to fix this bug, i am honestly confused why it isn't working. Well anyways here is the code, the error is on line 610, which is the start of this code:
    Code:java
    1.  
    2. String world1 = plugin.config.getString("1v1.pos2.world");
    3. int x1 = plugin.config.getInt("1v1.pos2.x");
    4. int y1 = plugin.config.getInt("1v1.pos2.y");
    5. int z1 = plugin.config.getInt("1v1.pos2.z");
    6. float pitch1 = plugin.config.getInt("1v1.pos2.pitch");
    7. float yaw1 = plugin.config.getInt("1v1.pos2.yaw");
    8.  
    9. rightclick.teleport(new Location(Bukkit.getWorld(world1),
    10. x1, y1, z1, yaw1, pitch1));
    11.  
    12. String world = plugin.config.getString("1v1.pos1.world");
    13. int x = plugin.config.getInt("1v1.pos1.x");
    14. int y = plugin.config.getInt("1v1.pos1.y");
    15. int z = plugin.config.getInt("1v1.pos1.z");
    16. float pitch = plugin.config.getInt("1v1.pos1.pitch");
    17. float yaw = plugin.config.getInt("1v1.pos1.yaw");
    18.  
    19. p.teleport(new Location(Bukkit.getWorld(world),
    20. x, y, z, yaw, pitch));
    21.  
    22.  


    All help is very appriciated :)
     
  2. Offline

    ZodiacTheories

    JackTheDev

    Where do you declare the plugin variable?
     
  3. Offline

    JackTheDev

    Sorry for late reply:
    Code:java
    1. public static Main plugin;
    2.  
    3. public DuelEvent(Main instance) {
    4. plugin = instance;
    5. }


    Anyone got any ideas? I am honestly lost.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  4. Offline

    ZodiacTheories

  5. Offline

    JackTheDev

    Main or duel event?
     
  6. Offline

    Giraffeknee

    JackTheDev
    Post all of your code so we can help you better. Please post a stack trace of your error too.
     
  7. Offline

    ZodiacTheories

Thread Status:
Not open for further replies.

Share This Page