Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1.  
  2. private static String makeRainbowText(String text) {
  3. TextFormatting[] colours = { TextFormatting.GREEN, TextFormatting.AQUA, TextFormatting.RED,
  4. TextFormatting.LIGHT_PURPLE, TextFormatting.YELLOW };
  5. String temp = "";
  6. int currentColorID = 0;
  7. for (int i = 0; i < text.length(); ++i) {
  8. if (currentColorID == colours.length) {
  9. currentColorID = 0;
  10. }
  11. final TextFormatting currentColour = colours[currentColorID++];
  12. temp = temp + currentColour + text.charAt(i);
  13. }
  14. return temp + TextFormatting.RESET;
  15. }
  16.  
  17. @Override
  18. public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
  19. int slot = Integer.parseInt(args.<String>getOne("slot").get()) - 1;
  20. Player player = (Player) src;
  21. EntityPlayerMP MPlayer = (EntityPlayerMP) player;
  22. Pokemon pokemon = Pixelmon.storageManager.getParty(MPlayer).get(slot);
  23. if (src instanceof Player) {
  24. Player p = (Player) src;
  25. String name = pokemon.getNickname();
  26. pokemon.setNickname(makeRainbowText(name));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement