Stop attacking admin when using invisible.
Contributed by facab.
This commit is contained in:
		@@ -19,6 +19,7 @@ package handlers.admincommandhandlers;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.StringTokenizer;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
 | 
			
		||||
import com.l2jmobius.gameserver.enums.Movie;
 | 
			
		||||
import com.l2jmobius.gameserver.enums.Team;
 | 
			
		||||
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
 | 
			
		||||
@@ -125,6 +126,16 @@ public class AdminEffects implements IAdminCommandHandler
 | 
			
		||||
				activeChar.setInvisible(true);
 | 
			
		||||
				activeChar.broadcastUserInfo();
 | 
			
		||||
				activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar));
 | 
			
		||||
				L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target ->
 | 
			
		||||
				{
 | 
			
		||||
					if ((target != null) && (target.getTarget() == activeChar))
 | 
			
		||||
					{
 | 
			
		||||
						target.setTarget(null);
 | 
			
		||||
						target.abortAttack();
 | 
			
		||||
						target.abortCast();
 | 
			
		||||
						target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
				BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen.");
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
@@ -144,6 +155,16 @@ public class AdminEffects implements IAdminCommandHandler
 | 
			
		||||
			activeChar.setInvisible(true);
 | 
			
		||||
			activeChar.broadcastUserInfo();
 | 
			
		||||
			activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar));
 | 
			
		||||
			L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target ->
 | 
			
		||||
			{
 | 
			
		||||
				if ((target != null) && (target.getTarget() == activeChar))
 | 
			
		||||
				{
 | 
			
		||||
					target.setTarget(null);
 | 
			
		||||
					target.abortAttack();
 | 
			
		||||
					target.abortCast();
 | 
			
		||||
					target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
			BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen.");
 | 
			
		||||
		}
 | 
			
		||||
		else if (command.startsWith("admin_vis"))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user