This repository has been archived by the owner on Jan 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 710
/
Copy pathPotionsPE_tombailey94.js
58 lines (53 loc) · 1.77 KB
/
PotionsPE_tombailey94.js
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
//Potions PE mod by tombailey94
//version 0.0.1
function procCmd(cmd) {
var cmd = cmd.toLowerCase().split(" ");
if (cmd[0] == "potion") {
var player = Player.getEntity();
var ticks = 300*20; //3 minutes
if (cmd[2] != null && !isNaN(parseInt(cmd[2]))) {
ticks = parseInt(cmd[2]*20);
}
var amplification = 5;
if (cmd[3] != null && !isNaN(parseInt(cmd[3]))) {
amplification = parseInt(cmd[3]);
}
switch (cmd[1]) {
case "sprint":
Entity.addEffect(player, MobEffect.movementSpeed, ticks, amplification, false, false);
break;
case "crawl":
Entity.addEffect(player, MobEffect.movementSlowdown, ticks, amplification, false, false);
break;
case "jump":
Entity.addEffect(player, MobEffect.jump, ticks, amplification, false, false);
break;
case "wither":
Entity.addEffect(player, MobEffect.wither, ticks, amplification, false, false);
break;
case "regen":
Entity.addEffect(player, MobEffect.regeneration, ticks, amplification, false, false);
break;
case "heal":
Entity.addEffect(player, MobEffect.heal, ticks, amplification, false, false);
break;
case "water":
Entity.addEffect(player, MobEffect.waterBreathing, ticks, amplification, false, false);
break;
case "fire":
Entity.addEffect(player, MobEffect.fireResistance, ticks, amplification, false, false);
break;
case "invisible":
Entity.addEffect(player, MobEffect.invisibility, ticks, amplification, false, false);
break;
case "night":
Entity.addEffect(player, MobEffect.nightVision, ticks, amplification, false, false);
break;
case "remove":
Entity.removeAllEffects(player);
break;
default:
clientMessage("Effect unknown, try sprint, crawl, jump, wither, regen, health, water, fire, invisible or remove.");
}
}
}