Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. package org.model.players.commands;
  2.  
  3. import org.Server;
  4. import org.model.players.PlayerHandler;
  5. import org.model.players.client;
  6.  
  7. public class AdminCommands extends CommandManager {
  8.  
  9. /**
  10. * @author animeking1120
  11. * @param c
  12. * @param command
  13. */
  14.  
  15. public static void adminCommand(final client c, String command) {
  16.  
  17. if (command.startsWith("item")) {
  18. String[] args = command.split(" ");
  19. if (args.length == 3) {
  20. int newItemID = Integer.parseInt(args[1]);
  21. int newItemAmount = Integer.parseInt(args[2]);
  22. if (newItemID <= 160000 && newItemID >= 0) {
  23. c.addItem(newItemID, newItemAmount);
  24. } else {
  25. c.sM("No such item.");
  26. }
  27. } else {
  28. c.sM("Oops! Use as ::item 995 100");
  29. }
  30. } else if (command.startsWith("xteletome")) {
  31. try {
  32. String otherPName = command.substring(10);
  33. int otherPIndex = PlayerHandler.getPlayerID(otherPName);
  34.  
  35. if (otherPIndex != -1) {
  36. client p = (client) Server.playerHandler.players[otherPIndex];
  37. if (!c.IsInFightCave() && !p.IsInFightCave()) {
  38. p.toX = c.absX;
  39. p.toY = c.absY;
  40. p.heightLevel = c.heightLevel;
  41. p.updateRequired = true;
  42. p.appearanceUpdateRequired = true;
  43. p.sM("You have been teleported to " + c.playerName);
  44. }
  45. } else {
  46. c.sM("The name doesnt exist.");
  47. }
  48. } catch (Exception e) {
  49. c.sM("Try entering a name you want to tele to you..");
  50. }
  51. }
  52. }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement