style: 格式化代码

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2017-11-15 21:00:07 +08:00
parent 612d4ee856
commit dc716dc87c
7 changed files with 43 additions and 38 deletions

View File

@ -18,7 +18,7 @@
var yaml = require('modules/yaml'); var yaml = require('modules/yaml');
Object.prototype.toYaml = function () { Object.prototype.toYaml = function () {
return yaml.safeDump(this); return yaml.safeDump(this);
} };
/** /**
* 日期格式化 * 日期格式化

View File

@ -6,7 +6,8 @@ var global = this;
// noinspection JSUnusedLocalSymbols // noinspection JSUnusedLocalSymbols
global.init = function init(root) { global.init = function init(root) {
global.root = root; global.root = root;
global.noop = function () {}; global.noop = function () {
};
loadCore(); loadCore();
loadRequire(); loadRequire();
try { try {
@ -17,7 +18,7 @@ var global = this;
console.console("§4初始化插件基础系统库错误:§c", ex); console.console("§4初始化插件基础系统库错误:§c", ex);
console.ex(ex); console.ex(ex);
} }
} };
/** /**
* 初始化核心 * 初始化核心

View File

@ -79,7 +79,8 @@ function on(jsp, name, exec) {
console.console('§6玩家 §a%s §6执行 §b%s §6插件 §d%s %s §6命令时发生异常 §4%s'.format(sender.name, jsp.description.name, command, Java.from(args).join(' '), ex)); console.console('§6玩家 §a%s §6执行 §b%s §6插件 §d%s %s §6命令时发生异常 §4%s'.format(sender.name, jsp.description.name, command, Java.from(args).join(' '), ex));
console.ex(ex); console.ex(ex);
} }
}})); }
}));
} }
if (exec.tab) { if (exec.tab) {
// 必须指定需要实现的接口类型 否则MOD服会报错 // 必须指定需要实现的接口类型 否则MOD服会报错
@ -94,7 +95,8 @@ function on(jsp, name, exec) {
console.console('§6玩家 §a%s §6执行 §b%s §6插件 §d%s %s §6补全时发生异常 §4%s'.format(sender.name, jsp.description.name, command, Java.from(args).join(' '), ex)); console.console('§6玩家 §a%s §6执行 §b%s §6插件 §d%s %s §6补全时发生异常 §4%s'.format(sender.name, jsp.description.name, command, Java.from(args).join(' '), ex));
console.ex(ex); console.ex(ex);
} }
}})); }
}));
} }
} }

View File

@ -17,7 +17,7 @@ var Material = Java.type('org.bukkit.Material');
*/ */
item.create = function () { item.create = function () {
var idOrType = arguments[0]; var idOrType = arguments[0];
if (isNaN(new Number(idOrType))) { if (isNaN(Number(idOrType))) {
idOrType = Material[idOrType]; idOrType = Material[idOrType];
} }
switch (arguments.length) { switch (arguments.length) {
@ -87,7 +87,9 @@ item.setName = function (item, name) {
item.setLore = item.setLores = function (item, lores) { item.setLore = item.setLores = function (item, lores) {
if (item.getType().name() !== "AIR") { if (item.getType().name() !== "AIR") {
var meta = item.hasItemMeta() ? item.getItemMeta() : Bukkit.getItemFactory().getItemMeta(item.getType()); var meta = item.hasItemMeta() ? item.getItemMeta() : Bukkit.getItemFactory().getItemMeta(item.getType());
if (typeof(lores) === 'string') { lores = lores.split("\n") }; if (typeof(lores) === 'string') {
lores = lores.split("\n")
}
meta.setLore(lores); meta.setLore(lores);
item.setItemMeta(meta); item.setItemMeta(meta);
} }

View File

@ -20,22 +20,22 @@ var ArrayList = Java.type('java.util.ArrayList');
var Arrays = Java.type('java.util.Arrays'); var Arrays = Java.type('java.util.Arrays');
var SimpleCommandCallable = function () { var SimpleCommandCallable = function () {
this.process = function (source, arguments) { this.process = function (source, args) {
}, };
this.getSuggestions = function (source, arguments, targetPosition) { this.getSuggestions = function (source, args, targetPosition) {
return Arrays.asList(''); return Arrays.asList('');
}, };
this.testPermission = function (source) { this.testPermission = function (source) {
return true; return true;
}, };
this.getShortDescription = function (source) { this.getShortDescription = function (source) {
return Optional.ofNullable(''); return Optional.ofNullable('');
}, };
this.getHelp = function (source) { this.getHelp = function (source) {
} }
} };
function enable(jsp) { function enable(jsp) {
var commands = jsp.description.commands; var commands = jsp.description.commands;