From ccdbd8b683b2e29bf70257311e068dbd8227269d Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Sat, 23 Feb 2019 16:00:53 +0000 Subject: [PATCH] style: formatting code --- src/main/resources/plugins/ItemTag.js | 12 ++++++------ src/main/resources/plugins/bukkit/MiaoTag.js | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/resources/plugins/ItemTag.js b/src/main/resources/plugins/ItemTag.js index aee879c..80b2657 100644 --- a/src/main/resources/plugins/ItemTag.js +++ b/src/main/resources/plugins/ItemTag.js @@ -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); }) }); diff --git a/src/main/resources/plugins/bukkit/MiaoTag.js b/src/main/resources/plugins/bukkit/MiaoTag.js index a9540c3..579f779 100644 --- a/src/main/resources/plugins/bukkit/MiaoTag.js +++ b/src/main/resources/plugins/bukkit/MiaoTag.js @@ -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); }