-
Notifications
You must be signed in to change notification settings - Fork 5
/
gamemode.js
49 lines (42 loc) · 1.82 KB
/
gamemode.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
// Changes the gamemode to the provided one
// To get the current gamemode /ts gamemode
// To change the gamemode /ts gamemode <survival|pvp|attack|sandbox>
// Note: only the first two (or one for pvp and attack) letters matter
(function(){
const args = parseArguments(argument);
if (args.length === 0) return "[#85C1E9]Current gamemode is [#A9CCE3]" + Vars.state.rules.mode().name();
let newGamemode = args[0].length === 1 ? args[0] : args[0].slice(0, 2)
switch (newGamemode.toLowerCase()) {
case 'sa':
Vars.state.rules.infiniteResources = true;
Vars.state.rules.attackMode = false;
Vars.state.rules.waves = true;
Vars.state.rules.pvp = false;
Call.setRules(Vars.state.rules);
return "[#85C1E9]Gamemode set to [#A9CCE3]sandbox"
case 'su':
Vars.state.rules.infiniteResources = false;
Vars.state.rules.attackMode = false;
Vars.state.rules.waves = true;
Vars.state.rules.pvp = false;
Call.setRules(Vars.state.rules);
return "[#85C1E9]Gamemode set to [#A9CCE3]survival"
case 'a':
case 'at':
Vars.state.rules.infiniteResources = false;
Vars.state.rules.attackMode = true;
Vars.state.rules.waves = false;
Vars.state.rules.pvp = false;
Call.setRules(Vars.state.rules);
return "[#85C1E9]Gamemode set to [#A9CCE3]attack"
case 'p':
case 'pv':
Vars.state.rules.infiniteResources = false;
Vars.state.rules.attackMode = false;
Vars.state.rules.waves = false;
Vars.state.rules.pvp = true;
Call.setRules(Vars.state.rules);
return "[#85C1E9]Gamemode set to [#A9CCE3]pvp"
}
return "[#EB984E]Invalid Gamemode"
})();