My Config does not get saved.

Discussion in 'Plugin Development' started by VNGC, Mar 23, 2020.

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


    Hey, i am trying to set a config.yml in my Plugin, but it seems that it doesnt work. the Folder with the Config doesnt creates. is there something new since 1.8, or am i completely wrong with my code?

    my main:

    package lobby.main;
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.scoreboard.Scoreboard;
    import lobby.commands.aliases;
    import lobby.commands.setspawn;
    import lobby.listeners.compass;
    import lobby.listeners.join;
    import lobby.listeners.soup;
    import lobby.listeners.voidtp;
    public class Main extends JavaPlugin implements Listener {
        private static Main plugin;
        static Scoreboard sb;
        public void onEnable() {
            plugin = this;
            sb = Bukkit.getScoreboardManager().getNewScoreboard();
            sb.registerNewTeam("a").setPrefix("§bDev §8| §b");
            sb.registerNewTeam("b").setPrefix("§6VIP §8| §6");
            sb.registerNewTeam("z").setPrefix("§7Normi §8| §7");
            sb.registerNewTeam("c").setPrefix("§4Admin §8| §4");
            sb.registerNewTeam("d").setPrefix("§5Mod §8| §5");
            // Listeners:
            PluginManager pm = Bukkit.getPluginManager();
            pm.registerEvents(new soup(), this);
            pm.registerEvents(new compass(), this);
            pm.registerEvents(new join(), this);
            pm.registerEvents(new voidtp(), this);
            pm.registerEvents(new chat(), this);
            pm.registerEvents(this, this);
            pm.registerEvents(new aliases(), this);
            for (Player all : Bukkit.getOnlinePlayers()) {
            // Commands;
            getCommand("build").setExecutor(new build());
            getCommand("setspawn").setExecutor(new setspawn());
        public static Main getPlugin() {
            return plugin;
        public void onJoin(PlayerJoinEvent event) {
            Player player = (Player) event.getPlayer();
            for (Player all : Bukkit.getOnlinePlayers()) {
        public static void setPrefix(Player player) {
            String team = " ";
            if (player.getName().equalsIgnoreCase("VNGC")) {
                team = "a";
            } else if (player.getName().equalsIgnoreCase("jarException")) {
                team = "a";
            } else if (player.getName().equalsIgnoreCase("D4rkLama")) {
                team = "c";
            } else if (player.getName().equalsIgnoreCase("Konrad_2")) {
                team = "b";
            } else if (player.getName().equalsIgnoreCase("EinfachLee")) {
                team = "b";
            } else
                team = "z";
            for (Player all : Bukkit.getOnlinePlayers()) {

    The Class where i am trying to save the Config:

    package lobby.commands;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.configuration.file.FileConfiguration;
    import org.bukkit.entity.Player;
    import lobby.main.Main;
    public class setspawn implements CommandExecutor {
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (sender instanceof Player) {
                Player player = (Player) sender;
                if (player.hasPermission("Lobby.spawn")) {
                    if (args.length == 0) {
                        FileConfiguration config = Main.getPlugin().getConfig();
                        config.set("Spawn.World", player.getWorld().getName());
                        config.set("Spawn.X", player.getLocation().getX());
                        config.set("Spawn.Y", player.getLocation().getY());
                        config.set("Spawn.Z", player.getLocation().getZ());
                        config.set("Spawn.Yaw", player.getLocation().getYaw());
                        config.set("Spawn.Pitch", player.getLocation().getPitch());
                        player.sendMessage("§aDu hast den §6Spawnpoint §aauf diese Position gesetzt!");
                } else
                    player.sendMessage("Du hast keine Rechte!");
            return false;

    thank you for help!
  2. Offline

    timtower Moderator Moderator

    @VNGC Do you get any errors? Are you sure that the code is running?
  3. Offline


    Thats weird... i dont have panel-control on the lobby, as im only the Dev, i only have the FTP access. i moved the plugin on one of the other bungee-servers, there it works perfectly... uhm... is it possible that PermissionsEx is the fault?

    edit: it gets saved in another folder called "Updater". why?

    # This configuration file affects all plugins using the Updater system (version 2+ - )
    # If you wish to use your API key, read and place it below.
    # Some updating systems will not adhere to the disabled value, but these may be turned off in their plugin's configuration.
    api-key: PUT_API_KEY_HERE
    disable: false
  4. Offline

    timtower Moderator Moderator

    Bungeecord requies offline mode.
    Offline mode is not supported by Bukkit.
Thread Status:
Not open for further replies.

Share This Page