Advertisement
mrextremez

Yell

Apr 24th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. package com.zarketh.model.entity.player.commands.impl;
  2.  
  3. import com.zarketh.InstanceDistributor;
  4. import com.zarketh.model.entity.player.Player;
  5. import com.zarketh.model.entity.player.commands.Command;
  6. import com.zarketh.util.Misc;
  7.  
  8. /**
  9. * Handles the yell command, send a global message from user.
  10. *
  11. * @author Renual
  12. * @author Jordon
  13. */
  14. public class Yell implements Command {
  15.  
  16. @Override
  17. public void execute(final Player player, final String command) {
  18. if (player.getPrivileges() >= 1)
  19. if (command.length() > 5) {
  20. final String words = command.substring(5);
  21. if (player.isYellMuted() || player.isMuted()) {
  22. player.getActionSender().sendMessage("You are muted.");
  23. return;
  24. }
  25. if (player.getPrivileges() > 5 && player.getPrivileges() < 8 && System.currentTimeMillis() - player.donatorTimer < 60000) {
  26. player.getActionSender().sendMessage("You must wait 60 seconds between each yell.");
  27. return;
  28. }
  29. String prefix = "";
  30. if (player.getPrivileges() == 8) {
  31. prefix = "[Supporter]";
  32. } else if (player.getPrivileges() == 7) {
  33. prefix = "<shad=15695415>[Donator]</col><img=0>";
  34. } else if (player.getPrivileges() == 6) {
  35. prefix = "<shad=15695415>[Super Donator]</col><img=0>";
  36. } else if (player.getPrivileges() == 5) {
  37. prefix = "<shad=15695415>[Extreme Donator]</col><img=0>";
  38. } else if (player.getPrivileges() == 4 && !player.username.equalsIgnoreCase("mitchell")) {
  39. prefix = "[V. I. P]";
  40. } else if (player.username.equalsIgnoreCase("mitchell")) {
  41. prefix = "<shad=16777215>[Co Owner]</col><img=2>";
  42. } else if (player.getPrivileges() == 3) {
  43. prefix = "<shad=16777215>[Owner]</col><img=2>";
  44. } else if (player.getPrivileges() == 2) {
  45. prefix = "<shad=6081134>[Administrator]</col><img=2>";
  46. } else if (player.getPrivileges() == 1) {
  47. prefix = "<shad=255>[Moderator]</col><img=1>";
  48. }
  49. player.donatorTimer = System.currentTimeMillis();
  50. InstanceDistributor.getGlobalActions().sendMessage(prefix + Misc.capitalizeFirstLetter(player.getUsername()) + ": " + words);
  51. } else if (command.length() < 6) {
  52. player.getActionSender().sendMessage("Syntax is ::yell <message>.");
  53. }
  54. }
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement