Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.l2jfrozen.gameserver.model.actor.instance;
- import java.util.concurrent.ScheduledFuture;
- import com.l2jfrozen.gameserver.model.L2Character;
- import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
- import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
- /**
- *
- *
- * @author Token
- */
- public class L2NoobProtectionInstance extends L2FolkInstance
- {
- private ScheduledFuture<?> _aiTask;
- public class ProtectorAI implements Runnable
- {
- @Override
- public void run()
- {
- for(L2PcInstance player : getKnownList().getKnownPlayers().values())
- {
- if(player.getKarma() > 0)
- {
- sendToJail(player);
- }
- }
- }
- private void sendToJail(L2PcInstance player)
- {
- if(player.isGM() || player.isDead() || !isInsideRadius(player, 5000, false, false))
- return ;
- if (player != null)
- {
- player.setPunishLevel(L2PcInstance.PunishLevel.JAIL, 5);
- player.sendMessage("Voce vai ficar na jail por 5 minutos, por dar pk em iniciantes.");
- if (player.getParty() != null)
- player.getParty().removePartyMember(player);
- }
- }
- }
- public L2NoobProtectionInstance(int objectId, L2NpcTemplate template)
- {
- super(objectId, template);
- if(_aiTask != null)
- {
- _aiTask.cancel(true);
- }
- _aiTask = ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new ProtectorAI(), 3000, 3000);
- }
- @Override
- public void deleteMe()
- {
- if(_aiTask != null)
- {
- _aiTask.cancel(true);
- _aiTask = null;
- }
- super.deleteMe();
- }
- @Override
- public boolean isAutoAttackable(L2Character attacker)
- {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement