Solved Code not working

Discussion in 'Spigot Help' started by CosmicFlameV2, May 27, 2016.

  1. Its not working everything is correct i think?

    Code (Text):

    import org.bukkit.Bukkit;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;


    public class Main extends JavaPlugin implements Listener{
        public void onEnable(){
            Bukkit.getServer().getPluginManager().registerEvents(this, this);
        public void onDisable(){
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
               Player p = (Player) sender;
                Player p2 = (Player) Bukkit.getServer().getOfflinePlayer(args[0]);
            }else if(args.length == 0){
                p.sendMessage("§4Incorrect Arguments!");
                p.sendMessage("§4/gift <player>");
            }else if(args.length == 0){
            return false;


  2. There's nothing returned true in the command section, which is needed as onCommand is boolean. Also, (and I could just be seeing this wrong or missing a character) but it looks like the if statement for if the command is "gift" ends right away before it hits anything else, so basically, if the command is gift, do nothing, but again, I'm nooby and could be mistaken.
  3. You should use Bukkit.getServer().getPlayer(). Then check if it is null, and if not, continue on.
    • Agree Agree x 1