fix: 提前初始化log防止内部异常
This commit is contained in:
parent
2cab200e41
commit
2e679ff8b6
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>pw.yumc</groupId>
|
||||
<artifactId>MiaoScript</artifactId>
|
||||
<version>1.1.3</version>
|
||||
<version>1.1.4</version>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>502647092</id>
|
||||
|
@ -1,4 +1,5 @@
|
||||
'use strict';
|
||||
var log = base.getLog().static;
|
||||
var boot;
|
||||
var disable;
|
||||
/**
|
||||
|
@ -2,7 +2,6 @@
|
||||
* 控制台输出类
|
||||
*/
|
||||
/*global base*/
|
||||
var log = base.getLog().static;
|
||||
(function(global){
|
||||
var Arrays = Java.type('java.util.Arrays');
|
||||
var Level = Java.type('java.util.logging.Level');
|
||||
@ -13,6 +12,7 @@ var log = base.getLog().static;
|
||||
}.bind(this),
|
||||
set: function (name) {
|
||||
this._name = name ? '[' + name + '] ' : '';
|
||||
this.prefix = name ? '§6[§b' + name + '§6]§r ' : '';
|
||||
}.bind(this)
|
||||
});
|
||||
this.name = name;
|
||||
@ -29,8 +29,10 @@ var log = base.getLog().static;
|
||||
log.d(this.name + Array.prototype.join.call(arguments, ' '));
|
||||
}
|
||||
this.sender = function () {
|
||||
var sender = arguments[0];
|
||||
if (!(sender instanceof org.bukkit.command.CommandSender)) { console.error("第一个参数未实现 org.bukkit.command.CommandSender 无法发送消息!") }
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
log.sender();
|
||||
sender.sendMessage(this.prefix + args.join(' '));
|
||||
}
|
||||
this.ex = function (ex) {
|
||||
log.console('§4' + ex);
|
||||
|
@ -55,11 +55,8 @@ function enable() {
|
||||
switch (subcommand) {
|
||||
case 'reload':
|
||||
self.reloadConfig();
|
||||
console.sender(sender, "§a配置文件重载完成!", "TEST");
|
||||
break;
|
||||
case 'test':
|
||||
// var IllegalStateException = Java.type("java.lang.IllegalStateException");
|
||||
// throw new IllegalStateException('TEST');
|
||||
throw new TypeError('TEST');
|
||||
}
|
||||
},
|
||||
tab: function tab (sender, command, args){
|
||||
@ -68,14 +65,17 @@ function enable() {
|
||||
})
|
||||
bukkit.players(function (p) fakeTag.set(p));
|
||||
event.on(self, 'PlayerJoin', function (event) fakeTag.set(event.player));
|
||||
event.on(self, 'EntityDamage', function (event) {
|
||||
var entityUpdate = function (event) {
|
||||
var player = event.entity;
|
||||
if(player instanceof org.bukkit.entity.Player){
|
||||
setTimeout(function () {
|
||||
fakeTag.update(player);
|
||||
}, 1);
|
||||
}
|
||||
}, false);
|
||||
};
|
||||
event.on(self, 'EntityRegainHealth', entityUpdate, false);
|
||||
event.on(self, 'EntityDamage', entityUpdate, false);
|
||||
event.on(self, 'EntityRegainHealth', entityUpdate, false);
|
||||
//event.on(this, 'playerquitevent', function quit(event) removeTask(event.player));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user