Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Command Exicuter Class
- public class ColorMe implements CommandExecutor {
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (sender.hasPermission("meatie.color")) {
- ChatColor.valueOf(args[0].toUpperCase());
- sender.sendMessage("You'r Name color is now " + args[0]);
- Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams option " + sender.getName() + " color " + args[0]);
- }
- return true;
- }
- }
- //Listener Class
- public class ColorMeLogin implements Listener {
- @EventHandler
- public void PlayerJoin(PlayerJoinEvent event) {
- Player player = event.getPlayer();
- if(Bukkit.getScoreboardManager().getMainScoreboard().getTeam(player.getName()) == null){
- Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams add " + player.getName() + " " + player.getName());
- Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams join " + player.getName() + " " + player.getName());
- Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "scoreboard teams option " + player.getName() + " color GREEN");}
- }
- }
- //Main Class: (Put This In Your Main Class)
- public void onEnable() {
- Bukkit.getPluginManager().registerEvents(new ColorMeListiner(), this);
- getCommand("color").setExecutor(new ColorMe());
- }
- //Plugin.yml (Put This In Your Plugin.yml)
- color:
- description: Set Name Color.
- usage: /color
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement