Help with NullPointerExeption

Discussion in 'Plugin Development' started by Minesuchtiiii, Mar 25, 2014.

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

    Minesuchtiiii

    My code:

    Code:java
    1. @EventHandler
    2. public void onDamage (EntityDamageEvent e) {
    3. Entity ent = e.getEntity();
    4.  
    5. if(ent instanceof Player) {
    6. Player p = (Player) e.getEntity();
    7.  
    8. if(this.plugin.cfg.getConfigurationSection("worlds").contains(p.getWorld().getName())) {
    9. if(e.getCause().equals(DamageCause.FALL)) {
    10. e.setCancelled(true);
    11. }
    12. } else {
    13. e.setCancelled(false);
    14. }
    15. }
    16.  
    17. }


    The error is at:
    Code:java
    1. if(this.plugin.cfg.getConfigurationSection("worlds").contains(p.getWorld().getName())) {

    Thanks
     
  2. Offline

    1Rogue

    Debug your code, see which variable in that statement is returning null.
     
Thread Status:
Not open for further replies.

Share This Page