1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

what did I wrong?

Discussion in 'Plugins/Codes' started by blackyadder, Dec 4, 2015.

  1. blackyadder

    blackyadder Member

    Joined:
    Oct 16, 2015
    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    Gender:
    Male
    Location:
    In a box, somewhere on the world, on a bridge
    Hi guys I try to made a bukkit permissions plugin but I get an error and if I fixed the error I get a new one. Can some one tell me whats wrong? The wholle script is below this


    package me.bukkit.blackyadder;

    import org.bukkit.Material;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.permissions.Permission;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.plugin.command.Command;
    import org.bukkit.inventory.ItemStack;

    public class AntiBlock extends JavaPlugin {

    public Permission playerPermission = new Permission("playerAbilities");

    @Override
    public void onEnable() {
    new BlockListener(this);
    PluginManager pm = getServer().getPluginManager();
    pm.addPermission(playerPermission);
    }

    @Override
    public void onDisable() {





    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

    if (cmd.getname().equalsIgnoreCase("givemeitems") && sender instanceof Player) {

    Player player = (Player) sender;

    if(player.hasPermission("playerAbilities.allowed")) {
    player.setItemInHand(new ItemStack(Material.DIAMOND_AXE));

    return true;
    }
    }

    return false;
    }

    }
    }
     
  2. groenink

    groenink Member

    Joined:
    Nov 5, 2015
    Messages:
    63
    Likes Received:
    15
    Trophy Points:
    8
    Gender:
    Male
    Occupation:
    Maybe
    Location:
    Everywhere and nowhere! Why do you want to know!
    I have no idea.... Thought I understanded plugins, till now... Well I gotta study a lot more I guess..
     
  3. SamueLogic

    SamueLogic Member

    Joined:
    Nov 2, 2014
    Messages:
    1,337
    Likes Received:
    1,171
    Trophy Points:
    113
    Gender:
    Male
    Occupation:
    Student
    Location:
    Colombia
    /ban? k
     
  4. Icegroose

    Icegroose Member

    Joined:
    Nov 25, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    It would help very much if you provided the error (stacktrace)
     
  5. blackyadder

    blackyadder Member

    Joined:
    Oct 16, 2015
    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    Gender:
    Male
    Location:
    In a box, somewhere on the world, on a bridge
    @Icegroose thats the weird thing when I fix an error I get a new one
     
  6. blackyadder

    blackyadder Member

    Joined:
    Oct 16, 2015
    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    Gender:
    Male
    Location:
    In a box, somewhere on the world, on a bridge
  7. DanOF

    DanOF Member

    Joined:
    Aug 20, 2015
    Messages:
    335
    Likes Received:
    230
    Trophy Points:
    43
    Gender:
    Male
    Location:
    New Jersey, USA
    Home Page:
    An error would help. But here's what I notice:
    • You never close onDisable (and it's not needed because you're not doing anything in there).
    • You need to implement CommandExecutor
    • You need to set the executor of the command
    • getname should be getName
    • You need to register BlockListener
    • You need to have the permission
     
  8. Icegroose

    Icegroose Member

    Joined:
    Nov 25, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Do you use an IDE (like eclipse or IntelliJ)? If so you would see what is wrong and you can use the quick fix option
     
  9. blackyadder

    blackyadder Member

    Joined:
    Oct 16, 2015
    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    Gender:
    Male
    Location:
    In a box, somewhere on the world, on a bridge
    Okay I'll try to fix it. thx..
     
  10. blackyadder

    blackyadder Member

    Joined:
    Oct 16, 2015
    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    Gender:
    Male
    Location:
    In a box, somewhere on the world, on a bridge
    I use Eclipse Mars but when I fix it I get new errors
     
  11. Icegroose

    Icegroose Member

    Joined:
    Nov 25, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    As far as I understand the problem it seems like these are errors in the IDE, right? if so can you post a screenshot of the IDE. that will make the troubleshooting process a lot easier for us.
     
  12. blackyadder

    blackyadder Member

    Joined:
    Oct 16, 2015
    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    Gender:
    Male
    Location:
    In a box, somewhere on the world, on a bridge
    I'm new to this. so IDE?
     
  13. DanOF

    DanOF Member

    Joined:
    Aug 20, 2015
    Messages:
    335
    Likes Received:
    230
    Trophy Points:
    43
    Gender:
    Male
    Location:
    New Jersey, USA
    Home Page:
    Integrated Development Environment. You said you're using eclipse mars.
     
  14. blackyadder

    blackyadder Member

    Joined:
    Oct 16, 2015
    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    Gender:
    Male
    Location:
    In a box, somewhere on the world, on a bridge
    Yes I use Eclipse Mars
     
  15. Icegroose

    Icegroose Member

    Joined:
    Nov 25, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Eclipse mars is your IDE, so can you post a screenshot of the IDE while the file with errors is open. Then we can see where the errors are (the red lines)
     
  16. blackyadder

    blackyadder Member

    Joined:
    Oct 16, 2015
    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    Gender:
    Male
    Location:
    In a box, somewhere on the world, on a bridge
    Hey Guys Thx for your Help. But I lost everything so I'm going to make it again. If I get an error I'll post a Screenshot here