Can't set a ==

Discussion in 'Plugin Development' started by Lars110304, Jun 15, 2020.

Thread Status:
Not open for further replies.
  1. I want to try if the status of the attraction open or closed is.
    My code:
    Code:
            ItemStack item = new ItemStack(Material.RAIL);
            ItemMeta meta = item.getItemMeta();
            int i = 0;
            ConfigurationSection sec = Attractie.getPlugin().getConfig().getConfigurationSection("savedlocations.");
            for (String key : sec.getKeys(false)) {
                Attractie.getPlugin().reloadConfig();
    //            String status = Attractie.getPlugin().getConfig().getString("savedlocations." + key + ".status");
                String openstatus = "open";
                String closestatus = "closed";
                if(Attractie.getPlugin().getConfig().getString("savedlocations." + key + ".status").equals(openstatus)) {
                    item.setType(Material.GREEN_CONCRETE);
                    meta.setDisplayName("§6" + key);
                    List<String> lore = new ArrayList<String>();
                    lore.add(ChatColor.GREEN + "Status: open");
                    lore.add(ChatColor.GREEN + "Click to tp to the attraction");
                    meta.setLore(lore);
                } else if(Attractie.getPlugin().getConfig().getString("savedlocations." + key + ".status").equals(closestatus)) {
                    item.setType(Material.RED_CONCRETE);
                    meta.setDisplayName("§6" + key);
                    List<String> lore = new ArrayList<String>();
                    lore.add(ChatColor.RED + "This attraction is closed");
                    meta.setLore(lore);
                }
                item.setItemMeta(meta);
                inv.setItem(i, item);
                i++;
                p.openInventory(inv);
    
    
            }
        }
    My config:
    So i want to import the open or closed into my status.

    Thanks for helping
     
  2. Online

    timtower Administrator Administrator Moderator

    @Lars110304 What do you get if you print the status?
     
  3. Then I get “open” or “closed” if I change status with my command Then it changes also in the gui.

    edit: I have fixed it.

    solution: if(status.contains(“open”);
     
    Last edited: Jun 15, 2020
Thread Status:
Not open for further replies.

Share This Page