fix: 修复主线程加载的BUG
This commit is contained in:
parent
fe6d0e7250
commit
54b5909875
@ -1,15 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
/*global Java, base, module, exports, require*/
|
/*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 server = require('api/server');
|
||||||
|
var event = require('api/event');
|
||||||
|
var task = require('api/task');
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
var nameMap = [];
|
|
||||||
|
|
||||||
var description = {
|
var description = {
|
||||||
name: 'ItemTag',
|
name: 'ItemTag',
|
||||||
version: '1.0',
|
version: '1.0',
|
||||||
@ -20,10 +17,12 @@ var itemConfig;
|
|||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
var itemFile = self.file('item.yml');
|
var itemFile = self.file('item.yml');
|
||||||
|
task.async(function () {
|
||||||
if (!itemFile.exists()) {
|
if (!itemFile.exists()) {
|
||||||
base.save(itemFile, http.get('https://data.yumc.pw/config/Item_zh_CN.yml'));
|
fs.save(itemFile, http.get('https://data.yumc.pw/config/Item_zh_CN.yml'))
|
||||||
}
|
}
|
||||||
itemConfig = self.getConfig('item.yml');
|
itemConfig = self.getConfig('item.yml')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function enable() {
|
function enable() {
|
||||||
@ -62,7 +61,7 @@ function bukkit(item , amount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sponge(entity) {
|
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()) {
|
if (itemOptional.isPresent()) {
|
||||||
var item = itemOptional.get();
|
var item = itemOptional.get();
|
||||||
var amounts = item.count == 1 ? "" : "*" + item.count;
|
var amounts = item.count == 1 ? "" : "*" + item.count;
|
||||||
|
Loading…
Reference in New Issue
Block a user