hey guys one of my plugins im working on adjust health of players in different groups and the heal command i made for ops come into little snag now everything works fine just when you type /pheal or /pheal playername if playerA has 30 max health playerB has 50 max health the heal wont work unless this.player.setHealth(30); or this.player.setHealth(50); anyway to work around that to just make it fully heal no matter the amount of health they have? Code:java public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if ((sender instanceof Player)) { this.player = ((Player)sender); } if (cmd.getName().equalsIgnoreCase("pheal")) { if (this.player.hasPermission("permissionshealth.pheal")) { if (this.player == null) { sender.sendMessage("This command can only be run by a player. "); } else if (args.length == 0) { this.player.setHealth(50); this.player.setFoodLevel(20); this.player.setFireTicks(0); this.player.sendMessage(ChatColor.RED + "You health is full."); return true; }if (args.length == 1) { this.target = this.player.getServer().getPlayer(args[0]); if (this.target == null) { sender.sendMessage(ChatColor.RED + args[0] + " is not online!"); return false; } this.target.setHealth(50); this.target.sendMessage(ChatColor.RED + "Your health is full."); } if (args.length > 1) sender.sendMessage("Please write /heal <name>"); } else { sender.sendMessage(ChatColor.RED + "You dont have the required permission."); } return true; } return false; }}[syntax][/syntax]
I don't think there's a way to do that, not positive though. Actually, try this: Code: this.player.setHealth(player.getMaxHealth()); EDIT by Moderator: merged posts, please use the edit button instead of double posting.
So couldn't you just heal the player using the value set in the config file? Like this: Code: player.setHealth(getConfig().getInt("pathtototalhealth"));
this.player.setHealth(player.getMaxHealth()); and this.target.setHealth(target.getMaxHealth()); worked like a charm ty =D and no because there is like 20 health settings like i said before its for each group each group can have a set amount of health
noraver I'm curious by looking at your map...but what kind of plugin are you making? Looks like you got a lot of things you need to test it with.
ohtwo the display of Health Next to the names is a plugin not mine i just used it to check health was working in the settings the plugin used to do that is http://dev.bukkit.org/server-mods/health-heads/ <25>health level1 <30>Health level2 <20> Health Guest are just 3 of the premission node for setting health i just happen to use it as there name aswell hehe