23
23
24
24
public class SpeedPaths extends JavaPlugin implements Listener {
25
25
26
- private float SPEED_MODIFIER ;
26
+ private int SPEED_AMPLIFIER ;
27
+ private int SPEED_DURATION ;
27
28
private List <UUID > ON_PATH = new ArrayList <>();
28
29
29
30
@ Override
@@ -32,7 +33,9 @@ public void onEnable() {
32
33
33
34
saveDefaultConfig ();
34
35
35
- SPEED_MODIFIER = (float ) getConfig ().getDouble ("speed-modifier" , 0 );
36
+ SPEED_AMPLIFIER = getConfig ().getInt ("speed-amplifier" , 0 );
37
+ SPEED_DURATION = getConfig ().getInt ("speed-duration" , 30 );
38
+
36
39
}
37
40
38
41
@ SuppressWarnings ("deprecation" )
@@ -41,10 +44,10 @@ public void onPlayerMove(PlayerMoveEvent e) {
41
44
Block below = e .getPlayer ().getLocation ().getBlock ();
42
45
if (below != null && below .getType () == Material .GRASS_PATH ) {
43
46
ON_PATH .add (e .getPlayer ().getUniqueId ());
44
- e .getPlayer ().addPotionEffect (new PotionEffect (PotionEffectType .SPEED , 30 , 0 ));
47
+ e .getPlayer ().addPotionEffect (new PotionEffect (PotionEffectType .SPEED , SPEED_DURATION , SPEED_AMPLIFIER ));
45
48
} else if (e .getPlayer ().isOnGround () && ON_PATH .contains (e .getPlayer ().getUniqueId ())){
46
49
ON_PATH .remove (e .getPlayer ().getUniqueId ());
47
- e .getPlayer ().addPotionEffect (new PotionEffect (PotionEffectType .SPEED , 1 , 0 ));
50
+ e .getPlayer ().addPotionEffect (new PotionEffect (PotionEffectType .SPEED , 1 , SPEED_AMPLIFIER ));
48
51
}
49
52
}
50
53
}
0 commit comments