{Read} A bit of help with my plugin

Discussion in 'Plugin Development' started by jaskirat, Nov 17, 2012.

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

    jaskirat

    Hey guys. I made this plugin and I don't know if I did everything right. There are no errors in it, but it's my first plugin and I want to check if everything is right. Here is my main class:
    Show Spoiler

    package me.mrjaskirat.HealMe;

    import java.util.logging.Logger;

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

    public class HealMe extends JavaPlugin{
    public final Logger logger = Logger.getLogger("Minecraft");
    public static HealMe plugin;

    @Override
    public void onDisable() {
    PluginDescriptionFile pdfFile = this.getDescription();
    this.logger.info(pdfFile.getName() + " has been disabled! WHY?!");
    }

    @Override
    public void onEnable() {
    PluginDescriptionFile pdfFile = this.getDescription();
    this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has Been Enabled!");

    }

    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[]args){
    Player player = (Player) sender;
    if(commandLabel.equalsIgnoreCase("heal") || commandLabel.equalsIgnoreCase("h")){
    if(args.length == 0){
    //heal == 0 args /heal Bench3 = 1 args
    player.setHealth(20);
    player.sendMessage(ChatColor.AQUA + "Healed, you should be grateful!!!" );
    }else if(args.length == 1){
    Player targetPlayer = player.getServer().getPlayer(args[0]);
    targetPlayer.setHealth(20);
    player.sendMessage(ChatColor.AQUA + "Healed, you should be grateful!!!" );


    }
    }
    return false;
    }



    }


    The plugin is supposed to heal the player, and any one else i choose. I think i did everything right, but can you check?
    Also with my plugin.yml, what is the current version? Thanks.
     
  2. Offline

    ZeusAllMighty11 Retired Staff

    Does your plugin yml look like:

    Code:
    name: HealMe
    version: Some.Double
    description: Heal players
    main: xx.xxx.xxx.xxx
    commands:
      heal:
        description: Heal yourself or another player
    Also, VERSION in plugin yml is what your plugin version is (whatever you want)

    I always do 0.1 or 1.0... and I never change it after that ahah
     
  3. Offline

    jaskirat

    yes, it does,except my main is obviously not that, lol.
    Also, what is the version right now being used? is it 4.0 or....?
     
  4. Offline

    ZeusAllMighty11 Retired Staff

    It's whatever you want.
     
  5. Offline

    jaskirat

    name: HealMe
    main: me.mrjaskirat.HealMe.HealMe
    version: 1.0
    description: >
    Heals you or the player you chose!
    commands:
    heal:
    description: This is the command to heal you or a player you chose.

    Ok, thanks, btw, this is my plugin.yml, is you see anything wrong tell me, but i think everything is alright so im gonna finish of my plugin.
     
Thread Status:
Not open for further replies.

Share This Page