other.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //Contains all the java methods for vminecraft
  2. public class other {
  3. public static other gmsg;
  4. public static other gmsg(String msg){
  5. for (Player p : etc.getServer().getPlayerList()) {
  6. if (p != null) {
  7. p.sendMessage(msg);
  8. }
  9. }
  10. return gmsg;
  11. }
  12. public static boolean lengthCheck(String str)
  13. {
  14. int length = 0;
  15. for(int x = 0; x<str.length(); x++)
  16. {
  17. if("i;,.:|!".indexOf(str.charAt(x)) != -1)
  18. {
  19. length+=2;
  20. }
  21. else if("l'".indexOf(str.charAt(x)) != -1)
  22. {
  23. length+=3;
  24. }
  25. else if("tI[]".indexOf(str.charAt(x)) != -1)
  26. {
  27. length+=4;
  28. }
  29. else if("kf{}<>\"*()".indexOf(str.charAt(x)) != -1)
  30. {
  31. length+=5;
  32. }
  33. else if("hequcbrownxjmpsvazydgTHEQUCKBROWNFXJMPSVLAZYDG1234567890#\\/?$%-=_+&".indexOf(str.charAt(x)) != -1)
  34. {
  35. length+=6;
  36. }
  37. else if("@~".indexOf(str.charAt(x)) != -1)
  38. {
  39. length+=7;
  40. }
  41. else if(str.charAt(x)==' ')
  42. {
  43. length+=4;
  44. }
  45. }
  46. if(length<=316)
  47. {
  48. return true;
  49. } else { return false; }
  50. }
  51. public static String colorChange(char colour)
  52. {
  53. String color = "";
  54. switch(colour)
  55. {
  56. case '0':
  57. color = Colors.Black;
  58. break;
  59. case '1':
  60. color = Colors.Navy;
  61. break;
  62. case '2':
  63. color = Colors.Green;
  64. break;
  65. case '3':
  66. color = Colors.Blue;
  67. break;
  68. case '4':
  69. color = Colors.Red;
  70. break;
  71. case '5':
  72. color = Colors.Purple;
  73. break;
  74. case '6':
  75. color = Colors.Gold;
  76. break;
  77. case '7':
  78. color = Colors.LightGray;
  79. break;
  80. case '8':
  81. color = Colors.Gray;
  82. break;
  83. case '9':
  84. color = Colors.DarkPurple;
  85. break;
  86. case 'a':
  87. color = Colors.LightGreen;
  88. break;
  89. case 'b':
  90. color = Colors.LightBlue;
  91. break;
  92. case 'c':
  93. color = Colors.Rose;
  94. break;
  95. case 'd':
  96. color = Colors.LightPurple;
  97. break;
  98. case 'e':
  99. color = Colors.Yellow;
  100. break;
  101. case 'f':
  102. color = Colors.White;
  103. break;
  104. case 'A':
  105. color = Colors.LightGreen;
  106. break;
  107. case 'B':
  108. color = Colors.LightBlue;
  109. break;
  110. case 'C':
  111. color = Colors.Rose;
  112. break;
  113. case 'D':
  114. color = Colors.LightPurple;
  115. break;
  116. case 'E':
  117. color = Colors.Yellow;
  118. break;
  119. case 'F':
  120. color = Colors.White;
  121. break;
  122. default:
  123. color = Colors.White;
  124. break;
  125. }
  126. return color;
  127. }
  128. }