Error is player.hasPermission [Unsolved]

Discussion in 'Plugin Development' started by TechHut, Dec 21, 2011.

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

    TechHut

    I am having a error (I am new at coding) and want to know if you guys know what is causing it.

    if(player.hasPermission("grassdrop.nomotd")) {

    Code:
    public void onPlayerJoin(PlayerJoinEvent join)
            {
                if(player.hasPermission("grassdrop.nomotd")) {
                // No Message
                }else{
                    ChatColor Color1 = ChatColor.RED;
                    ChatColor Color2 = ChatColor.DARK_GREEN;
                    Player p = join.getPlayer();
                    p.sendMessage(Color2 + "[" + Color1 + "GrassDrop" + Color1 + "]" + Color2 + "Enabled, By TechHut.us");
                 }
            }
     
  2. Offline

    Sleaker

    well you don't create a player variable anywhere in the listener before attempting to player.hasPermission - you create Player p in the else statement... so What exactly is player?
     
  3. Offline

    TechHut

    Its making it so that when a Player joins it displays [GrassDrop] Enabled, By TechHut.us but if the permission node grassdrop.nomotd is used then the message is disabled. I don't really understand what exactly do I need to do to fix this?

    I figured it out... I added Player player = join.getPlayer(); Before the line if(player.hasPermission("grassdrop.nomotd")) {

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

Share This Page