promotional bannermobile promotional banner
header
Player Activity avatar

Player Activity

Install

Thanks goes to Instinx who requested this mod.
Player Activity is a mod that allows to run commands based on the "Current Offline Time" or the "Total Play Time" of the player.
 

The so called "Effects" get loaded by a json file and will be executed for every single player independently.
Example:

{
	"effects": 
	[
		{
			"ID": "TestID", //The id of the Effect that you want to apply. Has to be unique.
			"Command": "stop", //The Command that should be executed. If NBTData is needed use ' instead of " for the value. (can be a string or string array)
			"TimeUnit": "s", //Time Unit that is used to define the amount of time if it should take. (Valid Values: Nano, micro, milli, second (or "s" for short), minute (or "m" for short), hour (or "h" for short), Days)
			"Time": 20, //How long the desired time before the action is.
			"Saved": true, //If the Mod should remember that it did this. (Resets after a player logged in or out depending if its online or not)
			"Online": true, //If the player is required to be online or offline.
			"Repeat": false //If the commands should be executed every time the timer runs out.
		}
	]
}

 

 As shown in the example.
 "ID" is the id of the holder of the command that is being executed.
 "Command" defines the commands that should be executed (multi command support is included by using a TextArray instead).
 "Time & TimeUnit" define how long it should take at least to run the command (the internal clock for performance reasons runs on a 1200 tick delay but the time is tracked by real time timestamps)
 "Saved" defines if the effect is applied once per login/logout or if it is only once.
 "Online" defines if the player is required to be online or if the player has to be offline to take effect.
 "Repeat" is a different kind of monster.

  • First thing it runs the effect every time the time runs out and resets the time for that player. 

  • Second it won't run if the player already had run the effect, but it won't add itself the "HasAlreadyRun" flag. 

  • Third: If you give the "HasAlreadyRun" flag via the command and saved is disabled it will reset the flag everytime the player relogs automatically. 

  • Fourth: Repeat only works on "Online = true"

This covers half of the mod.

The other half is basically a oredictionary clone but for effects.
The "Tag" System which allows you to group "effects" into a list which then can be used in commands to give/take effects from a player faster.
Its basically a convenience feature with a tiny extra.
Example:

{
	"tags": 
	[
		{
			"Tag": "TestTag", //ID of the tag. Has to be unique.
			"ID": ["TestID"], //ID of the Effects that it should handle. (Can be a String or String array)
			"Default": true //If the tag should be autoapplied on the first login of a player.
		}
	]
}

 As this example shows. Tags are made out of 3 things.
 "Tag" which is the unique id of the tag that is also being used in the "add/removeTag" command.
 "ID" which is the list of effects that it should apply/remove from the player
 "Default" which if set to true automatically applies this tag to the player if he logs in for the first time. (and only the first time)
 
Like the oredictionary effects can be in as many tags as you want. They are not limited to 1 tag.
Which should allow to reduce amount of commands being thown by a lot.

Last but not least here is the commands:

  •  "/playerActivity help" shows all the commands + a simple explanation for each command.

  • "/playerActivity reload" reloads the json file within the game. No restart required and the optional command block support gets also updated.
  • "/playerActivity addData PlayerName EffectID"  adds a effect to a player so it counts as if the player already had executed the effec. (It won't trigger the effect)
  • "/playerActivity removeData PlayerName EffectID" removes a effect from a Player so it counts as if the player has never executed the effect.
  • "/playerActivity addTag PlayerName TagID" adds all the Effects to a Player that the tag contains. (TL:DR MassAddData command same rules apply)
  • "/playerActivity removeTag PlayerName TagID" removes all the Effects from a Player that the tag contains.
  • "/playerActivity PlayTime PlayerName" shows the Total Play Time of the player on that world.
  • "/playerActivity offlineTime PlayerName" shows the Offline Time of the player since the last Logout.

Misc info:

The Mod autogenerates the Json/Config file automatically.

Also AutoComplete is a thing in any of my mods so make sure you use it!

 

Modpack Permissions:
The Mod is on curse, so as long the modpack is on curse or TechnicPack you can use it as you wish.