Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. package me.imyou011001.Tutorial;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9.  
  10. public class Tutorial extends JavaPlugin{
  11.  
  12. Logger logger = getLogger();
  13.  
  14. public void onEnable() {
  15. this.getLogger().info("this plugin has been set up correctly!");
  16. }
  17.  
  18. public void onDisable() {
  19. this.getLogger().info("this plugin has been disabled successfully!");
  20. }
  21.  
  22. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  23. if(!(sender instanceof Player)) {
  24. sender.sendMessage("§c&lHi there, console!");
  25. }
  26.  
  27. if(cmd.getName().equalsIgnoreCase("test")) {
  28. Player p = (Player) sender;
  29. if(args.length == 0) {
  30. p.sendMessage("§4Invalid arguments! /test <hi:bye>");
  31. }
  32.  
  33. else if(args[0].equalsIgnoreCase("hi")) {
  34. p.sendMessage("§aHi.");
  35. }
  36.  
  37. else if(args[0].equalsIgnoreCase("bye")) {
  38. p.sendMessage("§aBye.");
  39.  
  40. }
  41.  
  42.  
  43. }
  44.  
  45. return true;
  46. }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement