123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- /*
- * Copyright (C) 2004-2013 L2J Server
- *
- * This file is part of L2J Server.
- *
- * L2J Server is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * L2J Server is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package com.l2jserver.gameserver.util;
- import java.util.logging.Level;
- import java.util.logging.LogRecord;
- import java.util.logging.Logger;
- import com.l2jserver.Config;
- import com.l2jserver.gameserver.datatables.AdminTable;
- import com.l2jserver.gameserver.instancemanager.PunishmentManager;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.model.punishment.PunishmentAffect;
- import com.l2jserver.gameserver.model.punishment.PunishmentTask;
- import com.l2jserver.gameserver.model.punishment.PunishmentType;
- /**
- * This class ...
- * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
- */
- public final class IllegalPlayerAction implements Runnable
- {
- private static Logger _logAudit = Logger.getLogger("audit");
-
- private final String _message;
- private final int _punishment;
- private final L2PcInstance _actor;
-
- public static final int PUNISH_BROADCAST = 1;
- public static final int PUNISH_KICK = 2;
- public static final int PUNISH_KICKBAN = 3;
- public static final int PUNISH_JAIL = 4;
-
- public IllegalPlayerAction(L2PcInstance actor, String message, int punishment)
- {
- _message = message;
- _punishment = punishment;
- _actor = actor;
-
- switch (punishment)
- {
- case PUNISH_KICK:
- _actor.sendMessage("You will be kicked for illegal action, GM informed.");
- break;
- case PUNISH_KICKBAN:
- if (!_actor.isGM())
- {
- _actor.setAccessLevel(-1);
- _actor.setAccountAccesslevel(-1);
- }
- _actor.sendMessage("You are banned for illegal action, GM informed.");
- break;
- case PUNISH_JAIL:
- _actor.sendMessage("Illegal action performed!");
- _actor.sendMessage("You will be teleported to GM Consultation Service area and jailed.");
- break;
- }
- }
-
- @Override
- public void run()
- {
- LogRecord record = new LogRecord(Level.INFO, "AUDIT:" + _message);
- record.setLoggerName("audit");
- record.setParameters(new Object[]
- {
- _actor,
- _punishment
- });
- _logAudit.log(record);
-
- AdminTable.getInstance().broadcastMessageToGMs(_message);
- if (!_actor.isGM())
- {
- switch (_punishment)
- {
- case PUNISH_BROADCAST:
- return;
- case PUNISH_KICK:
- _actor.logout(false);
- break;
- case PUNISH_KICKBAN:
- PunishmentManager.getInstance().startPunishment(new PunishmentTask(_actor.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, System.currentTimeMillis() + (Config.DEFAULT_PUNISH_PARAM * 1000), _message, getClass().getSimpleName()));
- break;
- case PUNISH_JAIL:
- PunishmentManager.getInstance().startPunishment(new PunishmentTask(_actor.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + (Config.DEFAULT_PUNISH_PARAM * 1000), _message, getClass().getSimpleName()));
- break;
- }
- }
- }
- }
|