PlowmanPlow

ForgeEssentials LoTR Title Retriever

Nov 1st, 2018
153
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function titleCommand(args) {
  2.     var player = args.player;
  3.     if (!args.player) {
  4.         args.confirm('Error: no player!');
  5.         return;
  6.     }
  7.     if (args.isTabCompletion)
  8.         return;
  9.     var hiddenChatSender = args.sender.doAs(null, true);
  10.  
  11.     var response = $EXEC("pyscripts/settitle.py " + player.getUuid());
  12.     if (response == "_f") {
  13.         args.error("You must set a LoTR Title first!");
  14.         return;
  15.     }
  16.     var title = response.split("_");
  17.     var titleColored = "&r(&" + title[1] + title[0] + "&r)";
  18.     Server.runCommand(hiddenChatSender, 'feperm', 'user', player.getName(), 'prefix', titleColored);
  19.     args.confirm("Your title has been set!");
  20.     return;
  21. }
  22. FEServer.registerCommand({
  23.     name: 'title',
  24.     usage: '/title',
  25.     permission: 'fe.commands.title',
  26.     opOnly: false,
  27.     processCommand: titleCommand,
  28.     tabComplete: titleCommand,
  29. });
RAW Paste Data