Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Commands;
- import iCraft.Main;
- import java.util.List;
- import org.bukkit.Bukkit;
- import org.bukkit.Server;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.command.PluginCommand;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.entity.Player;
- public class CommandHeal implements CommandExecutor
- {
- public Main plugin;
- public CommandHeal(Main plugin)
- {
- plugin = plugin;
- }
- public void load()
- {
- if (!Main.config.getList("comandosOFF").contains("heal"))
- {
- plugin.getCommand("heal").setExecutor(new CommandHeal(plugin));
- }
- }
- @SuppressWarnings("unused")
- public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
- {
- if (!(sender instanceof Player))
- {
- sender.sendMessage(Main.messages.getString("ComandoInGame").replace("&", "§"));
- return true;
- }
- Player p = (Player)sender;
- if (commandLabel.equalsIgnoreCase("heal"))
- {
- if (!p.hasPermission("iessentials.heal"))
- {
- p.sendMessage(Main.messages.getString("SemPerm").replace("&", "§"));
- return true;
- }
- if (args.length == 0)
- {
- p.setHealth(20);
- p.setFoodLevel(20);
- p.sendMessage(Main.messages.getString("CuradoSucesso").replace("&", "§"));
- return true;
- }
- if (args.length == 1)
- {
- if (!p.hasPermission("iessentials.curar.outros"))
- {
- sender.sendMessage(Main.messages.getString("PermisionError").replace("&", "§"));
- return true;
- }
- Player p2 = Bukkit.getServer().getPlayer(args[0]);
- if (p2 != null)
- {
- p2.setHealth(20);
- p2.setHealth(20);
- sender.sendMessage(Main.messages.getStrng("CuradoPlayerSucesso").replace("&", "§").replace("$1", p2.getName())).
- p2.sendMessage("§aVoce foi curado por " + sender);
- return true;
- }
- else
- {
- sender.sendMessage(Main.messages.getString("CuradoOffline").replace("&", "§"));
- return true;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement