Jump to content

Attempt to pass code as his own.. Proof included


Recommended Posts

Posted
- If you are not the owner of the share, please add the proper Credits, or else you'll be smitted.

 

http://maxcheaters.com/forum/index.php?topic=254815.0

This system kicks players after #### seconds (adjust the time in the code) when they are on TvT. Works perfectly on Freya (didnt test on High Five).

 

 

You can download it here.

 

Code looks like:

package custom.AntiAfk;

import java.util.ArrayList;
import java.util.logging.Logger;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.entity.TvTEventTeam;

/** 
*
* @author KnipeX
*/

public class AntiAfkTvt
{
    // Debug
    private static boolean debug = false;
    // Delay between location checks , Default 60000 ms (1 minute)
    private final int CheckDelay = 30000;
   
    private static Logger _log = Logger.getLogger(AntiAfkTvt.class.getName());
private static ArrayList<String> TvTPlayerList = new ArrayList<String>();
private static String[] Splitter;
private static int xx,yy,zz,SameLoc;
private static L2PcInstance _player;

   private AntiAfkTvt()
   {
       _log.info("AntiAfkTvt: Auto-Kick AFK in TVT System initiated.");
       ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AntiAfk(), 60000, CheckDelay);
   }

   private class AntiAfk implements Runnable
   {
       public void run()
       {
     	  if (TvTEvent.isStarted())
     	  {
     		  // Iterate over all teams
     		  for (TvTEventTeam team : TvTEvent._teams)
     		  {
     			  // Iterate over all participated player instances in this team
     			  for (L2PcInstance playerInstance : team.getParticipatedPlayers().values())
     			  {
     				  if (playerInstance != null && playerInstance.isOnline())
     				  {
     					  _player = playerInstance;
     					  AddTvTSpawnInfo(playerInstance.getName(),playerInstance.getX(),playerInstance.getY(),playerInstance.getZ());
     					  if (debug)
     						  System.err.println("TvT Player: " + playerInstance.getName() + " " + playerInstance.getX() + " " +  playerInstance.getY() + " " +  playerInstance.getZ());
     				  }
     			  }
     		  }
     	  }
     	  else
     	  {
     		  TvTPlayerList.clear();
     	  }
       }
   }
   
private static void AddTvTSpawnInfo(String name, int _x, int _y, int _z)
{
	if(!CheckTvTSpawnInfo(name))
	{
		String temp = name + ":" + Integer.toString(_x) + ":" + Integer.toString(_y) + ":" + Integer.toString(_z) + ":1";
		TvTPlayerList.add(temp);
	}
	else
	{
        Object[] elements = TvTPlayerList.toArray();
        for(int i=0; i < elements.length ; i++)
        {
        	Splitter = ((String) elements[i]).split(":");
        	String nameVal = Splitter[0];
		       if (name.equals(nameVal))
		       {
		    	   GetTvTSpawnInfo(name);
		    	   if (_x == xx && _y == yy && _z == zz && _player.isAttackingNow() == false && _player.isCastingNow() == false && _player.isOnline() == true && _player.isParalyzed() == false)
		    	   {
		    		   ++SameLoc;
		    		   if (SameLoc >= 4)//Kick after 4 same x/y/z, location checks
		    		   {
		    			   //kick here
		    			   TvTPlayerList.remove(i);
		    			   _player.logout();
		    			   return;
		    		   }
		    		   else
		    		   {
		    			   TvTPlayerList.remove(i);
		    			   String temp = name + ":" + Integer.toString(_x) + ":" + Integer.toString(_y) + ":" + Integer.toString(_z) + ":" + SameLoc;
		    			   TvTPlayerList.add(temp);
		    			   return;
		    		   }
		    	   }
		    	   TvTPlayerList.remove(i);
				   String temp = name + ":" + Integer.toString(_x) + ":" + Integer.toString(_y) + ":" + Integer.toString(_z) + ":1";
				   TvTPlayerList.add(temp);
		       }
        }
	}
}

private static boolean CheckTvTSpawnInfo(String name)
{

        Object[] elements = TvTPlayerList.toArray();
        for(int i=0; i < elements.length ; i++)
        {
        	Splitter = ((String) elements[i]).split(":");
        	String nameVal = Splitter[0];
	       if (name.equals(nameVal))
	       {
		       return true;
	       }
        }
        return false;
}

private static void GetTvTSpawnInfo(String name)
{

        Object[] elements = TvTPlayerList.toArray();
        for(int i=0; i < elements.length ; i++)
        {
        	Splitter = ((String) elements[i]).split(":");
        	String nameVal = Splitter[0];
	       if (name.equals(nameVal))
	       {
		       xx = Integer.parseInt(Splitter[1]);
		       yy = Integer.parseInt(Splitter[2]);
		       zz = Integer.parseInt(Splitter[3]);
		       SameLoc = Integer.parseInt(Splitter[4]);
	       }
        }
}

   public static AntiAfkTvt getInstance()
   {
       return SingletonHolder._instance;
   }

   @SuppressWarnings("synthetic-access")
   private static class SingletonHolder
   {
       protected static final AntiAfkTvt _instance = new AntiAfkTvt();
   }

   public static void main(String[] args)
   {
   AntiAfkTvt.getInstance();
   }
}

 

 

 

How to install: Just add on scripts.cfg custom\AntiAfk\AntiAfkTvt.java

 

 

Credits: Me 8)

 

This is NOT his code, all he did was change the credits to him... I am the author of this code. Request to delete it, and smitten him.

 

Proof:

 

http://www.l2jserver.com/forum/viewtopic.php?f=73&t=22166&hilit=tvt+afk

 

Should also have this +1 removed from him:

Really nice share. Tested and work fine. +1 rep for your job my friend. Thank you for share.

Guest
This topic is now closed to further replies.
×
×
  • Create New...