what do I wrong in my plugin.yml

Discussion in 'Plugin Development' started by xize, Apr 11, 2013.

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

    xize

    hello,

    I got some problems with using broadcast(String, permission) my plugin looks right, also I added fEssentials.staff into pex but for some reason the broadcast doesn't get through the staff maybe the permission is missing or double.

    part of plugin.yml
    Code:
    permissions:
      fEssentials.Owner:
        description: Gives access to all plugin commands
        children:
          fEssentials.home: true
          fEssentials.sethome: true
          fEssentials.motd: true
          fEssentials.motd.admin: true
          fEssentials.motd.show: true
          fEssentials.motd.set: true
          fEssentials.spawn: true
          fEssentials.setspawn: true
          fEssentials.ban: true
          fEssentials.alts: true
      fEssentials.staff:
        description: Gives access to all plugin commands
        children:
          fEssentials.home: true
          fEssentials.sethome: true
          fEssentials.motd: true
          fEssentials.motd.admin: true
          fEssentials.motd.show: true
          fEssentials.motd.set: true
          fEssentials.spawn: true
          fEssentials.ban: true
          fEssentials.alts: true
      fEssentials.default:
        description: Gives all default permissions
        children:
          fEssentials.home: true
          fEssentials.spawn: true
          fEssentials.sethome: true
          fEssentials.motd: true
          fEssentials.motd.show: true
    
    the part for the broadcast:

    Code:
            StringBuilder build = new StringBuilder();
            try {
              for(String name : alts) {
              File ban = new File(plugin.getDataFolder() + File.separator + "[URL='http://forums.bukkit.org/file://\\bans\\']\\bans\\[/URL]" + name + ".yml");
              if(ban.exists()) {
                FileConfiguration banAlt = YamlConfiguration.loadConfiguration(ban);
                if(banAlt.getString("Banned").equalsIgnoreCase("true")) {
                build.append(ChatColor.DARK_RED + "[Banned]" + ChatColor.WHITE + name + ", ");
                } else {
                build.append(ChatColor.RED + "[Banned before]" + ChatColor.WHITE + name + ", ");
                }
              } else {
                build.append(ChatColor.GRAY + "[not banned]" + ChatColor.WHITE + name + ", ");
              }
              }
              if(!alts.isEmpty()) {
              Bukkit.broadcast(ChatColor.RED + "=============================", "fEssentials.alts");
              Bukkit.broadcast(ChatColor.GREEN + "The player " + ChatColor.RED + e.getPlayer().getName() + ChatColor.GREEN + " has may alt accounts!\n" + build.toString(), "fEssentials.alts");
              Bukkit.broadcast(ChatColor.RED + "=============================", "fEssentials.alts");
              alts.clear();
              } else {
              alts.clear();
              }
            } catch (Exception r) {
              r.printStackTrace();
            }
    
    however as Op I didn't had any problem which is not strange though but the permission fEssentials.alts is listed in plugin.yml

    thanks.
     
  2. Offline

    TGF

    Maybe try without UpperCase in permissions names?
     
  3. Offline

    xize

    let me try that, thanks
    edit
    nope it does not work but can a uppercase letter in the main of plugin.yml cause it?

    edit again, by trying some futher tests this seems to work:
    Code:
               for(Player p : Bukkit.getOnlinePlayers()) {
                if(p.hasPermission("fessentials.alts")) {
                 p.sendMessage("hi");
                } else {
                 //nothing
                }
               }
    
    the alt system is based on the PlayerJoinEvent however, or it seems broadcast is broken or ive to add a Bukkit permission like Bukkit.broadcast which seems strange
     
Thread Status:
Not open for further replies.

Share This Page