feat: 全新架构 只保留一个Java类初始化

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
2017-09-14 20:41:34 +08:00
parent 54f6f9999d
commit fdeb2619ff
38 changed files with 462 additions and 1874 deletions

View File

@ -0,0 +1,12 @@
var boot;
/**
* 初始化框架引擎
*/
(function () {
boot = function (plugin, engine) {
engine.put('root', plugin.getDataFolder());
engine.put('rootDir', plugin.getDataFolder().getCanonicalPath());
load(rootDir + '/modules/init.js');
init(plugin, engine);
}
})();

View File

@ -1,16 +0,0 @@
PlayerJoin:
#Event Class Full Name
class: org.bukkit.event.player.PlayerJoinEvent
#EventPriority Allow Value: LOWEST, LOW, NORMAL, HIGH, HIGHEST, MONITOR
priority: LOWEST
#Script List
scripts:
- 'welcome'
PlayerDrop:
#Event Class Full Name
class: org.bukkit.event.player.PlayerDropItemEvent
#EventPriority Allow Value: LOWEST, LOW, NORMAL, HIGH, HIGHEST, MONITOR
priority: LOWEST
#Script List
scripts:
- 'checkDrop'

View File

@ -1,7 +0,0 @@
function handle(Event) {
if (Player.getName() == "Mr_jtb") {
Bukkit.broadcastMessage("&6[&a公告&6] &c热烈欢迎 &aMiaoScript &c作者 &b喵♂呜&c!");
} else {
Player.sendMessage("&6[&bMiaoScript&6] &c欢迎来到 &b" + Bukkit.getServerName() + " &c服务器!");
}
}

View File

@ -1,26 +0,0 @@
function process(Player, Command, Args) {
var path = "bed.def"
var bname = "";
if (Args.length > 0) {
banem = Args[0];
path = "bed." + bname;
}
var pconfig = PlayerConfig.get(Player.getName());
switch (Command) {
case "setbed":
pconfig.set(path, Player.getLocation());
pconfig.save();
Player.sendMessage(Prefix + "&a您的家设置成功 使用&b/gobed " + bname + " &a即可回家!");
return true;
case "gobed":
if (pconfig.isSet(path)) {
Player.teleport(pconfig.getLocation(path));
Player.sendMessage(Prefix + "&a已传送您回家!");
} else {
Player.sendMessage(Prefix + "&c请先使用 &b/setbed " + bname + " &c设置您的家!");
}
return true;
default:
return false;
}
}

View File

@ -1,4 +0,0 @@
#模块名称
name: bed
#模块描述
description: 用于设置家 以及回家

View File

@ -1,8 +0,0 @@
#脚本名称
bed:
#脚本表达式
expression: 'file: bed.js'
#脚本绑定命令
commands:
- gobed
- setbed

View File

@ -1,4 +0,0 @@
dirList:
- 日狗
- 你妹
- 我操

View File

@ -1,8 +0,0 @@
PlayerChat:
#Event Class Full Name
class: org.bukkit.event.player.AsyncPlayerChatEvent
#EventPriority Allow Value: LOWEST, LOW, NORMAL, HIGH, HIGHEST, MONITOR
priority: LOWEST
#Script List
scripts:
- 'checkChat'

View File

@ -1,4 +0,0 @@
#模块名称
name: chatClear
#模块描述
description: 清理玩家不文明的对话

View File

@ -1,14 +0,0 @@
#脚本名称
checkChat:
#脚本表达式
expression: |
function handle(Event){
var dirs = Config.getStringList("dirList");
var msg = Event.getMessage();
for (i in dirs) {
if (msg.contains(dirs[i])) {
Event.setCancelled(true);
Player.sendMessage("&6[&b警告&6] &c请不要讲脏话!");
}
}
}

View File

@ -0,0 +1,38 @@
/**
* 菜单基础扩展脚本
* Created by 蒋天蓓 on 2017/2/8 0008.
*/
var ext = {};
/**
* 获得静态类
* @param name 类名
* @returns {*}
*/
ext.getStatic = function (name) {
return base.getClass(name).static;
};
/**
* 获得随机数
* @param max 最大值
* @param min 最小值
*/
ext.random = function (max, min) {
min = min === undefined ? 0 : min;
return Math.floor(Math.random() * (max - min) + min);
};
/**
* 判断对象是否为Null
* @param obj 对象
* @returns {boolean} notNull返回True
*/
ext.notNull = function (obj) {
return obj !== undefined && obj !== null;
};
/**
* 判断对象是否为Null
* @param obj 对象
* @returns {boolean} Null返回True
*/
ext.isNull = function (obj) {
return obj === undefined || obj === null;
};

View File

@ -0,0 +1,9 @@
'use strict';
/*global require*/
var global = this;
load(rootDir + '/modules/ext.js');
load(rootDir + '/modules/static.js');
function init(plugin, engine) {
log.d("Version: %s", plugin.getDescription().getVersion());
}

View File

@ -0,0 +1,24 @@
/**
* 基础静态类
* Created by 蒋天蓓 on 2017/2/9 0009.
*/
/**
* 日志类
*/
var log = base.getLog().static;
/**
* ActionBar类
*/
var actionbar = base.getActionBar().static;
/**
* Title类
*/
var title = base.getTitle().static;
/**
* 玩家兼容类
*/
var cplayer = base.getPlayer().static;
/**
* 工具类
*/
var mctools = base.getTools().static;