@boem312/minecraft-server
Version:
A pure JS library to create Minecraft Java 1.16.3 servers
25 lines (22 loc) • 643 B
JavaScript
module.exports = {
bossBars: {
info: {
preventSet: true
},
get() {
return this.p.bossBars; // todo: add _ before name. For example: this.p._name
},
set(newValue) {
const oldValue = [...this.bossBars];
this.p.bossBars = newValue;
const changed =
newValue.length !== oldValue.length ||
newValue.some((a, i) => a !== oldValue[i]);
if (changed)
this.p.emitChange('bossBars', oldValue);
},
init() {
this.p.bossBars = Object.freeze([]);
}
}
}