Coding Help - Tell me whats wrong.

Status
This thread has been locked.

Jetterman

Premium
Feedback score
0
Posts
73
Reactions
34
Resources
0
I am learning coding for spigot and I have been following a tutorial to setup if a basic plugin works for me and I am having problems with it. It won't show up in the plugins and I have it in the plugins folder and the code seems to be right for me but I hope one of you can find my error.

Here is the code:
Code:
package com.etterman.mrheal;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import net.md_5.bungee.api.ChatColor;

public class MrHeal extends JavaPlugin {
   
   
    public void onEnable(){
        System.out.println("Enabled");
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(!(sender instanceof Player)){
            sender.sendMessage("Players only");
            return true;
        }
        Player p = (Player) sender;
        if(command.getName().equalsIgnoreCase("heal")){           
            if(args.length == 0){
                p.setHealth(20D);
                p.sendMessage(ChatColor.GREEN + "You have been revived!");
                return true;
        }
           
            if(args.length == 1){
                Player t = Bukkit.getServer().getPlayer(args[0]);
                t.setHealth(20D);
                t.sendMessage(ChatColor.GREEN + "You were healed by " + p.getName());
                p.sendMessage(ChatColor.GREEN + "You have healed " + t.getName());
                return true;
            }
           
        }
        return true;
    }
   
}
 

Jetterman

Premium
Feedback score
0
Posts
73
Reactions
34
Resources
0
Make sure the Plugin.yml is set up correct that's probably the reason why.
I followed what the guy said:
Code:
name: MrHeal
description: Heal players.
main: com.etterman.mrheal.MrHeal
version: 1.1
commands:
    heal:
      description: Heal yourself or others.
 

Isaiahford2000

Feedback score
0
Posts
265
Reactions
30
Resources
0
If not change import net.md_5.bungee.api.ChatColor;
to this import org.bukkit.ChatColor;[DOUBLEPOST=1456698654][/DOUBLEPOST]and if that dosnt work screenshot you eclipse with all the packages and classes and show me the plugin.yml
 

Skionz

ogminecraft.com
Premium
Feedback score
1
Posts
1,546
Reactions
1,527
Resources
0

Jetterman

Premium
Feedback score
0
Posts
73
Reactions
34
Resources
0

Attachments

  • eclipse1.JPG
    eclipse1.JPG
    133 KB · Views: 50
  • eclipse2.JPG
    eclipse2.JPG
    94.2 KB · Views: 50
Status
This thread has been locked.
Top