SimpleHeal 1.0

One Command, one function

  1. DerpyBoy
    Contributors:
    DerpyBoy_
    Very Simple heal Plugin.
    permission: heal.heal


    Source Code:
    Code (Text):
    package me.derpyboy_.heal;

    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 Heal extends JavaPlugin {
     
        @Override
        public void onEnable() {
         
            loadConfig();
         
            System.out.println("[Heal] Plugin Enabled");
         
        }
        @Override
        public void onDisable() {
            System.out.println("[Heal] Plugin Disabled");
         
        }
        public boolean onCommand(CommandSender sender, Command cmd, String cmdlabel, String[] args) {
            Player p = (Player) sender;
         
            if(cmd.getName().equalsIgnoreCase("Heal")) {
                if(p.hasPermission("heal.heal")) {
                    String msg = getConfig().getString("Config.Heal");
                    msg = msg.replace("[PLAYER]", p.getName());
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
                 
                    int Herzen = getConfig().getInt("Config.live");
                    p.setHealth(Herzen);
                 
                    return true;
                }
            }
            return false;
        }
        public void loadConfig() {
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
    }