On Join Potions

Discussion in 'Spigot Plugin Development' started by FloThePony, May 9, 2015.

  1. On my PlayerJoinEvent my potion effects are not working
    Code (Text):
    @EventHandler
      public void onPlayerJoin(PlayerJoinEvent e) {
          World w = Bukkit.getServer().getWorld(getConfig().getString("lobby.world"));
          double x = getConfig().getDouble("lobby.x");
          double y = getConfig().getDouble("lobby.y");
          double z = getConfig().getDouble("lobby.z");          
          e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200, 1));
    I am not sure what is wrong
    Stacktrace
     
  2. gigosaurus

    Supporter

    Your config does not contain a world name at "lobby.world" - getConfig().getString("lobby.world") is returning null.
     
  3. What's on line 71?
     
  4. I have this
    Code (Text):
    if (args[0].equalsIgnoreCase("setlobby")){

                                  }
                                  if (args[0].equalsIgnoreCase("setlobby")){
                                    if (!sender.hasPermission("SpeedUHC.admin")) {
                                         sender.sendMessage(RED + "You set the spawn!");
                                         return true;
                                       }
                                       Player p = (Player)sender;
                                       getConfig().set("lobby.world", p.getLocation().getWorld().getName());
                                       getConfig().set("lobby.x", Double.valueOf(p.getLocation().getX()));
                                       getConfig().set("lobby.z", Double.valueOf(p.getLocation().getZ()));
                                       saveConfig();
                                       p.sendMessage(GREEN + "Lobby point set!");
                                       return true;
                                  }
     
  5. gigosaurus

    Supporter

    So you set the "lobby.world" value in the config via command, but you need to join before that can happen. Have you joined, typed that command, and then relogged? The error shouldn't appear once you do that.
     
  6. I did the command, then relogged, still crashed
     
  7. Why not use the serialisable of Location to store and get from the configuration? It's much easier.
     
  8. gigosaurus

    Supporter

    Fairly sure that was added in V1_8_R2, and the OP is using V1_8_R1.
     
  9. I'm pretty sure it was added way before.
     
  10. gigosaurus

    Supporter

    Nope, the v1_8_R1 version I have (no idea how old it is) doesn't have it.
     
  11. nvm fixed it ty for help
     
  12. i fixed it anyway thanks
     
  13. gigosaurus

    Supporter

  14. The same R1 with several exploits as well I can imagine.. But that's not my problem. ;P