2
0

IllegalPlayerAction.java 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.util;
  16. import java.util.logging.Level;
  17. import java.util.logging.LogRecord;
  18. import java.util.logging.Logger;
  19. import com.l2jserver.Config;
  20. import com.l2jserver.gameserver.datatables.AdminTable;
  21. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  22. /**
  23. * This class ...
  24. * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
  25. */
  26. public final class IllegalPlayerAction implements Runnable
  27. {
  28. private static Logger _logAudit = Logger.getLogger("audit");
  29. private final String _message;
  30. private final int _punishment;
  31. private final L2PcInstance _actor;
  32. public static final int PUNISH_BROADCAST = 1;
  33. public static final int PUNISH_KICK = 2;
  34. public static final int PUNISH_KICKBAN = 3;
  35. public static final int PUNISH_JAIL = 4;
  36. public IllegalPlayerAction(L2PcInstance actor, String message, int punishment)
  37. {
  38. _message = message;
  39. _punishment = punishment;
  40. _actor = actor;
  41. switch (punishment)
  42. {
  43. case PUNISH_KICK:
  44. _actor.sendMessage("You will be kicked for illegal action, GM informed.");
  45. break;
  46. case PUNISH_KICKBAN:
  47. _actor.setAccessLevel(-1);
  48. _actor.setAccountAccesslevel(-1);
  49. _actor.sendMessage("You are banned for illegal action, GM informed.");
  50. break;
  51. case PUNISH_JAIL:
  52. _actor.sendMessage("Illegal action performed!");
  53. _actor.sendMessage("You will be teleported to GM Consultation Service area and jailed.");
  54. break;
  55. }
  56. }
  57. @Override
  58. public void run()
  59. {
  60. LogRecord record = new LogRecord(Level.INFO, "AUDIT:" + _message);
  61. record.setLoggerName("audit");
  62. record.setParameters(new Object[]
  63. {
  64. _actor,
  65. _punishment
  66. });
  67. _logAudit.log(record);
  68. AdminTable.getInstance().broadcastMessageToGMs(_message);
  69. switch (_punishment)
  70. {
  71. case PUNISH_BROADCAST:
  72. return;
  73. case PUNISH_KICK:
  74. _actor.logout(false);
  75. break;
  76. case PUNISH_KICKBAN:
  77. _actor.logout();
  78. break;
  79. case PUNISH_JAIL:
  80. _actor.setPunishLevel(L2PcInstance.PunishLevel.JAIL, Config.DEFAULT_PUNISH_PARAM);
  81. break;
  82. }
  83. }
  84. }