vMinecraftCommands.java 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829
  1. import java.io.IOException;
  2. import java.lang.reflect.InvocationTargetException;
  3. import java.lang.reflect.Method;
  4. import java.util.ArrayList;
  5. import java.util.logging.Level;
  6. import java.util.logging.Logger;
  7. //=====================================================================
  8. //Class: vMinecraftCommands
  9. //Use: Encapsulates all commands added by this mod
  10. //Author: nos, trapalice, cerevisiae
  11. //=====================================================================
  12. public class vMinecraftCommands{
  13. //Log output
  14. protected static final Logger log = Logger.getLogger("Minecraft");
  15. static final int EXIT_FAIL = 0,
  16. EXIT_SUCCESS = 1,
  17. EXIT_CONTINUE = 2;
  18. //The list of commands for vMinecraft
  19. public static commandList cl = new commandList();
  20. //=====================================================================
  21. //Function: loadCommands
  22. //Input: None
  23. //Output: None
  24. //Use: Imports all the commands into the command list
  25. //=====================================================================
  26. public static void loadCommands(){
  27. //If we had commands we would add them here.
  28. //register: Registers a function for use with a command
  29. //String: The command that will be used
  30. //String: The name of the function that will be called when
  31. // the command is used
  32. //String(Optional): The help menu description
  33. //Administrative
  34. cl.register("/prefix", "prefix", "Set your name color and prefix");
  35. cl.register("/rprefix", "removeTag", "Remove your name color and prefix");
  36. cl.register("/nick", "nickName", "Set your display name");
  37. cl.register("/rnick", "removeNick", "Reset your display name to your account name");
  38. cl.register("/suffix", "suffix", "Set your suffix");
  39. cl.register("/rsuffix", "removeSuffix", "Remove your suffix");
  40. cl.register("/vminecraft", "vminecrafthelp");
  41. cl.register("/reload", "reload");
  42. cl.register("/whois", "whois", "/whois [user]");
  43. cl.register("/say", "say");
  44. cl.register("/a", "adminChatToggle", "Toggle admin chat for every message");
  45. cl.register("/modify", "modify");
  46. cl.register("/rules", "rules", "Displays the rules");
  47. cl.register("/who", "who");
  48. //Movement
  49. cl.register("/tp", "teleport");
  50. cl.register("/tphere", "tphere");
  51. cl.register("/masstp", "masstp", "Teleports those with lower permissions to you");
  52. //Health
  53. cl.register("/ezmodo", "invuln", "Toggle invulnerability");
  54. cl.register("/ezlist", "ezlist", "List invulnerable players");
  55. cl.register("/heal", "heal", "heal yourself or other players");
  56. cl.register("/suicide", "suicide", "Kill yourself... you loser");
  57. cl.register("/slay", "slay", "Kill target player");
  58. //Social
  59. cl.register("/colors", "colors", "Set your default chat color: /colors <Color Char>");
  60. cl.register("/me", "me");
  61. cl.register("/fabulous", "fabulous", "makes text SUUUPER");
  62. cl.register("/msg", "message", "Send a message to a player /msg [Player] [Message]");
  63. cl.register("/reply", "reply", "Reply to a player /reply [Message], Alias: /r");
  64. cl.register("/ignore", "addIgnored", "Adds a user to your ignore list");
  65. cl.register("/unignore", "removeIgnored", "Removes a user from your ignore list");
  66. cl.register("/ignorelist", "ignoreList", "Lists the players you have ignored");
  67. //registerAlias: Runs the second command when the first command is called
  68. //String: The command that this will be called by
  69. //String: The message that will be called when the first is entered
  70. // Can be modified with %# to have it insert a player
  71. // argument into that position.
  72. // EX: Aliased command is
  73. // cl.registerAlias("/test", "/i %0 100")
  74. // Player uses /test wood
  75. // The %0 will be replaced with wood for this instance
  76. // and Player will be given 100 wood.
  77. cl.registerAlias("/playerlist", "/who");
  78. cl.registerAlias("/vhelp", "/vminecraft");
  79. cl.registerAlias("/r", "/reply");
  80. cl.registerAlias("/t", "/msg");
  81. cl.registerAlias("/tell", "/msg");
  82. cl.registerAlias("/wrists", "/suicide");
  83. cl.registerAlias("/kill", "/suicide");
  84. cl.registerAlias("/ci", "/clearinventory");
  85. //registerMessage: Displays a message whenever a command is used
  86. //String: The command it will run on
  87. //String: What will be displayed
  88. // %p is the player calling the command
  89. // %# is the argument number of the command.
  90. // %#p is an argument number that will be required to be
  91. // an online player
  92. //String: The color the message will be
  93. //int: The number of arguments required for the message to appear
  94. //boolean: If the message should only display for admins
  95. cl.registerMessage("/kick", "%p has kicked %0p", Colors.Blue, 1, false);
  96. cl.registerMessage("/ban", "%p has banned %0p", Colors.Blue, 1, false);
  97. cl.registerMessage("/ipban", "%p has IP banned %0p", Colors.Blue, 1, false);
  98. cl.registerMessage("/time", "Time change thanks to %p", Colors.Blue, 1, true);
  99. }
  100. //=====================================================================
  101. //Function: vminecrafthelp (/vhelp or /vminecraft)
  102. //Input: Player player: The player using the command
  103. //Output: int: Exit Code
  104. //Use: Displays the current status of most vMinecraft settings
  105. // and provides some useful tips.
  106. //=====================================================================
  107. public static int vminecrafthelp(Player player, String[] args){
  108. vMinecraftChat.sendMessage(player, player, Colors.Yellow
  109. + "Chat Settings");
  110. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  111. + "Admin Chat: " + vMinecraftSettings.getInstance()
  112. .adminchat());
  113. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  114. + "FFF turns red: " + vMinecraftSettings.getInstance()
  115. .FFF());
  116. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  117. + "Greentext After >: " + vMinecraftSettings.getInstance()
  118. .greentext());
  119. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  120. + "Quake Color Script: " + vMinecraftSettings.getInstance()
  121. .quakeColors());
  122. vMinecraftChat.sendMessage(player, player, Colors.Yellow
  123. + "Enabled Commands are TRUE, disabled are FALSE");
  124. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  125. + "Command /ezmodo: " + vMinecraftSettings.getInstance()
  126. .cmdEzModo());
  127. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  128. + "Command /fabulous: " + vMinecraftSettings.getInstance()
  129. .cmdFabulous());
  130. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  131. + "Command /rules: " + vMinecraftSettings.getInstance()
  132. .cmdRules());
  133. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  134. + "Command /heal: " + vMinecraftSettings.getInstance()
  135. .cmdHeal());
  136. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  137. + "Command /masstp: " + vMinecraftSettings.getInstance()
  138. .cmdMasstp());
  139. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  140. + "Command /say: " + vMinecraftSettings.getInstance()
  141. .cmdSay());
  142. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  143. + "Command /suicide: " + vMinecraftSettings.getInstance()
  144. .cmdSuicide());
  145. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  146. + "Command /whois: " + vMinecraftSettings.getInstance()
  147. .cmdWhoIs());
  148. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  149. + "Command /tp won't work on higher ranked players: "
  150. + vMinecraftSettings.getInstance().cmdTp());
  151. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  152. + "Command /tphere won't work on higher ranked players: "
  153. + vMinecraftSettings.getInstance().cmdTphere());
  154. vMinecraftChat.sendMessage(player, player, Colors.Yellow
  155. + "Other Settings");
  156. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  157. + "Command /who: " + vMinecraftSettings.getInstance()
  158. .cmdWho());
  159. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  160. + "COLORED PLAYER LIST IS DEPENDENT ON /who BEING TRUE!");
  161. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
  162. + "Global Messages: " + vMinecraftSettings.getInstance()
  163. .globalmessages());
  164. return EXIT_SUCCESS;
  165. }
  166. //=====================================================================
  167. //Function: prefix (/prefix)
  168. //Input: Player player: The player using the command
  169. // String[] args: The color and the prefix
  170. //Output: int: Exit Code
  171. //Use: Changes your name color and prefix
  172. //=====================================================================
  173. public static int prefix(Player player, String[] args){
  174. //if the player can prefix others
  175. if(player.canUseCommand("/prefixother") && vMinecraftSettings.getInstance().prefix()){
  176. //Check if there are enough arguments
  177. if(args.length < 2){
  178. vMinecraftChat.sendMessage(player, player, Colors.Rose + "Usage is /prefix [Player] [Color Code] <Tag>");
  179. player.sendMessage(Colors.DarkPurple + "Example: /prefix " + player.getName() + " e ^0[^a<3^0]");
  180. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple + "This would produce a name like... " + Colors.Black + "[" + Colors.LightGreen + "<3" + Colors.Black + "]" + Colors.Yellow + player.getName());
  181. return EXIT_SUCCESS;
  182. }
  183. //Check if the player exists
  184. Player other = etc.getServer().matchPlayer(args[0]);
  185. if(other == null)
  186. {
  187. vMinecraftChat.sendMessage(player, player, Colors.Rose
  188. + "The player you specified could not be found");
  189. return EXIT_SUCCESS;
  190. }
  191. //Check if they are a higher rank than the other person
  192. if(player != other && other.hasControlOver(player))
  193. {
  194. vMinecraftChat.sendMessage(player, player, Colors.Rose
  195. + "The player you specified is a higher rank than you.");
  196. return EXIT_SUCCESS;
  197. }
  198. //Check if the prefix is too long
  199. if(vMinecraftChat.msgLength(args[1]) > 60)
  200. {
  201. vMinecraftChat.sendMessage(player, player, Colors.Rose
  202. + "The prefix you entered was too long.");
  203. return EXIT_SUCCESS;
  204. }
  205. if(args.length >= 2 && args[0] != null)
  206. {
  207. other.setPrefix(args[1]);
  208. player.sendMessage(Colors.Rose + "Name color changed");
  209. FlatFileSource ffs = new FlatFileSource();
  210. ffs.modifyPlayer(other);
  211. }
  212. if(args.length >= 3 && args[1] != null)
  213. {
  214. vMinecraftUsers.players.findProfile(other).setTag(args[2]);
  215. player.sendMessage(Colors.LightGreen + "Prefix changed");
  216. }
  217. return EXIT_SUCCESS;
  218. }
  219. //If the player can set their prefix
  220. if(!player.canUseCommand("/prefix")&& vMinecraftSettings.getInstance().prefix()){
  221. return EXIT_FAIL;
  222. }
  223. //Check if there are enough arguments
  224. if(args.length < 1){
  225. vMinecraftChat.sendMessage(player, player, Colors.Rose + "Usage is /prefix [Color Code] <Tag>");
  226. player.sendMessage(Colors.DarkPurple + "Example: /prefix e ^0[^a<3^0]");
  227. vMinecraftChat.sendMessage(player, player, Colors.DarkPurple + "This would produce a name like... " + Colors.Black + "[" + Colors.LightGreen + "<3" + Colors.Black + "]" + Colors.Yellow + player.getName());
  228. return EXIT_SUCCESS;
  229. }
  230. //Name color
  231. if(args.length >= 1 && args[0] != null){
  232. player.setPrefix(args[0]);
  233. player.sendMessage(Colors.Rose + "Name color changed");
  234. }
  235. //Prefix
  236. if(args.length >= 2 && args[1] != null){
  237. //Check if the prefix is too long
  238. if(vMinecraftChat.msgLength(args[1]) > 60)
  239. {
  240. vMinecraftChat.sendMessage(player, player, Colors.Rose
  241. + "The prefix you entered was too long.");
  242. return EXIT_SUCCESS;
  243. }
  244. vMinecraftUsers.players.findProfile(player).setTag(args[1]);
  245. player.sendMessage(Colors.LightGreen + "Prefix changed");
  246. }
  247. return EXIT_SUCCESS;
  248. }
  249. //=====================================================================
  250. //Function: removeTag (/rprefix)
  251. //Input: Player player: The player using the command
  252. // String[] args: Ignored
  253. //Output: int: Exit Code
  254. //Use: Removes your prefix
  255. //=====================================================================
  256. public static int removeTag(Player player, String[] args){
  257. //if the player can suffix others
  258. if(player.canUseCommand("/prefixother")&& vMinecraftSettings.getInstance().prefix()){
  259. if(args.length < 1){
  260. vMinecraftChat.sendMessage(player, player, Colors.Rose
  261. + "Usage is /rprefix [Player]");
  262. return EXIT_SUCCESS;
  263. }
  264. //Check if the player exists
  265. Player other = etc.getServer().matchPlayer(args[0]);
  266. if(other == null)
  267. {
  268. vMinecraftChat.sendMessage(player, player, Colors.Rose
  269. + "The player you specified could not be found");
  270. return EXIT_SUCCESS;
  271. }
  272. //Check if they are a higher rank than the other person
  273. if(player != other && other.hasControlOver(player))
  274. {
  275. vMinecraftChat.sendMessage(player, player, Colors.Rose
  276. + "The player you specified is a higher rank than you.");
  277. return EXIT_SUCCESS;
  278. }
  279. vMinecraftUsers.getProfile(other).setTag("");
  280. player.sendMessage(Colors.LightGreen + "Prefix Removed");
  281. return EXIT_SUCCESS;
  282. }
  283. //Check if the player can set their own prefix.
  284. if(!player.canUseCommand("/prefix")&& vMinecraftSettings.getInstance().prefix()){
  285. return EXIT_FAIL;
  286. }
  287. if(args.length < 1){
  288. vMinecraftChat.sendMessage(player, player, Colors.Rose
  289. + "Usage is /rprefix");
  290. return EXIT_SUCCESS;
  291. }
  292. vMinecraftUsers.getProfile(player).setTag("");
  293. player.sendMessage(Colors.LightGreen + "Prefix Removed");
  294. return EXIT_SUCCESS;
  295. }
  296. //=====================================================================
  297. //Function: nickName (/nick)
  298. //Input: Player player: The player using the command
  299. // String[] args: The color and the prefix
  300. //Output: int: Exit Code
  301. //Use: Changes your name
  302. //=====================================================================
  303. public static int nickName(Player player, String[] args){
  304. //if the player can nickname others
  305. if(player.canUseCommand("/nickother") && vMinecraftSettings.getInstance().nick()){
  306. if(args.length < 2){
  307. vMinecraftChat.sendMessage(player, player, Colors.Rose
  308. + "Usage is /nick [Player] [Name]");
  309. return EXIT_SUCCESS;
  310. }
  311. //Check if the nickname is too long
  312. if(vMinecraftChat.msgLength(args[1]) > 85)
  313. {
  314. vMinecraftChat.sendMessage(player, player, Colors.Rose
  315. + "The nick you entered was too long.");
  316. return EXIT_SUCCESS;
  317. }
  318. //Check if the player exists
  319. Player other = etc.getServer().matchPlayer(args[0]);
  320. if(other == null)
  321. {
  322. vMinecraftChat.sendMessage(player, player, Colors.Rose
  323. + "The player you specified could not be found");
  324. return EXIT_SUCCESS;
  325. }
  326. //Check if they are a higher rank than the other person
  327. if(player != other && other.hasControlOver(player))
  328. {
  329. vMinecraftChat.sendMessage(player, player, Colors.Rose
  330. + "The player you specified is a higher rank than you.");
  331. return EXIT_SUCCESS;
  332. }
  333. vMinecraftUsers.getProfile(other).setNick(args[1]);
  334. player.sendMessage(Colors.LightGreen + "Nickname Set");
  335. return EXIT_SUCCESS;
  336. }
  337. //Make sure they can nickname themselves
  338. if(!player.canUseCommand("/nick")){
  339. return EXIT_FAIL;
  340. }
  341. //Check if the nickname is too long
  342. if(vMinecraftChat.msgLength(args[1]) > 85)
  343. {
  344. vMinecraftChat.sendMessage(player, player, Colors.Rose
  345. + "The nick you entered was too long.");
  346. return EXIT_SUCCESS;
  347. }
  348. if(args.length < 1){
  349. vMinecraftChat.sendMessage(player, player, Colors.Rose
  350. + "Usage is /nick [Name]");
  351. return EXIT_SUCCESS;
  352. }
  353. vMinecraftUsers.getProfile(player).setNick(args[0]);
  354. player.sendMessage(Colors.LightGreen + "Nickname Set");
  355. return EXIT_SUCCESS;
  356. }
  357. //=====================================================================
  358. //Function: removeNick (/rnick)
  359. //Input: Player player: The player using the command
  360. // String[] args: Ignored
  361. //Output: int: Exit Code
  362. //Use: Removes your nick
  363. //=====================================================================
  364. public static int removeNick(Player player, String[] args){
  365. //if the player can nick others
  366. if(player.canUseCommand("/nickother")&& vMinecraftSettings.getInstance().nick()){
  367. if(args.length < 1){
  368. vMinecraftChat.sendMessage(player, player, Colors.Rose
  369. + "Usage is /rnick [Player]");
  370. return EXIT_SUCCESS;
  371. }
  372. //Check if the player exists
  373. Player other = etc.getServer().matchPlayer(args[0]);
  374. if(other == null)
  375. {
  376. vMinecraftChat.sendMessage(player, player, Colors.Rose
  377. + "The player you specified could not be found");
  378. return EXIT_SUCCESS;
  379. }
  380. //Check if they are a higher rank than the other person
  381. if(player != other && other.hasControlOver(player))
  382. {
  383. vMinecraftChat.sendMessage(player, player, Colors.Rose
  384. + "The player you specified is a higher rank than you.");
  385. return EXIT_SUCCESS;
  386. }
  387. vMinecraftUsers.getProfile(other).setNick("");
  388. player.sendMessage(Colors.LightGreen + "Nickname Removed");
  389. return EXIT_SUCCESS;
  390. }
  391. //Check if the player can set their own nick.
  392. if(!player.canUseCommand("/nick")&& vMinecraftSettings.getInstance().nick()){
  393. return EXIT_FAIL;
  394. }
  395. if(args.length < 1){
  396. vMinecraftChat.sendMessage(player, player, Colors.Rose
  397. + "Usage is /rnick");
  398. return EXIT_SUCCESS;
  399. }
  400. vMinecraftUsers.getProfile(player).setNick("");
  401. player.sendMessage(Colors.LightGreen + "Nickname Removed");
  402. return EXIT_SUCCESS;
  403. }
  404. //=====================================================================
  405. //Function: suffix (/suffix)
  406. //Input: Player player: The player using the command
  407. // String[] args: The color and the suffix
  408. //Output: int: Exit Code
  409. //Use: Changes your suffix
  410. //=====================================================================
  411. public static int suffix(Player player, String[] args){
  412. //if the player can suffix others
  413. if(player.canUseCommand("/suffixother")&& vMinecraftSettings.getInstance().suffix()){
  414. if(args.length < 2){
  415. vMinecraftChat.sendMessage(player, player, Colors.Rose
  416. + "Usage is /suffix [Player] [Name]");
  417. return EXIT_SUCCESS;
  418. }
  419. //Check if the suffix is too long
  420. if(vMinecraftChat.msgLength(args[1]) > 60)
  421. {
  422. vMinecraftChat.sendMessage(player, player, Colors.Rose
  423. + "The suffix you entered was too long.");
  424. return EXIT_SUCCESS;
  425. }
  426. //Check if the player exists
  427. Player other = etc.getServer().matchPlayer(args[0]);
  428. if(other == null)
  429. {
  430. vMinecraftChat.sendMessage(player, player, Colors.Rose
  431. + "The player you specified could not be found");
  432. return EXIT_SUCCESS;
  433. }
  434. //Check if they are a higher rank than the other person
  435. if(player != other && other.hasControlOver(player))
  436. {
  437. vMinecraftChat.sendMessage(player, player, Colors.Rose
  438. + "The player you specified is a higher rank than you.");
  439. return EXIT_SUCCESS;
  440. }
  441. vMinecraftUsers.getProfile(other).setSuffix(args[1]);
  442. player.sendMessage(Colors.LightGreen + "Suffix Set");
  443. return EXIT_SUCCESS;
  444. }
  445. //Check if the player can set their own suffix.
  446. if(!player.canUseCommand("/suffix")&& vMinecraftSettings.getInstance().suffix()){
  447. return EXIT_FAIL;
  448. }
  449. if(args.length < 1){
  450. vMinecraftChat.sendMessage(player, player, Colors.Rose
  451. + "Usage is /suffix [Suffix]");
  452. return EXIT_SUCCESS;
  453. }
  454. //Check if the suffix is too long
  455. if(vMinecraftChat.msgLength(args[1]) > 60)
  456. {
  457. vMinecraftChat.sendMessage(player, player, Colors.Rose
  458. + "The suffix you entered was too long.");
  459. return EXIT_SUCCESS;
  460. }
  461. vMinecraftUsers.getProfile(player).setSuffix(args[0]);
  462. player.sendMessage(Colors.LightGreen + "Suffix Set");
  463. return EXIT_SUCCESS;
  464. }
  465. //=====================================================================
  466. //Function: removeSuffix (/rsuffix)
  467. //Input: Player player: The player using the command
  468. // String[] args: Ignored
  469. //Output: int: Exit Code
  470. //Use: Removes your suffix
  471. //=====================================================================
  472. public static int removeSuffix(Player player, String[] args){
  473. //if the player can suffix others
  474. if(player.canUseCommand("/suffixother")&& vMinecraftSettings.getInstance().suffix()){
  475. if(args.length < 1){
  476. vMinecraftChat.sendMessage(player, player, Colors.Rose
  477. + "Usage is /rsuffix [Player]");
  478. return EXIT_SUCCESS;
  479. }
  480. //Check if the player exists
  481. Player other = etc.getServer().matchPlayer(args[0]);
  482. if(other == null)
  483. {
  484. vMinecraftChat.sendMessage(player, player, Colors.Rose
  485. + "The player you specified could not be found");
  486. return EXIT_SUCCESS;
  487. }
  488. //Check if they are a higher rank than the other person
  489. if(player != other && other.hasControlOver(player))
  490. {
  491. vMinecraftChat.sendMessage(player, player, Colors.Rose
  492. + "The player you specified is a higher rank than you.");
  493. return EXIT_SUCCESS;
  494. }
  495. vMinecraftUsers.getProfile(other).setSuffix("");
  496. player.sendMessage(Colors.LightGreen + "Suffix Removed");
  497. return EXIT_SUCCESS;
  498. }
  499. //Check if the player can set their own suffix.
  500. if(!player.canUseCommand("/suffix")&& vMinecraftSettings.getInstance().suffix()){
  501. return EXIT_FAIL;
  502. }
  503. if(args.length < 1){
  504. vMinecraftChat.sendMessage(player, player, Colors.Rose
  505. + "Usage is /rsuffix");
  506. return EXIT_SUCCESS;
  507. }
  508. vMinecraftUsers.getProfile(player).setSuffix("");
  509. player.sendMessage(Colors.LightGreen + "Suffix Removed");
  510. return EXIT_SUCCESS;
  511. }
  512. //=====================================================================
  513. //Function: colors (/colors)
  514. //Input: Player player: The player using the command
  515. //Output: int: Exit Code
  516. //Use: Displays a list of all colors and color codes
  517. //=====================================================================
  518. public static int colors(Player player, String[] args){
  519. if(args.length > 0&& vMinecraftSettings.getInstance().colors())
  520. {
  521. vMinecraftUsers.getProfile(player).setColor(args[0]);
  522. vMinecraftChat.sendMessage(player, player, "^" + args[0].charAt(0)
  523. + "Default chat color set.");
  524. } else {
  525. player.sendMessage(Colors.Rose + "You use these color codes like in quake or MW2.");
  526. player.sendMessage(Colors.Rose + "^4 would make text " + Colors.Red
  527. + "red" + Colors.Rose + ", ^a would make it " + Colors.LightGreen
  528. + "light green" + Colors.Rose + ".");
  529. vMinecraftChat.sendMessage(player, player,
  530. Colors.Black + "0"
  531. + Colors.Navy + "1"
  532. + Colors.Green + "2"
  533. + Colors.Blue + "3"
  534. + Colors.Red + "4"
  535. + Colors.Purple + "5"
  536. + Colors.Gold + "6"
  537. + Colors.LightGray + "7"
  538. + Colors.Gray + "8"
  539. + Colors.DarkPurple + "9"
  540. + Colors.LightGreen + "A"
  541. + Colors.LightBlue + "B"
  542. + Colors.Rose + "C"
  543. + Colors.LightPurple + "D"
  544. + Colors.Yellow + "E"
  545. + Colors.White + "F"
  546. + "^r" + "[R]ainbow");
  547. }
  548. return EXIT_SUCCESS;
  549. }
  550. //=====================================================================
  551. //Function: me (/me)
  552. //Input: Player player: The player using the command
  553. // String[] args: Will contain the message the player sends
  554. //Output: int: Exit Code
  555. //Use: The player uses this to emote, but now its colorful.
  556. //=====================================================================
  557. public static int me(Player player, String[] args)
  558. {
  559. String str = etc.combineSplit(0, args, " ");
  560. if (args.length < 1) return EXIT_FAIL;
  561. vMinecraftChat.emote(player, str);
  562. return EXIT_SUCCESS;
  563. }
  564. //=====================================================================
  565. //Function: message (/msg, /w, /whisper)
  566. //Input: Player player: The player using the command
  567. // String[] args: Will contain the target player name and
  568. // message the player sends
  569. //Output: int: Exit Code
  570. //Use: Send a message to a player
  571. //=====================================================================
  572. public static int message(Player player, String[] args)
  573. {
  574. //Make sure a player is specified
  575. if (args.length < 2) {
  576. vMinecraftChat.sendMessage(player, player, Colors.Rose
  577. + "Usage is /msg [player] [message]");
  578. return EXIT_SUCCESS;
  579. }
  580. //Make sure the player exists
  581. Player toPlayer = etc.getServer().matchPlayer(args[0]);
  582. if (toPlayer == null || args.length < 1) {
  583. vMinecraftChat.sendMessage(player, player, Colors.Rose
  584. + "No player by the name of " + args[0] + " could be found.");
  585. return EXIT_SUCCESS;
  586. }
  587. String msg = etc.combineSplit(1, args, " ");
  588. //Send the message to the targeted player and the sender
  589. vMinecraftChat.sendMessage(player, toPlayer,
  590. Colors.LightGreen + "[From:" + vMinecraftChat.getName(player)
  591. + Colors.LightGreen + "] " + msg);
  592. vMinecraftChat.sendMessage(player, player,
  593. Colors.LightGreen + "[To:" + vMinecraftChat.getName(toPlayer)
  594. + Colors.LightGreen + "] " + msg);
  595. //Set the last massager for each player
  596. vMinecraftUsers.getProfile(player).setMessage(toPlayer);
  597. vMinecraftUsers.getProfile(toPlayer).setMessage(player);
  598. //Display the message to the log
  599. log.log(Level.INFO, player.getName() + " whispered to " + toPlayer.getName()
  600. + ": " + msg);
  601. return EXIT_SUCCESS;
  602. }
  603. //=====================================================================
  604. //Function: reply (/r, /reply)
  605. //Input: Player player: The player using the command
  606. // String[] args: Will contain the message the player sends
  607. //Output: int: Exit Code
  608. //Use: Send a message to a player
  609. //=====================================================================
  610. public static int reply(Player player, String[] args)
  611. {
  612. //If the profile exists for the player
  613. if(vMinecraftUsers.getProfile(player) == null ) {
  614. vMinecraftChat.sendMessage(player, player,
  615. Colors.Rose + "The person you last message has logged off");
  616. return EXIT_SUCCESS;
  617. }
  618. //Make sure a message is specified
  619. if (args.length < 1) {
  620. vMinecraftChat.sendMessage(player, player,
  621. Colors.Rose + "Usage is /reply [Message]");
  622. return EXIT_SUCCESS;
  623. }
  624. //Make sure the player they're talking to is online
  625. Player toPlayer = vMinecraftUsers.getProfile(player).getMessage();
  626. if (toPlayer == null) {
  627. vMinecraftChat.sendMessage(player, player,
  628. Colors.Rose + "The person you last message has logged off");
  629. return EXIT_SUCCESS;
  630. }
  631. String msg = etc.combineSplit(0, args, " ");
  632. //Send the message to the targeted player and the sender
  633. vMinecraftChat.sendMessage(player, toPlayer,
  634. Colors.LightGreen + "[From:" + vMinecraftChat.getName(player)
  635. + Colors.LightGreen + "] " + msg);
  636. vMinecraftChat.sendMessage(player, player,
  637. Colors.LightGreen + "[To:" + vMinecraftChat.getName(toPlayer)
  638. + Colors.LightGreen + "] " + msg);
  639. //Set the last messager for each player
  640. vMinecraftUsers.getProfile(player).setMessage(toPlayer);
  641. vMinecraftUsers.getProfile(toPlayer).setMessage(player);
  642. //Display the message to the log
  643. log.log(Level.INFO, player.getName() + " whispered to " + toPlayer.getName()
  644. + ": " + msg);
  645. return EXIT_SUCCESS;
  646. }
  647. //=====================================================================
  648. //Function: addIgnored (/ignore)
  649. //Input: Player player: The player using the command
  650. // String[] args: The name of the player to ignore
  651. //Output: int: Exit Code
  652. //Use: Adds a player to the ignore list
  653. //=====================================================================
  654. public static int addIgnored(Player player, String[] args)
  655. {
  656. //Make sure the player gave you a user to ignore
  657. if(args.length < 1 && vMinecraftSettings.getInstance().ignore())
  658. {
  659. vMinecraftChat.sendMessage(player, player,
  660. Colors.Rose + "Usage: /ignore [Player]");
  661. return EXIT_SUCCESS;
  662. }
  663. //Find the player and make sure they exist
  664. Player ignore = etc.getServer().matchPlayer(args[0]);
  665. if(ignore == null&& vMinecraftSettings.getInstance().ignore())
  666. {
  667. vMinecraftChat.sendMessage(player, player, Colors.Rose
  668. + "The person you tried to ignore is not logged in.");
  669. return EXIT_SUCCESS;
  670. }
  671. if(!player.hasControlOver(ignore)&& vMinecraftSettings.getInstance().ignore())
  672. {
  673. vMinecraftChat.sendMessage(player, player, Colors.Rose
  674. + "You can't ignore someone a higher rank than you.");
  675. return EXIT_SUCCESS;
  676. }
  677. //Don't let the player ignore themselves
  678. if(ignore.getName().equalsIgnoreCase(player.getName()))
  679. {
  680. vMinecraftChat.sendMessage(player, player,
  681. Colors.Rose + "You cannot ignore yourself");
  682. return EXIT_SUCCESS;
  683. }
  684. //Attempt to ignore the player and report accordingly
  685. if(vMinecraftUsers.getProfile(player).addIgnore(ignore))
  686. vMinecraftChat.sendMessage(player, player, Colors.Rose
  687. + ignore.getName() + " has been successfuly ignored.");
  688. else
  689. vMinecraftChat.sendMessage(player, player, Colors.Rose
  690. + "You are already ignoring " + ignore.getName());
  691. return EXIT_SUCCESS;
  692. }
  693. //=====================================================================
  694. //Function: removeIgnored (/unignore)
  695. //Input: Player player: The player using the command
  696. // String[] args: The name of the player to stop ignoring
  697. //Output: int: Exit Code
  698. //Use: Removes a player from the ignore list
  699. //=====================================================================
  700. public static int removeIgnored(Player player, String[] args)
  701. {
  702. //Make sure the player gave you a user to ignore
  703. if(args.length < 1&& vMinecraftSettings.getInstance().ignore())
  704. {
  705. vMinecraftChat.sendMessage(player, player,
  706. Colors.Rose + "Usage: /unignore [Player]");
  707. return EXIT_SUCCESS;
  708. }
  709. //Find the player and make sure they exist
  710. Player ignore = etc.getServer().matchPlayer(args[0]);
  711. if(ignore == null&& vMinecraftSettings.getInstance().ignore())
  712. {
  713. vMinecraftChat.sendMessage(player, player,
  714. Colors.Rose + "The person you tried to unignore is not logged in.");
  715. return EXIT_SUCCESS;
  716. }
  717. //Attempt to ignore the player and report accordingly
  718. if(vMinecraftUsers.getProfile(player).removeIgnore(ignore))
  719. vMinecraftChat.sendMessage(player, player,
  720. Colors.Rose + ignore.getName()+ " has been successfuly " +
  721. "unignored.");
  722. else
  723. vMinecraftChat.sendMessage(player, player,
  724. Colors.Rose + "You are not currently ignoring " + ignore.getName());
  725. return EXIT_SUCCESS;
  726. }
  727. //=====================================================================
  728. //Function: ignoreList (/ignorelist)
  729. //Input: Player player: The player using the command
  730. // String[] args: Ignored
  731. //Output: int: Exit Code
  732. //Use: Lists the player you have ignored
  733. //=====================================================================
  734. public static int ignoreList(Player player, String[] args)
  735. {
  736. if (vMinecraftSettings.getInstance().ignore()){
  737. //Get the ignore list
  738. String[] list = vMinecraftUsers.getProfile(player).listIgnore();
  739. //Find the last page number
  740. int lastPage = (int)list.length / 5;
  741. if((int)list.length % 5 > 0)
  742. lastPage++;
  743. //Find the page number the player wants displayed
  744. int page = 0;
  745. if(args.length > 0 && Integer.valueOf(args[0]) > 0
  746. && Integer.valueOf(args[0]) <= lastPage)
  747. page = Integer.valueOf(args[0]) - 1;
  748. //Display the header
  749. vMinecraftChat.sendMessage(player, player,
  750. Colors.Rose + "Ignore List [" + page + "/"
  751. + lastPage + "]");
  752. //Display up to 5 people
  753. for(int i = 0; i < 5 && i + (page * 5) < list.length; i++)
  754. vMinecraftChat.sendMessage(player, player,
  755. Colors.Rose + list[i+ (page * 5)]);
  756. return EXIT_SUCCESS;
  757. }
  758. return EXIT_FAIL;
  759. }
  760. //=====================================================================
  761. //Function: adminChatToggle (/a)
  762. //Input: Player player: The player using the command
  763. // String[] args: Ignored
  764. //Output: int: Exit Code
  765. //Use: Toggles the player into admin chat. Every message they
  766. // send will be piped to admin chat.
  767. //=====================================================================
  768. public static int adminChatToggle(Player player, String[] args)
  769. {
  770. //Make sure the user has access to the command
  771. if(!player.canUseCommand("/a")) return EXIT_FAIL;
  772. if(!vMinecraftSettings.getInstance().adminChatToggle()) return EXIT_FAIL;
  773. //If the player is already toggled for admin chat, remove them
  774. if (vMinecraftSettings.getInstance().isAdminToggled(player.getName())) {
  775. player.sendMessage(Colors.Red + "Admin Chat Toggle = off");
  776. vMinecraftSettings.getInstance().removeAdminToggled(player.getName());
  777. //Otherwise include them
  778. } else {
  779. player.sendMessage(Colors.Blue + "Admin Chat Toggled on");
  780. vMinecraftSettings.getInstance().addAdminToggled(player.getName());
  781. }
  782. return EXIT_SUCCESS;
  783. }
  784. //=====================================================================
  785. //Function: heal (/heal)
  786. //Input: Player player: The player using the command
  787. // String[] args: The arguments for the command. Should be a
  788. // player name or blank
  789. //Output: int: Exit Code
  790. //Use: Heals yourself or a specified player.
  791. //=====================================================================
  792. public static int heal(Player player, String[] args)
  793. {
  794. //Make sure the user has access to the command
  795. if(!player.canUseCommand("/heal")) return EXIT_FAIL;
  796. if(!vMinecraftSettings.getInstance().cmdHeal()) return EXIT_FAIL;
  797. //If a target wasn't specified, heal the user.
  798. if (args.length < 1){
  799. player.setHealth(20);
  800. player.sendMessage("Your health is restored");
  801. return EXIT_SUCCESS;
  802. }
  803. //If a target was specified, try to find them and then heal them
  804. //Otherwise report the error
  805. Player playerTarget = etc.getServer().matchPlayer(args[0]);
  806. if (playerTarget == null){
  807. player.sendMessage(Colors.Rose
  808. + "Couldn't find that player");
  809. return EXIT_SUCCESS;
  810. }
  811. playerTarget.setHealth(20);
  812. player.sendMessage(Colors.Blue + "You have healed "
  813. + vMinecraftChat.getName(playerTarget));
  814. playerTarget.sendMessage(Colors.Blue
  815. + "You have been healed by "
  816. + vMinecraftChat.getName(player));
  817. return EXIT_SUCCESS;
  818. }
  819. //=====================================================================
  820. //Function: suicide (/suicide, /wrists)
  821. //Input: Player player: The player using the command
  822. // String[] args: Ignored
  823. //Output: int: Exit Code
  824. //Use: Kills yourself
  825. //=====================================================================
  826. public static int suicide(Player player, String[] args)
  827. {
  828. //Make sure the user has access to the command
  829. if(!player.canUseCommand("/suicide")) return EXIT_FAIL;
  830. if(!vMinecraftSettings.getInstance().cmdSuicide()) return EXIT_FAIL;
  831. //Set your health to 0. Not much to it.
  832. player.setHealth(0);
  833. return EXIT_SUCCESS;
  834. }
  835. //=====================================================================
  836. //Function: teleport (/tp)
  837. //Input: Player player: The player using the command
  838. // String[] args: The arguments for the command. Should be a
  839. // player name
  840. //Output: int: Exit Code
  841. //Use: Teleports the user to another player
  842. //=====================================================================
  843. public static int teleport(Player player, String[] args)
  844. {
  845. //Make sure the user has access to the command
  846. if(!player.canUseCommand("/tp")) return EXIT_FAIL;
  847. //Get if the command is enabled
  848. if(!vMinecraftSettings.getInstance().cmdTp())return EXIT_FAIL;
  849. //Make sure a player has been specified and return an error if not
  850. if (args.length < 1) {
  851. player.sendMessage(Colors.Rose + "Correct usage is: /tp [player]");
  852. return EXIT_SUCCESS;
  853. }
  854. //Find the player by name
  855. Player playerTarget = etc.getServer().matchPlayer(args[0]);
  856. //Target player isn't found
  857. if(playerTarget == null)
  858. player.sendMessage(Colors.Rose + "Can't find user "
  859. + args[0] + ".");
  860. //If it's you, return witty message
  861. else if (player.getName().equalsIgnoreCase(args[0]))
  862. player.sendMessage(Colors.Rose + "You're already here!");
  863. //If the player is higher rank than you, inform the user
  864. else if (!player.hasControlOver(playerTarget))
  865. player.sendMessage(Colors.Red +
  866. "That player has higher permissions than you.");
  867. //If the player exists transport the user to the player
  868. else {
  869. vMinecraftChat.gmsg( player, vMinecraftChat.getName(player)
  870. + Colors.LightBlue + "has teleported to"
  871. + vMinecraftChat.getName(playerTarget));
  872. log.log(Level.INFO, player.getName() + " teleported to " +
  873. playerTarget.getName());
  874. player.teleportTo(playerTarget);
  875. }
  876. return EXIT_SUCCESS;
  877. }
  878. //=====================================================================
  879. //Function: masstp (/masstp)
  880. //Input: Player player: The player using the command
  881. // String[] args: Should be empty or is ignored
  882. //Output: int: Exit Code
  883. //Use: Teleports all players to the user
  884. //=====================================================================
  885. public static int masstp(Player player, String[] args)
  886. {
  887. //Make sure the user has access to the command
  888. if(!player.canUseCommand("/masstp")) return EXIT_FAIL;
  889. //If the command is enabled
  890. if(!vMinecraftSettings.getInstance().cmdMasstp())return EXIT_FAIL;
  891. //Go through all players and move them to the user
  892. for (Player p : etc.getServer().getPlayerList()) {
  893. if (!p.hasControlOver(player)) {
  894. p.teleportTo(player);
  895. }
  896. }
  897. //Inform the user that the command has executed successfully
  898. player.sendMessage(Colors.Blue + "Summoning successful.");
  899. return EXIT_SUCCESS;
  900. }
  901. //=====================================================================
  902. //Function: tphere (/tphere)
  903. //Input: Player player: The player using the command
  904. // String[] args: The arguments for the command. Should be a
  905. // player name
  906. //Output: int: Exit Code
  907. //Use: Teleports the user to another player
  908. //=====================================================================
  909. public static int tphere(Player player, String[] args)
  910. {
  911. //Make sure the user has access to the command
  912. if(!player.canUseCommand("/tphere")) return EXIT_FAIL;
  913. //Check if the command is enabled.
  914. if (!vMinecraftSettings.getInstance().cmdTphere())return EXIT_FAIL;
  915. //Make sure a player is specified
  916. if (args.length < 1) {
  917. player.sendMessage(Colors.Rose + "Correct usage" +
  918. " is: /tphere [player]");
  919. return EXIT_SUCCESS;
  920. }
  921. //Get the player by name
  922. Player playerTarget = etc.getServer().matchPlayer(args[0]);
  923. //If the target doesn't exist
  924. if(playerTarget == null)
  925. player.sendMessage(Colors.Rose + "Can't find user "
  926. + args[0] + ".");
  927. //If the player has a higher rank than the user, return error
  928. else if (!player.hasControlOver(playerTarget))
  929. player.sendMessage(Colors.Red + "That player has higher" +
  930. " permissions than you.");
  931. //If the user teleports themselves, mock them
  932. else if (player.getName().equalsIgnoreCase(args[0]))
  933. player.sendMessage(Colors.Rose + "Wow look at that! You" +
  934. " teleported yourself to yourself!");
  935. //If the target exists, teleport them to the user
  936. else {
  937. log.log(Level.INFO, player.getName() + " teleported "
  938. + player.getName() + " to their self.");
  939. playerTarget.teleportTo(player);
  940. }
  941. return EXIT_SUCCESS;
  942. }
  943. //=====================================================================
  944. //Function: reload (/reload)
  945. //Input: Player player: The player using the command
  946. // String[] args: Ignored
  947. //Output: int: Exit Code
  948. //Use: Reloads the settings for vMinecraft
  949. //=====================================================================
  950. public static int reload(Player player, String[] args)
  951. {
  952. //Make sure the user has access to the command
  953. if(!player.canUseCommand("/reload")) return EXIT_FAIL;
  954. vMinecraftSettings.getInstance().loadSettings();
  955. return EXIT_SUCCESS;
  956. }
  957. //=====================================================================
  958. //Function: rules (/rules)
  959. //Input: Player player: The player using the command
  960. // String[] args: Ignored
  961. //Output: int: Exit Code
  962. //Use: Lists the rules
  963. //=====================================================================
  964. public static int rules(Player player, String[] args)
  965. {
  966. //If the rules exist
  967. if(!vMinecraftSettings.getInstance().cmdRules()
  968. && vMinecraftSettings.getInstance().getRules().length > 0
  969. && !vMinecraftSettings.getInstance().getRules()[0].isEmpty()) {
  970. return EXIT_FAIL;
  971. }
  972. //Apply QuakeCode Colors to the rules
  973. String[] rules = vMinecraftChat.applyColors(
  974. vMinecraftSettings.getInstance().getRules());
  975. //Display them
  976. for (String str : rules ) {
  977. if(!str.isEmpty())
  978. player.sendMessage(Colors.Blue + str);
  979. else
  980. player.sendMessage(Colors.Blue
  981. + "!!!The Rules Have Not Been Set!!!");
  982. }
  983. return EXIT_SUCCESS;
  984. }
  985. //=====================================================================
  986. //Function: fabulous (/fabulous)
  987. //Input: Player player: The player using the command
  988. // String[] args: The message to apply the effect to
  989. //Output: int: Exit Code
  990. //Use: Makes the text rainbow colored
  991. //=====================================================================
  992. public static int fabulous(Player player, String[] args)
  993. {
  994. //If the command is enabled
  995. if(!vMinecraftSettings.getInstance().cmdFabulous()) return EXIT_FAIL;
  996. //Make sure a message has been specified
  997. if (args.length < 1) {
  998. player.sendMessage(Colors.Rose + "Usage /fabulous [Message]");
  999. return EXIT_SUCCESS;
  1000. }
  1001. //Format the name
  1002. String playerName = Colors.White + "<"
  1003. + vMinecraftChat.getName(player) + Colors.White +"> ";
  1004. //Merge the message again
  1005. String str = etc.combineSplit(0, args, " ");
  1006. //Output for server
  1007. log.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\"");
  1008. //Prepend the player name and cut into lines.
  1009. vMinecraftChat.gmsg(player, playerName + vMinecraftChat.rainbow(str));
  1010. return EXIT_SUCCESS;
  1011. }
  1012. //=====================================================================
  1013. //Function: whois (/whois)
  1014. //Input: Player player: The player using the command
  1015. // String[] args: The player to find info on
  1016. //Output: int: Exit Code
  1017. //Use: Displays information about the player specified
  1018. //=====================================================================
  1019. public static int whois(Player player, String[] args)
  1020. {
  1021. //Make sure the user has access to the command
  1022. if(!player.canUseCommand("/whois")) return EXIT_FAIL;
  1023. //If the command is enabled
  1024. if (!vMinecraftSettings.getInstance().cmdWhoIs()) return EXIT_FAIL;
  1025. //If a player is specified
  1026. if (args.length < 1)
  1027. {
  1028. player.sendMessage(Colors.Rose + "Usage is /whois [player]");
  1029. return EXIT_SUCCESS;
  1030. }
  1031. //Get the player by name
  1032. Player playerTarget = etc.getServer().matchPlayer(args[0]);
  1033. //If the player exists
  1034. if (playerTarget == null){
  1035. player.sendMessage(Colors.Rose+"Player not found.");
  1036. return EXIT_SUCCESS;
  1037. }
  1038. //Displaying the information
  1039. player.sendMessage(Colors.Blue + "Whois results for " +
  1040. vMinecraftChat.getName(playerTarget));
  1041. //Group
  1042. for(String group: playerTarget.getGroups())
  1043. player.sendMessage(Colors.Blue + "Groups: " + group);
  1044. //Only let admins see this info
  1045. if(player.isAdmin())
  1046. {
  1047. //Admin
  1048. player.sendMessage(Colors.Blue+"Admin: " +
  1049. String.valueOf(playerTarget.isAdmin()));
  1050. //IP
  1051. player.sendMessage(Colors.Blue+"IP: " + playerTarget.getIP());
  1052. //Restrictions
  1053. player.sendMessage(Colors.Blue+"Can ignore restrictions: " +
  1054. String.valueOf(playerTarget.canIgnoreRestrictions()));
  1055. }
  1056. return EXIT_SUCCESS;
  1057. }
  1058. //=====================================================================
  1059. //Function: who (/who)
  1060. //Input: Player player: The player using the command
  1061. // String[] args: Ignored
  1062. //Output: int: Exit Code
  1063. //Use: Displays the connected players
  1064. //=====================================================================
  1065. public static int who(Player player, String[] args)
  1066. {
  1067. //If the command is enabled
  1068. if (!vMinecraftSettings.getInstance().cmdWho()) return EXIT_FAIL;
  1069. //Loop through all players counting them and adding to the list
  1070. int count=0;
  1071. String tempList = "";
  1072. for( Player p : etc.getServer().getPlayerList())
  1073. {
  1074. if(p != null){
  1075. if(count == 0)
  1076. tempList += vMinecraftChat.getName(p);
  1077. else
  1078. tempList += Colors.White + ", " + vMinecraftChat.getName(p);
  1079. count++;
  1080. }
  1081. }
  1082. //Get the max players from the config
  1083. PropertiesFile server = new PropertiesFile("server.properties");
  1084. try {
  1085. server.load();
  1086. } catch (IOException e) {
  1087. e.printStackTrace();
  1088. }
  1089. int maxPlayers = server.getInt("max-players");
  1090. //Output the player list
  1091. vMinecraftChat.sendMessage(player, player, Colors.Rose + "Player List ("
  1092. + count + "/" + maxPlayers +"): " + tempList);
  1093. return EXIT_SUCCESS;
  1094. }
  1095. //=====================================================================
  1096. //Function: say (/say)
  1097. //Input: Player player: The player using the command
  1098. // String[] args: The message to apply the effect to
  1099. //Output: int: Exit Code
  1100. //Use: Announces the message to all players
  1101. //=====================================================================
  1102. public static int say(Player player, String[] args)
  1103. {
  1104. //Make sure the user has access to the command
  1105. if(!player.canUseCommand("/say")) return EXIT_FAIL;
  1106. //Check if the command is enabled
  1107. if (!vMinecraftSettings.getInstance().cmdSay()) return EXIT_FAIL;
  1108. //Make sure a message is supplied or output an error
  1109. if (args.length < 1) {
  1110. player.sendMessage(Colors.Rose + "Usage is /say [message]");
  1111. }
  1112. //Display the message globally
  1113. vMinecraftChat.gmsg(player, Colors.Yellow
  1114. + etc.combineSplit(0, args, " "));
  1115. return EXIT_SUCCESS;
  1116. }
  1117. //=====================================================================
  1118. //Function: slay (/slay)
  1119. //Input: Player player: The player using the command
  1120. // String[] args: The target for the command
  1121. //Output: int: Exit Code
  1122. //Use: Kill the target player
  1123. //=====================================================================
  1124. public static int slay(Player player, String[] args)
  1125. {
  1126. //Make sure the user has access to the command
  1127. if(!player.canUseCommand("/slay")) return EXIT_FAIL;
  1128. //Check if the command is enabled
  1129. if(!vMinecraftSettings.getInstance().cmdEzModo()) return EXIT_FAIL;
  1130. //Get the player by name
  1131. Player playerTarget = etc.getServer().matchPlayer(args[0]);
  1132. //If the player doesn't exist don't run
  1133. if(playerTarget == null)
  1134. {
  1135. player.sendMessage(Colors.Rose + "Usage is /slay [Player]");
  1136. return EXIT_SUCCESS;
  1137. }
  1138. //If the player isn't invulnerable kill them
  1139. if (vMinecraftSettings.getInstance()
  1140. .isEzModo(playerTarget.getName())) {
  1141. player.sendMessage(Colors.Rose + "That player is currently in" +
  1142. " ezmodo! Hahahaha");
  1143. }
  1144. playerTarget.setHealth(0);
  1145. vMinecraftChat.gmsg(player, vMinecraftChat.getName(player)
  1146. + Colors.LightBlue + " has slain "
  1147. + vMinecraftChat.getName(playerTarget));
  1148. //Otherwise output error to the user
  1149. return EXIT_SUCCESS;
  1150. }
  1151. //=====================================================================
  1152. //Function: invuln (/ezmodo)
  1153. //Input: Player player: The player using the command
  1154. // String[] args: The target for the command
  1155. //Output: int: Exit Code
  1156. //Use: Kill the target player
  1157. //=====================================================================
  1158. public static int invuln(Player player, String[] args)
  1159. {
  1160. //Make sure the user has access to the command
  1161. if(!player.canUseCommand("/ezmodo")) return EXIT_FAIL;
  1162. //If the command is enabled
  1163. if (!vMinecraftSettings.getInstance().cmdEzModo()) return EXIT_FAIL;
  1164. //If the player is already invulnerable, turn ezmodo off.
  1165. if (vMinecraftSettings.getInstance().isEzModo(player.getName())) {
  1166. player.sendMessage(Colors.Red + "ezmodo = off");
  1167. vMinecraftSettings.getInstance().removeEzModo(player.getName());
  1168. //Otherwise make them invulnerable
  1169. } else {
  1170. player.sendMessage(Colors.LightBlue + "eh- maji? ezmodo!?");
  1171. player.sendMessage(Colors.Rose + "kimo-i");
  1172. player.sendMessage(Colors.LightBlue + "Easy Mode ga yurusareru" +
  1173. " no wa shougakusei made dayo ne");
  1174. player.sendMessage(Colors.Red + "**Laughter**");
  1175. vMinecraftSettings.getInstance().addEzModo(player.getName());
  1176. }
  1177. return EXIT_SUCCESS;
  1178. }
  1179. //=====================================================================
  1180. //Function: ezlist (/ezlist)
  1181. //Input: Player player: The player using the command
  1182. // String[] args: Ignored
  1183. //Output: int: Exit Code
  1184. //Use: List all invulnerable players
  1185. //=====================================================================
  1186. public static int ezlist(Player player, String[] args)
  1187. {
  1188. //Make sure the user has access to the command
  1189. if(!player.canUseCommand("/ezmodo")) return EXIT_FAIL;
  1190. //If the feature is enabled list the players
  1191. if(!vMinecraftSettings.getInstance().cmdEzModo()) return EXIT_FAIL;
  1192. player.sendMessage("Ezmodo: " + vMinecraftSettings.getInstance().ezModoList());
  1193. return EXIT_SUCCESS;
  1194. }
  1195. //=====================================================================
  1196. //Function: modify (/modify)
  1197. //Input: Player player: The player using the command
  1198. // String[] args: Player, Command, Arguments
  1199. //Output: int: Exit Code
  1200. //Use: List all invulnerable players
  1201. //=====================================================================
  1202. public static int modify(Player player, String[] args)
  1203. {
  1204. if(player.canUseCommand("/prefixother"))
  1205. vMinecraftChat.sendMessage(player, player, "/prefix [Player]" +
  1206. " [Color] (Tag) - Set a players prefix and tag.");
  1207. else if(player.canUseCommand("/prefix"))
  1208. vMinecraftChat.sendMessage(player, player, "/prefix [Color]" +
  1209. " (Tag) - Set your prefix and tag.");
  1210. if(player.canUseCommand("/nickother"))
  1211. vMinecraftChat.sendMessage(player, player, "/nick [Player]" +
  1212. " [Nickname] - Set a players nickname.");
  1213. else if(player.canUseCommand("/nick"))
  1214. vMinecraftChat.sendMessage(player, player, "/nick [Nick]" +
  1215. " - Set your nickname.");
  1216. if(player.canUseCommand("/suffixother"))
  1217. vMinecraftChat.sendMessage(player, player, "/suffix [Player]" +
  1218. " [Suffix] - Set a players suffix.");
  1219. else if(player.canUseCommand("/suffix"))
  1220. vMinecraftChat.sendMessage(player, player, "/suffix [Suffix]" +
  1221. " - Set your suffix.");
  1222. if(player.canUseCommand("/suffixother"))
  1223. vMinecraftChat.sendMessage(player, player, "/suffix [Player]" +
  1224. " [Suffix] - Set a players suffix.");
  1225. else if(player.canUseCommand("/suffix"))
  1226. vMinecraftChat.sendMessage(player, player, "/suffix [Suffix]" +
  1227. " - Set your suffix.");
  1228. if(player.canUseCommand("/vranks"))
  1229. {
  1230. vMinecraftChat.sendMessage(player, player, "/promote [Player]" +
  1231. " - Promotes a player one rank");
  1232. vMinecraftChat.sendMessage(player, player, "/demote [Player]" +
  1233. " - Demotes a player one rank");
  1234. }
  1235. return EXIT_SUCCESS;
  1236. }
  1237. }
  1238. //=====================================================================
  1239. //Class: commandList
  1240. //Use: The list of commands that will be checked for
  1241. //Author: cerevisiae
  1242. //=====================================================================
  1243. class commandList {
  1244. ArrayList<command> commands;
  1245. protected static final Logger log = Logger.getLogger("Minecraft");
  1246. static final int EXIT_FAIL = 0,
  1247. EXIT_SUCCESS = 1,
  1248. EXIT_CONTINUE = 2;
  1249. //=====================================================================
  1250. //Function: commandList
  1251. //Input: None
  1252. //Output: None
  1253. //Use: Initialize the array of commands
  1254. //=====================================================================
  1255. public commandList(){
  1256. commands = new ArrayList<command>();
  1257. }
  1258. //=====================================================================
  1259. //Function: register
  1260. //Input: String name: The name of the command
  1261. // String func: The function to be called
  1262. //Output: boolean: Whether the command was input successfully or not
  1263. //Use: Registers a command to the command list for checking later
  1264. //=====================================================================
  1265. public boolean register(String name, String func)
  1266. {
  1267. //Check to make sure the command doesn't already exist
  1268. for(command temp : commands)
  1269. if(temp.getName().equalsIgnoreCase(name))
  1270. return false;
  1271. //Add the new function to the list
  1272. commands.add(new command(name, func));
  1273. //exit successfully
  1274. return true;
  1275. }
  1276. //=====================================================================
  1277. //Function: register
  1278. //Input: String name: The name of the command
  1279. // String func: The function to be called
  1280. // String info: The information for the command to put in help
  1281. //Output: boolean: Whether the command was input successfully or not
  1282. //Use: Registers a command to the command list for checking later
  1283. //=====================================================================
  1284. public boolean register(String name, String func, String info){
  1285. //Add to the /help list
  1286. etc.getInstance().addCommand(name, info);
  1287. //Finish registering
  1288. return register(name, func);
  1289. }
  1290. //=====================================================================
  1291. //Function: register
  1292. //Input: String name: The name of the command
  1293. // String func: The function to be called
  1294. //Output: boolean: Whether the command was input successfully or not
  1295. //Use: Registers a command to the command list for checking later
  1296. //=====================================================================
  1297. public boolean registerAlias(String name, String com)
  1298. {
  1299. //Check to make sure the command doesn't already exist
  1300. for(command temp : commands)
  1301. if(temp.getName().equalsIgnoreCase(name))
  1302. return false;
  1303. //Add the new function to the list
  1304. commands.add(new commandRef(name, com));
  1305. //exit successfully
  1306. return true;
  1307. }
  1308. //=====================================================================
  1309. //Function: registerMessage
  1310. //Input: String name: The name of the command
  1311. // String msg: The message to be displayed
  1312. // boolean admin: If the message is displayed to admins only
  1313. //Output: boolean: Whether the command was input successfully or not
  1314. //Use: Registers a command to the command list for checking later
  1315. //=====================================================================
  1316. public boolean registerMessage(String name, String msg, String clr, int args, boolean admin)
  1317. {
  1318. //Check to make sure the command doesn't already exist
  1319. for(command temp : commands)
  1320. if(temp.getName().equalsIgnoreCase(name))
  1321. return false;
  1322. //Add the new function to the list
  1323. commands.add(new commandAnnounce(name, msg, clr, args, admin));
  1324. //exit successfully
  1325. return true;
  1326. }
  1327. //=====================================================================
  1328. //Function: call
  1329. //Input: String name: The name of the command to be run
  1330. // Player player: The player calling the command
  1331. // String[] arg: The arguments being input for the command
  1332. //Output: boolean: If the command was called successfully
  1333. //Use: Attempts to call a command
  1334. //=====================================================================
  1335. public int call(String name, Player player, String[] arg){
  1336. //Search for the command
  1337. for(command cmd : commands)
  1338. {
  1339. //When found
  1340. if(cmd.getName().equalsIgnoreCase(name))
  1341. {
  1342. try {
  1343. //Call the command and return results
  1344. return cmd.call(player, arg);
  1345. } catch (SecurityException e) {
  1346. log.log(Level.SEVERE, "Exception while running command", e);
  1347. } catch (IllegalArgumentException e) {
  1348. log.log(Level.SEVERE, "The Command Entered Doesn't Exist", e);
  1349. return EXIT_FAIL;
  1350. }
  1351. }
  1352. }
  1353. //Something went wrong
  1354. return EXIT_FAIL;
  1355. }
  1356. //=====================================================================
  1357. //Function: toString
  1358. //Input: None
  1359. //Output: String: A string representation of the aliases in the list
  1360. //Use: Displays all the aliases in thel ist
  1361. //=====================================================================
  1362. public String toString()
  1363. {
  1364. String temp = "";
  1365. int i = 0;
  1366. for(command comm : commands)
  1367. {
  1368. temp += comm.toString();
  1369. if(i < commands.size() - 1)
  1370. temp +=",";
  1371. }
  1372. return temp;
  1373. }
  1374. //=====================================================================
  1375. //Class: command
  1376. //Use: The specific command
  1377. //Author: cerevisiae
  1378. //=====================================================================
  1379. private class command
  1380. {
  1381. private String commandName;
  1382. private String function;
  1383. //=====================================================================
  1384. //Function: command
  1385. //Input: None
  1386. //Output: None
  1387. //Use: Initialize the command
  1388. //=====================================================================
  1389. public command(String name, String func){
  1390. commandName = name;
  1391. function = func;
  1392. }
  1393. //=====================================================================
  1394. //Function: getName
  1395. //Input: None
  1396. //Output: String: The command name
  1397. //Use: Returns the command name
  1398. //=====================================================================
  1399. public String getName(){return commandName;}
  1400. //=====================================================================
  1401. //Function: call
  1402. //Input: String[] arg: The arguments for the command
  1403. //Output: boolean: If the command was called successfully
  1404. //Use: Attempts to call the command
  1405. //=====================================================================
  1406. int call(Player player, String[] arg)
  1407. {
  1408. Method m;
  1409. try {
  1410. m = vMinecraftCommands.class.getMethod(function, Player.class, String[].class);
  1411. m.setAccessible(true);
  1412. return (Integer) m.invoke(null, player, arg);
  1413. } catch (SecurityException e) {
  1414. e.printStackTrace();
  1415. } catch (NoSuchMethodException e) {
  1416. e.printStackTrace();
  1417. } catch (IllegalArgumentException e) {
  1418. e.printStackTrace();
  1419. } catch (IllegalAccessException e) {
  1420. e.printStackTrace();
  1421. } catch (InvocationTargetException e) {
  1422. e.printStackTrace();
  1423. }
  1424. return 1;
  1425. }
  1426. //=====================================================================
  1427. //Function: toString
  1428. //Input: None
  1429. //Output: String: null
  1430. //Use: Returns null
  1431. //=====================================================================
  1432. public String toString() { return null; }
  1433. }
  1434. //=====================================================================
  1435. //Class: commandRef
  1436. //Use: A command referencing another command
  1437. //Author: cerevisiae
  1438. //=====================================================================
  1439. private class commandRef extends command
  1440. {
  1441. private String reference;
  1442. private String[] args;
  1443. //=====================================================================
  1444. //Function: command
  1445. //Input: String name: The command name
  1446. // String com: The command to run
  1447. //Output: None
  1448. //Use: Initialize the command
  1449. //=====================================================================
  1450. public commandRef(String name, String com){
  1451. super(name, "");
  1452. //Get the reference name
  1453. String[]temp = com.split(" ");
  1454. reference = temp[0];
  1455. //Get the arguments
  1456. args = new String[temp.length - 1];
  1457. System.arraycopy(temp, 1, args, 0, temp.length - 1);
  1458. }
  1459. //=====================================================================
  1460. //Function: call
  1461. //Input: String[] arg: The arguments for the command
  1462. //Output: boolean: If the command was called successfully
  1463. //Use: Attempts to call the command
  1464. //=====================================================================
  1465. int call(Player player, String[] arg)
  1466. {
  1467. String[] temp = new String[0];
  1468. int lastSet = 0,
  1469. argCount = 0;
  1470. //If there are args set with the function
  1471. if(args != null && args.length > 0) {
  1472. temp = new String[args.length];
  1473. System.arraycopy(args, 0, temp, 0, args.length);
  1474. //Insert the arguments into the pre-set arguments
  1475. for(String argument : temp)
  1476. {
  1477. if(argument.startsWith("%") && argument.length() > 1)
  1478. {
  1479. int argNum = Integer.parseInt(argument.substring(1));
  1480. if( argNum < arg.length )
  1481. {
  1482. temp[lastSet] = arg[argNum];
  1483. argCount++;
  1484. }
  1485. }
  1486. lastSet++;
  1487. }
  1488. }
  1489. //If there are args being input
  1490. if(arg.length > 0) {
  1491. //Append the rest of the arguments to the argument array
  1492. if(lastSet < temp.length + arg.length - argCount)
  1493. {
  1494. String[] temp2 = new String[temp.length + arg.length - argCount];
  1495. System.arraycopy(temp, 0, temp2, 0, temp.length);
  1496. System.arraycopy(arg, argCount, temp2,
  1497. temp.length, arg.length - argCount);
  1498. temp = temp2;
  1499. }
  1500. log.log(Level.INFO, reference + " " + etc.combineSplit(0, temp, " "));
  1501. //Call the referenced command
  1502. player.command(reference + " " + etc.combineSplit(0, temp, " "));
  1503. } else
  1504. player.command(reference);
  1505. return EXIT_SUCCESS;
  1506. }
  1507. //=====================================================================
  1508. //Function: toString
  1509. //Input: None
  1510. //Output: String: A string representation of this command.
  1511. // command@referencedcommand arg1 arg2 argn
  1512. //Use: Returns the string representation of the alias
  1513. //=====================================================================
  1514. public String toString()
  1515. {
  1516. String temp = getName();
  1517. temp += '@';
  1518. temp += reference;
  1519. temp += etc.combineSplit(0, args, " ");
  1520. return temp;
  1521. }
  1522. }
  1523. //=====================================================================
  1524. //Class: commandAnnounce
  1525. //Use: Announces when a command is used
  1526. //Author: cerevisiae
  1527. //=====================================================================
  1528. private class commandAnnounce extends command
  1529. {
  1530. private String message;
  1531. private boolean admin;
  1532. private int minArgs;
  1533. private String color;
  1534. //=====================================================================
  1535. //Function: commandAnnounce
  1536. //Input: String name: The command name
  1537. // String msg: The message to announce
  1538. //Output: None
  1539. //Use: Initialize the command
  1540. //=====================================================================
  1541. public commandAnnounce(String name, String msg, String clr, int args, boolean admn){
  1542. super(name, "");
  1543. message = msg;
  1544. admin = admn;
  1545. minArgs = args;
  1546. color = clr;
  1547. }
  1548. //=====================================================================
  1549. //Function: call
  1550. //Input: String[] arg: The arguments for the command
  1551. //Output: boolean: If the command was called successfully
  1552. //Use: Attempts to call the command
  1553. //=====================================================================
  1554. int call(Player player, String[] arg)
  1555. {
  1556. //Make sure the player can use the command first
  1557. if(!player.canUseCommand(super.commandName)) return EXIT_FAIL;
  1558. //Make sure the command is long enough to fire
  1559. if(minArgs < arg.length)
  1560. return EXIT_FAIL;
  1561. if(vMinecraftSettings.getInstance().globalmessages())
  1562. {
  1563. //Split up the message
  1564. String[] temp = message.split(" ");
  1565. //Insert the arguments into the message
  1566. int i = 0;
  1567. for(String argument : temp)
  1568. {
  1569. if(argument.startsWith("%") && argument.length() > 1)
  1570. {
  1571. char position = argument.charAt(1);
  1572. //Replace %p with the player name
  1573. if(position == 'p')
  1574. temp[i] = vMinecraftChat.getName(player) + color;
  1575. else if( Character.isDigit(position) && Character.getNumericValue(position) < arg.length )
  1576. {
  1577. //If the argument is specified to be a player insert it if the
  1578. //player is found or exit if they aren't
  1579. if(argument.length() > 2 && argument.charAt(2) == 'p')
  1580. {
  1581. Player targetName = etc.getServer().matchPlayer(arg[Character.getNumericValue(position)]);
  1582. if(targetName != null)
  1583. temp[i] = vMinecraftChat.getName(targetName) + color;
  1584. else
  1585. return EXIT_FAIL;
  1586. }
  1587. //Replace %# with the argument at position #
  1588. else
  1589. temp[i] = arg[Character.getNumericValue(position)];
  1590. }
  1591. }
  1592. i++;
  1593. }
  1594. message = etc.combineSplit(0, temp, " ");
  1595. //If it's an admin message only
  1596. if(admin)
  1597. {
  1598. for (Player p: etc.getServer().getPlayerList()) {
  1599. //If p is not null
  1600. if (p != null) {
  1601. //And if p is an admin or has access to adminchat send message
  1602. if (p.isAdmin()) {
  1603. vMinecraftChat.sendMessage(player, p, color + message);
  1604. }
  1605. }
  1606. }
  1607. } else
  1608. vMinecraftChat.gmsg(player, message);
  1609. }
  1610. return EXIT_FAIL;
  1611. }
  1612. //=====================================================================
  1613. //Function: toString
  1614. //Input: None
  1615. //Output: String: null
  1616. //Use: Returns null
  1617. //=====================================================================
  1618. public String toString() { return null; }
  1619. }
  1620. }