Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Report.java (revision 3)
- +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Report.java (working copy)
- +package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
- +
- +import java.util.HashMap;
- +import java.util.Map;
- +import java.util.concurrent.TimeUnit;
- +
- +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
- +import net.sf.l2j.gameserver.instancemanager.BotsPreventionManager;
- +import net.sf.l2j.gameserver.instancemanager.PetitionManager;
- +import net.sf.l2j.gameserver.model.actor.instance.Player;
- +import net.sf.l2j.gameserver.network.clientpackets.Say2;
- +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- +
- +public class Report implements IVoicedCommandHandler
- +{
- +
- + private static Map<Integer, Long> _holder = new HashMap<>();
- +
- + private static final String[] _voicedCommands =
- + {
- + "report"
- + };
- +
- + @Override
- + public boolean useVoicedCommand(String command, Player activeChar, String target)
- + {
- +
- + final Player bot = activeChar.getTarget().getActingPlayer();
- +
- + final long action = getLastAction(activeChar.getObjectId());
- +
- + if (action >= System.currentTimeMillis())
- + {
- + activeChar.sendMessage("You have to wait " + TimeUnit.MILLISECONDS.toMinutes(action - System.currentTimeMillis()) + " minutes.");
- + }
- + else if (!(activeChar.getTarget() instanceof Player))
- + {
- + activeChar.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "System", "You need to target a player!"));
- + }
- + else if ((bot == null) || (activeChar.getTarget().getObjectId() == activeChar.getObjectId()))
- + {
- + activeChar.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "System", "You can't report yourself!"));
- + }
- + else if (!bot.isInCombat() || bot.getPvpFlag() != 0 || bot.isInDuel())
- + {
- + activeChar.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "System", "This player is not botting!"));
- + }
- + else
- + {
- + activeChar.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "System", "Report has been sent!"));
- + activeChar.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "System", "Captcha has been sent!"));
- +
- + addAction(activeChar.getObjectId());
- +
- + /** Sent Capctha */
- + BotsPreventionManager.getInstance().validationtasks(bot);
- +
- + PetitionManager.getInstance().submitPetition(activeChar, "| User: "+bot.getName()+" | might be botting! You need to check him!", 1);
- + }
- + return true;
- + }
- +
- + static long getLastAction(int objectId)
- + {
- + return _holder.containsKey(objectId) ? _holder.get(objectId) : 0;
- + }
- +
- + static void addAction(int objectId)
- + {
- + _holder.put(objectId, System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(15));
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return _voicedCommands;
- + }
- +}
- --- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java (revision 3)
- +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java (working copy)
- package net.sf.l2j.gameserver.handler;
- import java.util.HashMap;
- import java.util.Map;
- + import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Report;
- protected VoicedCommandHandler()
- {
- + registerHandler(new Report());
- }
Add Comment
Please, Sign In to add comment