IllegalPlayerAction.java 3.0 KB

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