Advertisement
Guest User

Java Code for heal plugin

a guest
Jun 26th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.37 KB | None | 0 0
  1.    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  2.         Player p = (Player) sender;
  3.         if (sender.hasPermission("labrynth.heal")) {
  4.             if(args.length == 0) {
  5.                sender.sendMessage("Specify a player.");
  6.             }
  7.             if (args.length == 0) {
  8.                 target = (Player) sender;
  9.             } else {
  10.                 target = Bukkit.getPlayer(args[0]);
  11.                 if (target == null) {
  12.                     p.sendMessage(ChatColor.AQUA + "Labrynth" + ChatColor.GRAY + " >> " + ChatColor.RED + "Cannot find the player: " + args[0]);
  13.                     return true;
  14.                 }
  15.             }
  16.             target.setHealth(target.getMaxHealth());
  17.             sender.sendMessage(ChatColor.AQUA + "Labrynth" + ChatColor.GRAY + " >> " + ChatColor.GREEN + "You have healed: " + target.getName().toString());
  18.             target.sendMessage(ChatColor.AQUA + "Labrynth" + ChatColor.GRAY + " >> " + ChatColor.GREEN + "You have been healed by: " + sender.getName().toString());
  19.             return true;
  20.         }else{
  21.             this.target.setHealth(target.getHealth());
  22.             sender.sendMessage(ChatColor.AQUA + "Labrynth" + ChatColor.GRAY + " >> " + ChatColor.RED + "Wrong permissions, contact an administrator if you think this is a bit weird.");
  23.         }
  24.         return true;
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement