Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. Main
  2. package com.PrankingYou.FirstPlugin;
  3.  
  4. import org.bukkit.command.CommandExecutor;
  5. import org.bukkit.plugin.java.JavaPlugin;
  6.  
  7. import com.PrankingYou.FirstPlugin.Commands.FirstPluginCommand;
  8.  
  9. public class Main extends JavaPlugin {
  10.  
  11. public void onEnable() {
  12. System.out.println("My First Plugin Has Started!");
  13. this.getCommand("FirstPlugin").setExecutor((CommandExecutor)new FirstPluginCommand());
  14. }
  15. public void onDisable() {
  16. System.out.println("My First Plugin Has Shut Down!");
  17. }
  18. }
  19.  
  20. FirstPluginCommand
  21. package com.PrankingYou.FirstPlugin.Commands;
  22.  
  23. import org.bukkit.ChatColor;
  24. import org.bukkit.command.Command;
  25. import org.bukkit.command.CommandExecutor;
  26. import org.bukkit.command.CommandSender;
  27. import org.bukkit.entity.Player;
  28.  
  29. public class FirstPluginCommand implements CommandExecutor {
  30.  
  31. @Override
  32. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  33. Player player = (Player) sender;
  34. if(sender instanceof Player) {
  35. player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&bI Did It!!!"));
  36. }
  37. else {
  38. sender.sendMessage("Hey, you can't use this in the console!");
  39. }
  40. return true;
  41. }
  42.  
  43. }
  44.  
  45. plugin.yml
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement