Solved Error with first MiniGame plugin!

Discussion in 'Plugin Development' started by Mindlessmink, Aug 10, 2016.

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


    I'm getting an error when I try /lobby when it doesen't exist, I have it save in the config, And it should say "Lobby has not yet been set" when it doesen't exist. Instead, It's giving me an internal error and pointing me at line 24 of my class LobbyCommand, Here is the class LobbyCommand. Not much code at all so I'll paste it here.
    package core;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Location;
    import org.bukkit.World;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    public class LobbyCommand implements CommandExecutor {
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (cmd.getName().equalsIgnoreCase("lobby")) {
                if (sender instanceof Player) {
                    Player p = (Player)sender;
                    if (Core.settings.getConfig().getConfigurationSection("lobby") == null) {
                        p.sendMessage(ChatColor.translateAlternateColorCodes('&', Core.prefix + "&7 The lobby hasn't been set yet!"));
                        return true;
                    } else {
                        World w = Bukkit.getServer().getWorld(Core.settings.getConfig().getString(""));
                        double x = Core.settings.getConfig().getDouble("lobby.x");
                        double y = Core.settings.getConfig().getDouble("lobby.y");
                        double z = Core.settings.getConfig().getDouble("lobby.z");
                    p.teleport(new Location(w, x, y, z));
                        p.sendMessage(ChatColor.translateAlternateColorCodes('&', Core.prefix + "&7You have been teleported to &aToxicChase &dLobby&7!"));
            return false;
    this is my console log:

    EDIT: Line 24 is World w = Bukkit.getServer().getWorld(Core.settings.getConfig().getString(""));
    Last edited: Aug 10, 2016
  2. Offline


    Have you tried debugging? Does the "lobby" path return a null object?
  3. Offline


    EDIT: @Zom

    @Zombie_Striker Never mind, I figured out my error, And it was a silly one too :p I updated the config and forgot to remove the old one. Thanks for replying.

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

Share This Page