what did I wrong?

Discussion in 'Plugins and Coding' started by blackyadder, Dec 4, 2015.

  1. blackyadder

    blackyadder Member

    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    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. xQT-

    xQT- Member

    Messages:
    63
    Likes Received:
    15
    Trophy Points:
    8
    I have no idea.... Thought I understanded plugins, till now... Well I gotta study a lot more I guess..
     
  3. SamueLogic

    SamueLogic Member

    Messages:
    1,348
    Likes Received:
    1,228
    Trophy Points:
    173
    /ban? k
     
  4. Icegroose

    Icegroose Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    It would help very much if you provided the error (stacktrace)
     
  5. blackyadder

    blackyadder Member

    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    @Icegroose thats the weird thing when I fix an error I get a new one
     
  6. blackyadder

    blackyadder Member

    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
  7. Dan:

    Dan: Member

    Messages:
    333
    Likes Received:
    246
    Trophy Points:
    68
    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

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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

    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    Okay I'll try to fix it. thx..
     
  10. blackyadder

    blackyadder Member

    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    I use Eclipse Mars but when I fix it I get new errors
     
  11. Icegroose

    Icegroose Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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

    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    I'm new to this. so IDE?
     
  13. Dan:

    Dan: Member

    Messages:
    333
    Likes Received:
    246
    Trophy Points:
    68
    Integrated Development Environment. You said you're using eclipse mars.
     
  14. blackyadder

    blackyadder Member

    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    Yes I use Eclipse Mars
     
  15. Icegroose

    Icegroose Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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

    Messages:
    20
    Likes Received:
    14
    Trophy Points:
    3
    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