Plugin Won't Load

Discussion in 'Plugin Development' started by Binner_Done, Oct 24, 2015.

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

    Binner_Done

    Hello,
    I'm fairly new to plugin development and require some help.
    So I have made my plugin, no errors yet. Shove it on to my test server and it doesn't work, doesn't even show up in /plugins

    Here is my code:
    Code:
    package com.binnerdone;
    
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.permissions.Permission;
    import org.bukkit.plugin.java.JavaPlugin;
    
    /**
    * Created by owner on 24/10/2015.
    */
    public class Simple extends JavaPlugin {
        public void onEnable(){}
        public Permission playerPermission = new Permission("player.fly");
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (cmd.getName().equalsIgnoreCase("fly")) {
                Player player = (Player) sender;
    
               if(player.isFlying() == false && player.hasPermission("player.fly")){
                    player.setFlying(true);
                        player.sendMessage(ChatColor.GREEN + "You can now fly!");
                    }
                            if(player.isFlying() == true && player.hasPermission("player.fly")){
                        player.setFlying(false);
                        player.sendMessage(ChatColor.RED + "You have now lost the ability to fly!");
    
                    }
                }
            return false;
            }
        }
    
    I bet it's a stupid mistake!
     
  2. Offline

    mcdorli

    1.: You don't own the binnerdone.com domain
    2.: Where did you put the plugin.yml
    3.: Is there any errors in the log?
     
    Zombie_Striker likes this.
  3. Offline

    Binner_Done

    @mcdorli Okay, plugin.yml is in the jar. No errors at all. What domain do I own?
     
  4. Offline

    bwfcwalshy Retired Staff

    @Binner_Done That's not how you should check booleans.

    Code:
    if(boolean)[ //This will run when it's true
    
    if(!boolean){ //This will run when it's false
    Package format should be

    me.<username>.<project>

    No need to create a Permission just use hasPermission("player.fly")

    Fix the indentation

    Please learn when to use if and else if
     
  5. Offline

    mcdorli

    I think none. A domain is a website's url.
     
  6. Offline

    MrBlackIsBack

    Check before casting

     
    bwfcwalshy likes this.
  7. Offline

    Reynergodoy

    i think i saw a plugin with the exact same messages and permission nodes before '-'
    you can now fly '-'
     
    Last edited by a moderator: Oct 24, 2015
  8. Offline

    Scimiguy

  9. Offline

    Binner_Done

    @Reynergodoy You might of, I did code it my self though. I also have proof.
     
  10. Offline

    MrBlackIsBack

    Have you fixed all the issues posted above? If you have, update your code and I'll try to help you further :)
     
  11. Offline

    Reynergodoy

    '-' i just said that i saw a code likee yours, not that you have stolen it
    if it is the plugin.yml error just drag and drop it to the "src" paste
     
  12. Offline

    Zombie_Striker

    Oh god why? Why have a method that does nothing?
    A PUBLIC MODIFIER WHEN IT"S ONLY ONE CLASS!

    That immediate sender casting without checking tho.

    You're creating a boolean by checking if one boolean equals another boolean? JUST INVERT THE ISFLYING BOOLEAN.
    And you always return false. No matter if the command you're checking for has been read or not, it's always false.

    And as stated above:
    Use me.<UserName>.<Project>
     
Thread Status:
Not open for further replies.

Share This Page