Created
October 28, 2014 20:52
-
-
Save Vetronix/3a94e5d13009e09189a9 to your computer and use it in GitHub Desktop.
Heal plugin code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package 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 main extends JavaPlugin { | |
@Override | |
public void onEnable() { | |
getLogger().info("ComplexEss has been activated."); | |
} | |
@Override | |
public void onDisable() { | |
getLogger().info("Complex has been deactivated."); | |
} | |
@SuppressWarnings("deprecation") | |
public boolean onCommand(CommandSender sender, Command cmd, String CommandLabel, String[] args) { | |
Player player = (Player) sender; | |
if (cmd.getName().equalsIgnoreCase("heal")) { | |
if (player.isOp() || (player.hasPermission("heal.self"))) { | |
} else { | |
player.sendMessage(ChatColor.RED + "Sorry, you do not have permission to use that command."); | |
return false; | |
} | |
if(args.length == 0){ | |
player.setHealth(20); | |
getLogger().info("A player has just used Heal"); | |
player.sendMessage(ChatColor.YELLOW + "You've just healed yourself."); | |
}else if(args.length == 1){ | |
if(player.getServer().getPlayer(args[0]) != null){ | |
Player targetPlayer = player.getServer().getPlayer(args[0]); | |
targetPlayer.setHealth(20); | |
getLogger().info("A player has just used ComplexHeal"); | |
player.sendMessage(ChatColor.YELLOW + "You've just healed a player."); | |
targetPlayer.sendMessage(ChatColor.YELLOW + "You've been healed."); | |
}else{ | |
player.sendMessage(ChatColor.GOLD + "Error: " + ChatColor.RED + "Player is not " + ChatColor.UNDERLINE + "ONLINE"); | |
} | |
} | |
} | |
return false; | |
} | |
} | |
Hippity hoppity your code is now my property.
hippity hoppity Ukraine is now mt property.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hippity hoppity your code is now my property.