diff --git a/README.md b/README.md
index 4204168..52689d7 100644
--- a/README.md
+++ b/README.md
@@ -76,6 +76,12 @@
- [项目代码](https://git.yumc.pw/502647092/MiaoScript)
- [项目脑图](http://naotu.baidu.com/file/293b9a0fc7cef23c69de81c55e3617d5?token=1eee8fd759198eb7)
+### 规划
+
+- 初期只会支持JS类型的插件开发
+- 二期会出一个建议版本的MS脚本 可以用简单的语法实现简单的功能
+- 各个层级会有依赖控制 比如 `MS脚本 => JS脚本 => 调用Java原生API`
+
### 填坑
- 实际上说了那么多 最终希望的就是 有大佬能一起来填坑 毕竟这个坑太大了
diff --git a/pom.xml b/pom.xml
index 4728383..59965c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
pw.yumc
MiaoScript
- 1.2.0
+ 1.2.1
502647092
@@ -84,12 +84,16 @@
DEV
+ §618-01-09 §afeat: 优化加载流程 完善事件注册
+ §618-01-02 §afeat: 新增http网络访问模块
+ §617-12-28 §afeat: 完善Sponge事件注册 新增player封装类
+
+
§617-11-30 §afeat: 新增Sponge的兼容;
§617-11-03 §afeat: 新增抽奖插件;
§617-10-16 §cfix: 修复关闭MiaoScript时task异常;
§617-10-15 §6alpha: 第一个版本发布;
-
-
+
UTF-8
1.8
1.8
diff --git a/src/main/resources/plugins/HelloWorld.js b/src/main/resources/plugins/HelloWorld.js
index 198b5fd..75d5e2d 100644
--- a/src/main/resources/plugins/HelloWorld.js
+++ b/src/main/resources/plugins/HelloWorld.js
@@ -27,7 +27,7 @@ function load() {
function enable() {
command.on(this, 'hello', {
cmd: function (sender, command, args) {
- global.load(fs.file(root, 'test.js'));
+ engineLoad(fs.file(root, 'test.js'));
return true;
}
});
diff --git a/src/main/resources/plugins/ItemTag.js b/src/main/resources/plugins/ItemTag.js
new file mode 100644
index 0000000..4275ff1
--- /dev/null
+++ b/src/main/resources/plugins/ItemTag.js
@@ -0,0 +1,79 @@
+'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 http = require('http');
+var fs = require('fs');
+
+var nameMap = [];
+
+var description = {
+ name: 'ItemTag',
+ version: '1.0',
+ author: '喵♂呜'
+};
+
+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');
+}
+
+function enable() {
+ switch (DetectServerType) {
+ case ServerType.Bukkit:
+ event.on(self, 'ItemMergeEvent', function (event) {
+ bukkit(event.target, event.entity.itemStack.amount + event.target.itemStack.amount);
+ })
+ event.on(self, 'ItemSpawnEvent', function (event) {
+ if (event.entity.itemStack) {
+ bukkit(event.entity, event.entity.itemStack.amount);
+ }
+ })
+ break;
+ case ServerType.Sponge:
+ event.on(self, 'itemmergeitemevent', function (event) {
+ // Sponge 暂未实现当前事件
+ })
+ event.on(self, 'spawnentityevent', function (event) {
+ event.entities.forEach(function (entity) {
+ if (entity.type.name === "item") sponge(entity);
+ })
+ })
+ break;
+ }
+}
+
+function getItemName(name) {
+ return itemConfig[(name + '').toUpperCase()] || name;
+}
+
+function bukkit(item , amount) {
+ var amounts = amount == 1 ? "" : "*" + amount;
+ item.setCustomName('§b' + getItemName(item.itemStack.type) + amounts);
+ item.setCustomNameVisible(true);
+}
+
+function sponge(entity) {
+ var itemOptional = entity.get(Keys.REPRESENTED_ITEM);
+ if (itemOptional.isPresent()) {
+ var item = itemOptional.get();
+ var amounts = item.count == 1 ? "" : "*" + item.count;
+ entity.offer(org.spongepowered.api.data.key.Keys.DISPLAY_NAME, org.spongepowered.api.text.Text.of('§b' + getItemName(item.type.name.split(':')[1]) + amounts));
+ entity.offer(org.spongepowered.api.data.key.Keys.CUSTOM_NAME_VISIBLE, true);
+ }
+}
+
+module.exports = {
+ description: description,
+ load: load,
+ enable: enable,
+ disable: disable
+};