Minecraft plugin


SUBMITTED BY: Guest

DATE: Feb. 6, 2014, 2:15 a.m.

FORMAT: Text only

SIZE: 2.5 kB

HITS: 1114

  1. package me.FrankAugurk.Tut;
  2. import java.util.logging.Logger;
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandSender;
  6. import org.bukkit.entity.Player;
  7. import org.bukkit.plugin.PluginDescriptionFile;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9. public class Tut extends JavaPlugin{
  10. public final Logger logger = Logger.getLogger("Minecraft");
  11. public static Tut plugin;
  12. @Override
  13. public void onDisable() {
  14. PluginDescriptionFile pdfFile = this.getDescription();
  15. this.logger.info(pdfFile.getName() + " Has Been Disabled!");
  16. }
  17. @Override
  18. public void onEnable() {
  19. PluginDescriptionFile pdfFile = this.getDescription();
  20. this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has Been Enabled!");
  21. }
  22. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  23. Player player = (Player) sender;
  24. if(commandLabel.equalsIgnoreCase("heal") || commandLabel.equalsIgnoreCase("h")){
  25. if(args.length == 0){
  26. //heal = 0 args /heal Frank = 1 args
  27. player.setHealth(20);
  28. player.setFireTicks(0);
  29. player.giveExpLevels(30);
  30. player.setFoodLevel(20);
  31. player.sendMessage(ChatColor.GREEN + "extra powaaaa!");
  32. }else if(args.length == 1){
  33. if(player.getServer().getPlayer(args[0]) !=null){
  34. Player targetPlayer = player.getServer().getPlayer(args[0]);
  35. targetPlayer.setHealth(20);
  36. targetPlayer.setFireTicks(0);
  37. targetPlayer.giveExpLevels(30);
  38. targetPlayer.setFoodLevel(20);
  39. player.sendMessage(ChatColor.GREEN + "Leven!");
  40. }else{
  41. player.sendMessage(ChatColor.RED +"Niet online");
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. }

comments powered by Disqus