Advertisement
DibDibsTH13TEEN

Bukkit Plugin Fail #1

Dec 6th, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.64 KB | None | 0 0
  1. package me.DibDibsTH13TEEN.HealAll;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import org.bukkit.ChatColor;
  6. import org.bukkit.Server;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandSender;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.plugin.PluginDescriptionFile;
  11. import org.bukkit.plugin.java.JavaPlugin;
  12.  
  13. public class HealAll extends JavaPlugin {
  14.  
  15.     public final Logger logger = Logger.getLogger("Minecraft");
  16.    
  17.     public static HealAll plugin;
  18.    
  19.     @Override
  20.     public void onDisable() {
  21.         PluginDescriptionFile pdfFile = this.getDescription();
  22.         this.logger.info(pdfFile.getName() + "Has Been Disabled");
  23.        
  24.        
  25.     }
  26.    
  27.     @Override
  28.     public void onEnable() {
  29.         PluginDescriptionFile pdfFile = this.getDescription();
  30.         this.logger.info(pdfFile.getName() + " V" + pdfFile.getVersion() + "Has Been Enabled");
  31.        
  32.        
  33.     }
  34.  
  35.    
  36.  
  37.     public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  38.         Player player = (Player) sender;
  39.         if(commandLabel.equalsIgnoreCase("heal") || commandLabel.equalsIgnoreCase("h")){
  40.             if(args.length == 0){
  41.                 player.setHealth(20);
  42.             }else if(args.length == 1){
  43.                 Player targetPlayer = player.getServer().getPlayer(args [0]);
  44.                 targetPlayer.setHealth(20);
  45.                 player.sendMessage(ChatColor.RED + "You Have Been Healed by" + player);
  46.         }
  47.         else if(commandLabel.equalsIgnoreCase("HealAll")|| commandLabel.equalsIgnoreCase("HA"));
  48.             if(args.length == 0){
  49.                 Player targetPlayer = Server.getOnlinePlayers();
  50.                 targetPlayer.setHealth(20);
  51.                 player.sendMessage(ChatColor.RED + "You Have Been Healed by" + player);
  52.        
  53.             }
  54.         }
  55.         return false;  
  56.     }
  57.    
  58.    
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement