Solved Permission

Discussion in 'Spigot Plugin Development' started by iMedia, May 31, 2017.

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

    Supporter

    upload_2017-5-31_17-59-21.png

    Above u see my code and /feed works but my permission does not work but when I do /feed sdnjsdjsdj my permission message shows up but I don't want anything to happen when they do /feed sghsghsdghds
     
  2. You are using a else statement on a args statement. Not the permission statement.
     
  3. iMedia

    Supporter

    What's the permissions statement?
     
  4. Where you check for the permission Mr Yeller.
     
  5. iMedia

    Supporter

    Idk and why Mr Yeller?
     
  6. The permission statement is where you check for the player's permission. And you really don't know? Randomly yelling in PM for no reason... And I thought you make anti-cheat and stuff.
     
  7. iMedia

    Supporter

    Ik but I suck at permissions
     
  8. Make an Else statement on the Permission statement..
     
  9. Mas

    Mas

    This guy should probably learn a bit of Java before trying to make an anticheat. And by a bit of, I mean quite a lot.

    If you can't understand what's wrong with your code you should learn Java before trying to use a Java API.

    You are checking if the player has the permission, and then if they input no arguments, you are telling them "Hunger reset", whereas if they enter any arguments, you are telling them "Donate for this permission".
     
  10. To use the Spigot/Bukkit API* (I am the grammar police :D) but you're right. HE should learn.
     
  11. iMedia

    Supporter

    I did that and when I did /feed the permissions message came but I can't do /feed when I have the permission
     
  12. Mas

    Mas

    Show us your code.

    No, he should learn Java before using any API made in Java, which is what I said.
     
  13. A simple question and these answers. Yes, you're right, but these people won't learn java before Spigot/Bukkit API. These people did start with coding because of Minecraft. Try to understand this.

    Just use this code:
    Code (Text):
            if ( cmd.getName().equalsIgnoreCase( "feed" ) ) {
                if ( player.hasPermission( "feed.feed" ) ) {
                    if ( args.length == 0 ) {
                        player.setFoodLevel( 20 );
                        player.sendMessage( ChatColor.GOLD + "Hunger Reset." );
                    }
                } else {
                    player.sendMessage( ChatColor.RED + "Please donate for this permission" );
                }
            }
     
    • Useful Useful x 1
    • Optimistic Optimistic x 1
  14. Let me explain it how you currently have it;;

    On command /feed >
    Check if player has permission >
    check args length >
    Else statement on args length sending the permission error.
     
  15. Please do not spoonfeed...
     
  16. iMedia

    Supporter

    Ik that I don't know how to fix it
     
  17. Mas

    Mas

Thread Status:
Not open for further replies.