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.sendMessage("You are banned for illegal action, GM informed.");
  56. break;
  57. case PUNISH_JAIL:
  58. _actor.sendMessage("Illegal action performed!");
  59. _actor.sendMessage("You will be teleported to GM Consultation Service area and jailed.");
  60. break;
  61. }
  62. }
  63. public void run()
  64. {
  65. LogRecord record = new LogRecord(Level.INFO, "AUDIT:" + _message);
  66. record.setLoggerName("audit");
  67. record.setParameters(new Object[]
  68. {
  69. _actor, _punishment
  70. });
  71. _logAudit.log(record);
  72. GmListTable.broadcastMessageToGMs(_message);
  73. switch (_punishment)
  74. {
  75. case PUNISH_BROADCAST:
  76. return;
  77. case PUNISH_KICK:
  78. _actor.logout(false);
  79. break;
  80. case PUNISH_KICKBAN:
  81. _actor.setAccessLevel(-100);
  82. _actor.setAccountAccesslevel(-100);
  83. _actor.logout();
  84. break;
  85. case PUNISH_JAIL:
  86. _actor.setPunishLevel(L2PcInstance.PunishLevel.JAIL, Config.DEFAULT_PUNISH_PARAM);
  87. break;
  88. }
  89. }
  90. }