summaryrefslogtreecommitdiffstats
path: root/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingConfig.java
blob: 54e2834a48c6896c7ed799cd27d0f4f5b22ba3bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.earth2me.essentials.anticheat.checks.moving;

import com.earth2me.essentials.anticheat.ConfigItem;
import com.earth2me.essentials.anticheat.actions.types.ActionList;
import com.earth2me.essentials.anticheat.config.ConfPaths;
import com.earth2me.essentials.anticheat.config.NoCheatConfiguration;
import com.earth2me.essentials.anticheat.config.Permissions;


/**
 * Configurations specific for the Move Checks. Every world gets one of these assigned to it.
 *
 */
public class MovingConfig implements ConfigItem
{
	public final boolean runflyCheck;
	public final boolean identifyCreativeMode;
	public final double walkingSpeedLimit;
	public final double sprintingSpeedLimit;
	public final double jumpheight;
	public final double swimmingSpeedLimit;
	public final boolean sneakingCheck;
	public final double sneakingSpeedLimit;
	public final ActionList actions;
	public final boolean allowFlying;
	public final double flyingSpeedLimitVertical;
	public final double flyingSpeedLimitHorizontal;
	public final ActionList flyingActions;
	public final boolean nofallCheck;
	public final boolean nofallaggressive;
	public final float nofallMultiplier;
	public final ActionList nofallActions;
	public final boolean morePacketsCheck;
	public final ActionList morePacketsActions;
	public final int flyingHeightLimit;

	public MovingConfig(NoCheatConfiguration data)
	{

		identifyCreativeMode = data.getBoolean(ConfPaths.MOVING_RUNFLY_FLYING_ALLOWINCREATIVE);

		runflyCheck = data.getBoolean(ConfPaths.MOVING_RUNFLY_CHECK);

		int walkspeed = data.getInt(ConfPaths.MOVING_RUNFLY_WALKSPEED, 100);
		int sprintspeed = data.getInt(ConfPaths.MOVING_RUNFLY_SPRINTSPEED, 100);
		int swimspeed = data.getInt(ConfPaths.MOVING_RUNFLY_SWIMSPEED, 100);
		int sneakspeed = data.getInt(ConfPaths.MOVING_RUNFLY_SNEAKSPEED, 100);
		walkingSpeedLimit = (0.22 * walkspeed) / 100D;
		sprintingSpeedLimit = (0.35 * sprintspeed) / 100D;
		swimmingSpeedLimit = (0.18 * swimspeed) / 100D;
		sneakingSpeedLimit = (0.14 * sneakspeed) / 100D;
		jumpheight = ((double)135) / 100D;

		sneakingCheck = !data.getBoolean(ConfPaths.MOVING_RUNFLY_ALLOWFASTSNEAKING);
		actions = data.getActionList(ConfPaths.MOVING_RUNFLY_ACTIONS, Permissions.MOVING_RUNFLY);

		allowFlying = data.getBoolean(ConfPaths.MOVING_RUNFLY_FLYING_ALLOWALWAYS);
		flyingSpeedLimitVertical = ((double)data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_SPEEDLIMITVERTICAL)) / 100D;
		flyingSpeedLimitHorizontal = ((double)data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_SPEEDLIMITHORIZONTAL)) / 100D;
		flyingHeightLimit = data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_HEIGHTLIMIT);
		flyingActions = data.getActionList(ConfPaths.MOVING_RUNFLY_FLYING_ACTIONS, Permissions.MOVING_FLYING);

		nofallCheck = data.getBoolean(ConfPaths.MOVING_RUNFLY_CHECKNOFALL);
		nofallMultiplier = ((float)200) / 100F;
		nofallaggressive = data.getBoolean(ConfPaths.MOVING_RUNFLY_NOFALLAGGRESSIVE);
		nofallActions = data.getActionList(ConfPaths.MOVING_RUNFLY_NOFALLACTIONS, Permissions.MOVING_NOFALL);

		morePacketsCheck = data.getBoolean(ConfPaths.MOVING_MOREPACKETS_CHECK);
		morePacketsActions = data.getActionList(ConfPaths.MOVING_MOREPACKETS_ACTIONS, Permissions.MOVING_MOREPACKETS);
	}
}