Can Someone Go Over my code please 1.7.10

Discussion in 'Plugin Development' started by DominicGamesHD, Jun 26, 2015.

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

    DominicGamesHD

    Code:
    package com.dominicbul.FirstPlugin;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin{
     
        public void onEnable() {
            getLogger().info("Plugin Enabled");
        }
     
        public void onDisabke() {
            getLogger().info("Plugin Disabled");
        }
     
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (sender instanceof Player) {
                Player player = (Player) sender;
                if(cmd.getName().equalsIgnoreCase("commit")){
                    String commit = "kill " + player.getName();
                    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), commit);
                    player.sendMessage(ChatColor.AQUA + "Bye Bye <3 You")
    ;            }
             
            }
            return true;
        }
     
     
    }
    

    Can anyone tell me what i have done wrong?

    @mrCookieSlime cna you help?

    fixed it

    <Edit by mrCookieSlime: Merged posts. Please don't double post. There is an Edit Button right next to the Date.>

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  2. It's not wrong but it's bad to use it:
    • You logged that your plugin enables/disables (useless) but bukkit already does this.
    • You let the console run a command but it's simpler/better to just use .setHealth(0.0);
     
Thread Status:
Not open for further replies.

Share This Page