style: formatting code
This commit is contained in:
parent
c2c17a46d4
commit
ccdbd8b683
@ -17,7 +17,7 @@ var itemConfig;
|
||||
|
||||
function load() {
|
||||
var itemFile = self.file('item.yml');
|
||||
task.async(function () {
|
||||
task.async(function() {
|
||||
if (!itemFile.exists()) {
|
||||
fs.save(itemFile, http.get('https://data.yumc.pw/config/Item_zh_CN.yml'))
|
||||
}
|
||||
@ -28,10 +28,10 @@ function load() {
|
||||
function enable() {
|
||||
switch (DetectServerType) {
|
||||
case ServerType.Bukkit:
|
||||
event.on(self, 'ItemMergeEvent', function (event) {
|
||||
event.on(self, 'ItemMergeEvent', function(event) {
|
||||
bukkit(event.target, event.entity.itemStack.amount + event.target.itemStack.amount);
|
||||
});
|
||||
event.on(self, 'ItemSpawnEvent', function (event) {
|
||||
event.on(self, 'ItemSpawnEvent', function(event) {
|
||||
if (event.entity.itemStack) {
|
||||
bukkit(event.entity, event.entity.itemStack.amount);
|
||||
}
|
||||
@ -39,11 +39,11 @@ function enable() {
|
||||
break;
|
||||
case ServerType.Sponge:
|
||||
Keys = Java.type('org.spongepowered.api.data.key.Keys');
|
||||
event.on(self, 'ItemMergeItemEvent', function (event) {
|
||||
event.on(self, 'ItemMergeItemEvent', function(event) {
|
||||
// Sponge 暂未实现当前事件
|
||||
});
|
||||
event.on(self, 'SpawnEntityEvent', function (event) {
|
||||
event.entities.forEach(function (entity) {
|
||||
event.on(self, 'SpawnEntityEvent', function(event) {
|
||||
event.entities.forEach(function(entity) {
|
||||
if (entity.type.name === "item") sponge(entity);
|
||||
})
|
||||
});
|
||||
|
@ -59,12 +59,12 @@ function enable() {
|
||||
return ['reload'];
|
||||
}
|
||||
});
|
||||
bukkit.players(function (p) fakeTag.set(p));
|
||||
event.on(self, 'PlayerJoin', function (event) fakeTag.set(event.player));
|
||||
var entityUpdate = function (event) {
|
||||
bukkit.players(function(p) { fakeTag.set(p) });
|
||||
event.on(self, 'PlayerJoin', function(event) { fakeTag.set(event.player) });
|
||||
var entityUpdate = function(event) {
|
||||
var player = event.entity || event.player;
|
||||
if (player instanceof org.bukkit.entity.Player) {
|
||||
setTimeout(function () {
|
||||
setTimeout(function() {
|
||||
fakeTag.update(player);
|
||||
}, 1);
|
||||
}
|
||||
@ -108,18 +108,18 @@ function FakeTag(name) {
|
||||
player.handle.playerConnection.sendPacket(p);
|
||||
}
|
||||
|
||||
this.set = function (player) {
|
||||
this.set = function(player) {
|
||||
sendPacket(player, cache.objective);
|
||||
sendPacket(player, cache.display);
|
||||
this.update(player);
|
||||
};
|
||||
|
||||
this.update = function (player) {
|
||||
this.update = function(player) {
|
||||
var score = mainScoreboard.getPlayerScoreForObjective(player.name, objective);
|
||||
score.setScore(player.getHealth());
|
||||
var scorePack = new PacketPlayOutScoreboardScore(score);
|
||||
//把其他玩家缓存的包发给这个玩家
|
||||
bukkit.players(function (t) {
|
||||
bukkit.players(function(t) {
|
||||
sendPacket(t, scorePack);
|
||||
if (t.name !== player.name) {
|
||||
var outher = mainScoreboard.getPlayerScoreForObjective(t.name, objective);
|
||||
@ -129,7 +129,7 @@ function FakeTag(name) {
|
||||
});
|
||||
};
|
||||
|
||||
this.disable = function () {
|
||||
this.disable = function() {
|
||||
// 注销tag对象
|
||||
mainScoreboard.unregisterObjective(objective);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user