Get Data from File

Discussion in 'Plugin Development' started by CodX, Jan 4, 2019.

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

    CodX

    Code:
    private String[] thePlayer = new String[999];
            private int[] waterLevel = new int[999];
            private int new_player=0, new_waterlevel=0;
           
            @EventHandler
                public void onPlayerJoin (PlayerJoinEvent e)
                {
                    Player aPlayer = e.getPlayer();
                    UUID uuid = aPlayer.getUniqueId();
                   
                    if (!(this.getConfig().get(uuid + ".Name", aPlayer.getName())))
                    {
                        // Add to config.yml
                            getConfig().set(uuid + ".Name", aPlayer.getName());
                            getConfig().set(uuid + ".Water Level", 24000);
                            saveConfig();
                            reloadConfig();
                    }
                    else
                    {
                        thePlayer[++new_player] = this.getConfig().getString(uuid + ".Name");
                        waterLevel[++new_waterlevel] = this.getConfig().getInt(uuid + ".Water Level");
                       
                        for (int i=0; i<new_player; i++)
                            if (aPlayer.equals(thePlayer[i]))
                                aPlayer.sendMessage(uuid + "\n" + thePlayer[i] + "\n" + waterLevel);
                    }
                }
    At this
    Code:
    if (!(this.getConfig().get(uuid + ".Name", aPlayer.getName())))
    i have this error:
    The operator ! is undefined for the argument type(s) Object


    How can i solve this ?
     
  2. Online

    timtower Ninja on the waves Moderator

    @CodX config.contains and config.getString(path).equals(aPlayer.getName()) ?
     
Thread Status:
Not open for further replies.

Share This Page