From 54b5909875c48c231050b704dbd7e01425fac46a Mon Sep 17 00:00:00 2001 From: coding Date: Wed, 10 Jan 2018 12:59:29 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=BB=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E5=8A=A0=E8=BD=BD=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/plugins/ItemTag.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/resources/plugins/ItemTag.js b/src/main/resources/plugins/ItemTag.js index 4275ff1..cc1f657 100644 --- a/src/main/resources/plugins/ItemTag.js +++ b/src/main/resources/plugins/ItemTag.js @@ -1,15 +1,12 @@ 'use strict'; /*global Java, base, module, exports, require*/ -var event = require('api/event'); -var wrapper = require('api/wrapper'); -var command = require('api/command'); var server = require('api/server'); +var event = require('api/event'); +var task = require('api/task'); var http = require('http'); var fs = require('fs'); -var nameMap = []; - var description = { name: 'ItemTag', version: '1.0', @@ -20,10 +17,12 @@ var itemConfig; function load() { var itemFile = self.file('item.yml'); - if (!itemFile.exists()) { - base.save(itemFile, http.get('https://data.yumc.pw/config/Item_zh_CN.yml')); - } - itemConfig = self.getConfig('item.yml'); + task.async(function () { + if (!itemFile.exists()) { + fs.save(itemFile, http.get('https://data.yumc.pw/config/Item_zh_CN.yml')) + } + itemConfig = self.getConfig('item.yml') + }) } function enable() { @@ -62,7 +61,7 @@ function bukkit(item , amount) { } function sponge(entity) { - var itemOptional = entity.get(Keys.REPRESENTED_ITEM); + var itemOptional = entity.get(org.spongepowered.api.data.key.Keys.REPRESENTED_ITEM); if (itemOptional.isPresent()) { var item = itemOptional.get(); var amounts = item.count == 1 ? "" : "*" + item.count;