Guest User

Untitled

a guest
Nov 27th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. package me.mranimekpl.helpop;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.ChatColor;
  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 Main extends JavaPlugin{
  14.  
  15. public final Logger logger = Logger.getLogger("HelpOp");
  16. public static Main plugin;
  17.  
  18. public void onDisable(){
  19. PluginDescriptionFile pdf = getDescription();
  20. this.logger.info(pdf.getName() + " zostal wylaczony !");
  21. }
  22.  
  23. public void onEnable(){
  24. PluginDescriptionFile pdf = getDescription();
  25. this.logger.info(pdf.getName() + " zostal wlaczony !");
  26. }
  27.  
  28. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  29. StringBuilder str = new StringBuilder();
  30. if(commandLabel.equalsIgnoreCase("helpop")){
  31. if(args.length ==0){
  32. sender.sendMessage(ChatColor.RED + "Za malo argumentow!");
  33. }
  34. if(args.length >= 2){
  35. sender.sendMessage(ChatColor.RED + "Za malo argumentow!");
  36. }
  37.  
  38. if(args.length == 1){
  39. if(sender instanceof Player){
  40. Player p = (Player) sender;
  41. String pn = p.getName();
  42.  
  43.  
  44. for(int i = 0; i<args.length; i++){
  45. str.append(args[i] + "");
  46. }
  47. String msg = str.toString();
  48.  
  49.  
  50. for(Player pl : Bukkit.getOnlinePlayers()){
  51. if(p.isOp()){
  52. p.sendMessage(ChatColor.BLUE + "[Helpop]" + ChatColor.AQUA + sender.getName() + ChatColor.GREEN + msg);
  53. }
  54. }
  55. }
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62. }
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69. }
  70. return false;
  71.  
  72. }
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment