Advertisement
Guest User

ColorMe

a guest
Sep 3rd, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. //Command Exicuter Class
  2.  
  3. public class ColorMe implements CommandExecutor {
  4.  
  5. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  6. if (sender.hasPermission("meatie.color")) {
  7. ChatColor.valueOf(args[0].toUpperCase());
  8. sender.sendMessage("You'r Name color is now " + args[0]);
  9. Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams option " + sender.getName() + " color " + args[0]);
  10. }
  11. return true;
  12. }
  13. }
  14.  
  15. //Listener Class
  16.  
  17. public class ColorMeLogin implements Listener {
  18. @EventHandler
  19. public void PlayerJoin(PlayerJoinEvent event) {
  20. Player player = event.getPlayer();
  21. if(Bukkit.getScoreboardManager().getMainScoreboard().getTeam(player.getName()) == null){
  22. Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams add " + player.getName() + " " + player.getName());
  23. Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams join " + player.getName() + " " + player.getName());
  24. Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams option " + player.getName() + " color GREEN");}
  25. }
  26. }
  27.  
  28.  
  29. //Main Class: (Put This In Your Main Class)
  30.  
  31. public void onEnable() {
  32. Bukkit.getPluginManager().registerEvents(new ColorMeListiner(), this);
  33. getCommand("color").setExecutor(new ColorMe());
  34. }
  35.  
  36. //Plugin.yml (Put This In Your Plugin.yml)
  37. color:
  38. description: Set Name Color.
  39. usage: /color
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement