AfkTerminator API

The AFK Terminator comes with three simple API functions to integrate the plugin with other AFK related tools.

To use this API:
1. Place the AfKTerminator.jar into the JAVA build path for your bukkit project.
2. Import the AfkTerminatorAPI in the JAVA class files that are to be interfaced:

> import me.edge209.afkTerminator.AfkTerminatorAPI;

3. Use one of the three calls:

a. See if a player is suspected of using an AFK Machine. This will return 'true' if the player's activity is indicative of an AFK Machine, but not all conditions of an AFK machine are confirmed. This will happen within two times the "AFK" detection setting for the AfkTerminator.

	/**
	 * isAFKMachineSuspected
	 * 
	 * This function will return true if the player is suspected of having an AFK Machine.
	 * If suspected, the player could considered AFK, but it more likely than not that he is NOT AFK
	 * 
	 * @param uuid
	 * @return Boolean (True/False)
	 */
	
	public static boolean isAFKMachineSuspected(UUID uuid) {
		return (AfkDetect.isAFKMachineSuspected(uuid));
	}


b. See if use of an AFK machine has been confirmed for a user. This will return 'true' if the player's activity is confirmed to be an AFK Machine by the plugin. This will happen within three times the "AFK" detection setting for the AfkTerminator. If the machine is very large it could take longer.

	/**
	 * isAFKMachineDetected
	 * 
	 * This function will return true if an AFK Machine has been detedted for a player.
	 * If detected, the player should be considered AFK.
	 * 
	 * @param uuid
	 * @return Boolean (True/False)
	 */
	public static boolean isAFKMachineDetected(UUID uuid) {
		return (AfkDetect.isAFKMachineDetected (uuid));
	}

c. If a machine is suspected or later detected find out the time stamp of when the player is thought to have started using the machine. This is expressed in milliseconds, as measured from the java epoch of Jan 1, 1970.

	/**
	 * getAFKMachineStartTime
	 * 
	 * This function will return the timestamp (in milliseconds since the JAVA Epoch of Jan 1, 1970) that
	 * it suspects a player entered an AFK Machine
	 * 
	 * @param uuid
	 * @return
	 */
	public static long getAFKMachineStartTime(UUID uuid) {
		return(AfkDetect.getAFKMachineStartTime(uuid));
	}

Note: The previous versions of these function calls that use 'player name' instead of 'uuid' as the passed parameter have been deprecated. These will still function in v2.0.0, but compatibility and correct function with Bukkit v1.7 and later is not guaranteed.


Comments

Posts Quoted:
Reply
Clear All Quotes