diff --git a/pom.xml b/pom.xml index c8cd7aa..96cbc70 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 pw.yumc MiaoScript - 1.1.3 + 1.1.4 502647092 diff --git a/src/main/resources/bios.js b/src/main/resources/bios.js index 58c60ed..6eef615 100644 --- a/src/main/resources/bios.js +++ b/src/main/resources/bios.js @@ -1,4 +1,5 @@ 'use strict'; +var log = base.getLog().static; var boot; var disable; /** diff --git a/src/main/resources/core/console.js b/src/main/resources/core/console.js index 398c62c..f4c8438 100644 --- a/src/main/resources/core/console.js +++ b/src/main/resources/core/console.js @@ -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); diff --git a/src/main/resources/plugins/MiaoTag.js b/src/main/resources/plugins/MiaoTag.js index 21f7763..371f1fc 100644 --- a/src/main/resources/plugins/MiaoTag.js +++ b/src/main/resources/plugins/MiaoTag.js @@ -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)); }