forked from JaylyDev/ScriptAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (31 loc) · 702 Bytes
/
index.js
File metadata and controls
34 lines (31 loc) · 702 Bytes
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
// Script example for ScriptAPI
// Author: FrankyRayMS <https://github.com/FrankyRay>
// Project: https://github.com/JaylyDev/ScriptAPI
import {
/* Typings only */
Entity,
Player,
Effect,
EffectType,
EffectTypes
} from "@minecraft/server";
/**
* Get every effect from the entity
*
* @param {Entity|Player} entity
* Entity or Player class
*
* @return {{ effectType: EffectType, effect: Effect }[]}
*/
export function getEffects(entity) {
const effectList = [];
for (const eff of EffectTypes.getAll()) {
const effect = entity.getEffect(eff);
if (!effect) continue;
effectList.push({
effectType: eff,
effect: effect
});
};
return effectList;
};