Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b8e693a03 | |||
| 5426023adb | |||
| 73b91c417e | |||
| 2693a22bf0 | |||
| 2322de1e40 | |||
| 2320736a92 | |||
| e8d5d10d44 | |||
| a9996ba297 | |||
| 68380ddbba | |||
| 0baf8f3cab | |||
| a2bce715f3 | |||
| 3c55df03d8 | |||
| f6526e79fc | |||
| f4c2294c06 | |||
| cf9508ba31 | |||
| e0f4c5e77d | |||
| e4a87095ce | |||
| 950575edbc | |||
| c2a71b9a7a | |||
| 068ac7b76e | |||
| 05cbd85828 | |||
| ea28d20aa1 | |||
| d3f33f50e0 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
.vscode
|
||||
.theia
|
||||
node_modules
|
||||
dist
|
||||
package-lock.json
|
||||
|
||||
31
doc/MCBBS.MD
31
doc/MCBBS.MD
@@ -13,8 +13,8 @@
|
||||
## 插件简介
|
||||
|
||||
- 此插件可以实现跨端使用 `TypeScript` 开发 脚本插件
|
||||
- 目前已经兼容 `Spigot` `Sponge`
|
||||
- 后续计划兼容 `BungeeCord` `Nukkit`
|
||||
- 目前已经兼容 `Spigot` `Sponge` `Paper` `CatServer` `BungeeCord` `Nukkit`
|
||||
- 后续计划兼容 暂无
|
||||
|
||||
## 起源 (可以略过)
|
||||
|
||||
@@ -103,17 +103,20 @@
|
||||
├─type Java的类型定义
|
||||
| ├─bungee BungeeCord类型定义
|
||||
| ├─bukkit Bukkit类型定义
|
||||
| └─sponge Sponge类型定义
|
||||
| ├─sponge Sponge类型定义
|
||||
| └─nukkit Nukkit类型定义
|
||||
├─websocket Netty的WebSocket注入
|
||||
└─plugins 这里当然是插件啦
|
||||
├─bungee 只兼容BungeeCord的插件
|
||||
├─bukkit 只兼容Bukkit的插件
|
||||
└─sponge 只兼容Sponge的插件
|
||||
├─sponge 只兼容Sponge的插件
|
||||
└─nukkit 只兼容Nukkit的插件
|
||||
```
|
||||
|
||||
详细的内容就不逼逼了 自己看代码吧
|
||||
|
||||
Github: https://github.com/circlecloud/ms
|
||||
YUMC: https://git.yumc.pw/circlecloud/ms
|
||||
|
||||
## 插件开发基础
|
||||
|
||||
@@ -146,6 +149,7 @@ Github: https://github.com/circlecloud/ms
|
||||
/// <reference types="@ms/types/dist/typings/bukkit" />
|
||||
/// <reference types="@ms/types/dist/typings/sponge" />
|
||||
/// <reference types="@ms/types/dist/typings/bungee" />
|
||||
/// <reference types="@ms/types/dist/typings/nukkit" />
|
||||
|
||||
import { server } from '@ms/api';
|
||||
import { inject } from '@ms/container';
|
||||
@@ -196,6 +200,16 @@ export class HelloWorld extends interfaces.Plugin {
|
||||
this.logger.log('Disable When ServerType is BungeeCord!')
|
||||
}
|
||||
|
||||
nukkitload() {
|
||||
this.logger.log('Load When ServerType is Nukkit!')
|
||||
}
|
||||
nukkitenable() {
|
||||
this.logger.log('Enable When ServerType is Nukkit!')
|
||||
}
|
||||
nukkitdisable() {
|
||||
this.logger.log('Disable When ServerType is Nukkit!')
|
||||
}
|
||||
|
||||
@cmd()
|
||||
hello(sender: any, command: string, args: string[]) {
|
||||
this.logger.log(sender, command, args);
|
||||
@@ -207,7 +221,8 @@ export class HelloWorld extends interfaces.Plugin {
|
||||
return ['world']
|
||||
}
|
||||
|
||||
@listener({ servers: ['bukkit'] })
|
||||
// bukkit nukkit 大部分API神似 可以直接用
|
||||
@listener({ servers: ['bukkit', 'nukkit'] })
|
||||
PlayerJoin(event: org.bukkit.event.player.PlayerJoinEvent) {
|
||||
let plyaer = event.getPlayer();
|
||||
this.logger.console(`§cBukkit §aPlayerJoinEvent: §b${plyaer.getName()}`)
|
||||
@@ -236,10 +251,11 @@ export class HelloWorld extends interfaces.Plugin {
|
||||
|
||||
- 进入 `ms`目录
|
||||
- 执行编译 `yarn build:plugins`
|
||||
- 从 `packages/plugins/dist` 中复制 `HelloWorld.js` 文件 到对应的插件目录
|
||||
- 从 `packages/plugins/dist` 中复制 `HelloWorld.js` 和 `HelloWorld.js.map`(可选 用于显示插件原有行数) 文件 到对应的插件目录
|
||||
- Bungee: plugins/MiaoScript/plugins/
|
||||
- Bukkit: plugins/MiaoScript/plugins/
|
||||
- Sponge: config/miaoscript/plugins/
|
||||
- Nukkit: plugins/MiaoScript/plugins/
|
||||
- 重载 `MiaoScript`
|
||||
- 打开客户端进入游戏 预览一下效果
|
||||
- 从 Spigot 服务端进入
|
||||
@@ -358,7 +374,8 @@ tabhello(_sender: any, _command: string, _args: string[]) {
|
||||
- 事件监听方法的第一个参数就是本次事件的具体内容 (这里就需要自己去查询对应的JavaDoc了)
|
||||
|
||||
```ts
|
||||
@listener({ servers: ['bukkit'] })
|
||||
// bukkit nukkit 大部分API神似 可以直接用
|
||||
@listener({ servers: ['bukkit', 'nukkit'] })
|
||||
PlayerJoin(event: org.bukkit.event.player.PlayerJoinEvent) {
|
||||
let plyaer = event.getPlayer();
|
||||
this.logger.console(`§cBukkit §aPlayerJoinEvent: §b${plyaer.getName()}`)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"useWorkspaces": true,
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ms/api",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript api package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -22,13 +22,13 @@
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/container": "^0.2.0",
|
||||
"@ms/ployfill": "^0.2.0",
|
||||
"@ms/container": "^0.3.0",
|
||||
"@ms/ployfill": "^0.3.0",
|
||||
"source-map-builder": "^0.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
58
packages/api/src/channel.ts
Normal file
58
packages/api/src/channel.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { injectable } from "@ms/container";
|
||||
|
||||
export namespace channel {
|
||||
/**
|
||||
* handle plugin message
|
||||
* @param data byte[]
|
||||
*/
|
||||
export type ChannelListener = (data: any) => void
|
||||
|
||||
@injectable()
|
||||
export abstract class Channel {
|
||||
private listenerMap = [];
|
||||
|
||||
listen(plugin: any, channel: string, exec: ChannelListener) {
|
||||
if (!plugin || !plugin.description || !plugin.description.name) throw new TypeError('Plugin can\'t be undefiend!');
|
||||
let name = plugin.description.name;
|
||||
let listener = this.register(channel, exec)
|
||||
if (!this.listenerMap[name]) this.listenerMap[name] = [];
|
||||
let offExec = () => {
|
||||
this.unregister(channel, listener);
|
||||
console.debug(`[${name}] unregister channel ${channel}`);
|
||||
};
|
||||
var off = {
|
||||
channel,
|
||||
listener,
|
||||
off: offExec
|
||||
};
|
||||
this.listenerMap[name].push(off);
|
||||
console.debug(`[${name}] register channel ${channel} => ${exec.name || '[anonymous]'}`);
|
||||
return off;
|
||||
}
|
||||
disable(plugin: any) {
|
||||
var channelCache = this.listenerMap[plugin.description.name];
|
||||
if (channelCache) {
|
||||
channelCache.forEach(t => t.off());
|
||||
delete this.listenerMap[plugin.description.name];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Channel Message
|
||||
* @param player recover target
|
||||
* @param channel ChannelName
|
||||
* @param data byte[]
|
||||
*/
|
||||
abstract send(player: any, channel: string, data: any)
|
||||
/**
|
||||
* register channel
|
||||
* @param channel ChannelName
|
||||
*/
|
||||
abstract register(channel: string, listener: ChannelListener): any
|
||||
/**
|
||||
* unregister channel
|
||||
* @param channel ChannelName
|
||||
*/
|
||||
abstract unregister(channel: string, listener?: any): void
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import i18n from '@ms/i18n'
|
||||
import { injectable } from "@ms/container";
|
||||
|
||||
export namespace command {
|
||||
@@ -5,18 +6,18 @@ export namespace command {
|
||||
export abstract class Command {
|
||||
on(plugin: any, name: string, exec: { cmd: Function, tab?: Function }) {
|
||||
var cmd = this.create(plugin, name);
|
||||
console.debug(`[${plugin.description.name}] register command ${name}(${cmd})...`)
|
||||
console.debug(i18n.translate("ms.api.command.register", { plugin: plugin.description.name, name, cmd }))
|
||||
if (exec.cmd && typeof exec.cmd === "function") {
|
||||
this.onCommand(plugin, cmd, exec.cmd);
|
||||
} else {
|
||||
throw Error("CommandExec Must be a function... Input: " + exec.cmd)
|
||||
throw Error(i18n.translate("ms.api.command.register.input.error", { exec: exec.cmd }))
|
||||
}
|
||||
if (exec.tab && typeof exec.tab === "function") {
|
||||
this.onTabComplete(plugin, cmd, exec.tab);
|
||||
}
|
||||
}
|
||||
off(plugin: any, name: string) {
|
||||
console.debug(`[${plugin.description.name}] unregister command ${name}...`)
|
||||
console.debug(i18n.translate("ms.api.command.unregister", { plugin: plugin.description.name, name }))
|
||||
this.remove(plugin, name);
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import i18m from '@ms/i18n'
|
||||
import { SourceMapBuilder } from 'source-map-builder'
|
||||
|
||||
const Arrays = Java.type('java.util.Arrays');
|
||||
@@ -78,6 +79,9 @@ export class MiaoScriptConsole implements Console {
|
||||
console(...args) {
|
||||
this.info(args)
|
||||
}
|
||||
i18n(name: string, param?: { [key: string]: any }) {
|
||||
this.console(i18m.translate(name, param))
|
||||
}
|
||||
object(obj) {
|
||||
for (var i in obj) {
|
||||
this.info(i, '=>', obj[i])
|
||||
@@ -90,17 +94,21 @@ export class MiaoScriptConsole implements Console {
|
||||
try {
|
||||
if (fileName.endsWith('js')) {
|
||||
var file = Paths.get(fileName + '.map');
|
||||
if (!this.sourceMaps[fileName]) {
|
||||
if (this.sourceMaps[fileName] === undefined) {
|
||||
if (file.toFile().exists()) {
|
||||
var sourceMapObj = JSON.parse(new JavaString(Files.readAllBytes(file), "UTF-8"))
|
||||
this.sourceMaps[fileName] = new SourceMapBuilder(sourceMapObj)
|
||||
} else {
|
||||
this.sourceMaps[fileName] = null;
|
||||
}
|
||||
}
|
||||
if (this.sourceMaps[fileName]) {
|
||||
var sourceMapping = this.sourceMaps[fileName].getSource(lineNumber, lineNumber);
|
||||
if (sourceMapping) {
|
||||
fileName = fileName.replace(".js", ".ts");
|
||||
lineNumber = sourceMapping.mapping.sourceLine;
|
||||
if (lineNumber != sourceMapping.mapping.sourceLine) {
|
||||
fileName = fileName.replace(".js", ".ts");
|
||||
lineNumber = sourceMapping.mapping.sourceLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
'use strict';
|
||||
/// <reference types='@ms/nashorn' />
|
||||
|
||||
/**
|
||||
* MiaoScript Event处理类
|
||||
*/
|
||||
import '@ms/core'
|
||||
import '@ms/nashorn'
|
||||
import { injectable } from '@ms/container'
|
||||
import i18n from '@ms/i18n'
|
||||
import { injectable, unmanaged } from '@ms/container'
|
||||
|
||||
const Thread = Java.type('java.lang.Thread');
|
||||
|
||||
@@ -25,7 +25,7 @@ export namespace event {
|
||||
|
||||
protected baseEventDir = '';
|
||||
|
||||
constructor(baseEventDir: string) {
|
||||
constructor(@unmanaged() baseEventDir: string) {
|
||||
this.baseEventDir = baseEventDir;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,7 @@ export namespace event {
|
||||
* org.spongepowered.api.event.game.GameRegistryEvent.Register => gameregistryevent$register
|
||||
*/
|
||||
mapEventName() {
|
||||
if (this.baseEventDir === "") {
|
||||
throw new Error("base event dir is empty, can't map event name !");
|
||||
}
|
||||
if (this.baseEventDir === "") { throw new Error(i18n.translate('ms.api.event.empty.event.dir')); }
|
||||
let count = 0;
|
||||
let jar = this.getJarFile(this.baseEventDir);
|
||||
let entries = jar.entries();
|
||||
@@ -51,7 +49,7 @@ export namespace event {
|
||||
let clazz = base.getClass(qualifiedName.substring(0, qualifiedName.length - 6));
|
||||
if (this.isValidEvent(clazz)) {
|
||||
let simpleName = this.class2Name(clazz).toLowerCase();
|
||||
console.trace(`Mapping Event [${clazz.canonicalName}] => ${simpleName}`);
|
||||
console.trace(i18n.translate("ms.api.event.mapping", { canonicalName: clazz.canonicalName, simpleName }));
|
||||
this.mapEvent[simpleName] = clazz;
|
||||
count++;
|
||||
}
|
||||
@@ -69,7 +67,7 @@ export namespace event {
|
||||
let url = dirs.nextElement();
|
||||
if (url.protocol === "jar") { return url.openConnection().jarFile; }
|
||||
}
|
||||
throw new Error(`Can't Mapping Event Because not found Resources ${resource}!`)
|
||||
throw new Error(i18n.translate("ms.api.event.resource.not.found", { resource }))
|
||||
}
|
||||
|
||||
class2Name(clazz: any) {
|
||||
@@ -77,14 +75,13 @@ export namespace event {
|
||||
}
|
||||
|
||||
name2Class(name: any, event: string) {
|
||||
var eventCls = this.mapEvent[event.toLowerCase()] || this.mapEvent[event.toLowerCase() + 'event'];
|
||||
let eventCls = this.mapEvent[event.toLowerCase()] || this.mapEvent[event.toLowerCase() + 'event'];
|
||||
if (!eventCls) {
|
||||
try {
|
||||
eventCls = base.getClass(eventCls);
|
||||
this.mapEvent[event] = eventCls;
|
||||
} catch (ex) {
|
||||
console.console(`§6插件 §b${name} §6注册事件 §c${event} §6失败 §4事件未找到!`);
|
||||
console.ex(new Error(`Plugin ${name} register event error ${event} not found!`));
|
||||
console.i18n("ms.api.event.not.found", { name, event })
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -94,14 +91,17 @@ export namespace event {
|
||||
execute(name, exec, eventCls) {
|
||||
return (...args: any[]) => {
|
||||
try {
|
||||
var time = new Date().getTime()
|
||||
exec(args[args.length - 1]);
|
||||
var cost = new Date().getTime() - time;
|
||||
if (cost > 20) {
|
||||
console.console(`§c注意! §6插件 §b${name} §6处理 §d${this.class2Name(eventCls)} §6事件 §c耗时 §4${cost}ms !`)
|
||||
let event = args[args.length - 1];
|
||||
if (eventCls.isAssignableFrom(event.getClass())) {
|
||||
let time = Date.now()
|
||||
exec(event);
|
||||
let cost = Date.now() - time;
|
||||
if (cost > 20) {
|
||||
console.i18n("ms.api.event.execute.slow", { name, event: this.class2Name(eventCls), cost })
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
console.console(`§6插件 §b${name} §6处理 §d${this.class2Name(eventCls)} §6事件时发生异常 §4${ex}`);
|
||||
console.i18n("ms.api.event.execute.error", { name, event: this.class2Name(eventCls), ex })
|
||||
console.ex(ex);
|
||||
}
|
||||
}
|
||||
@@ -115,8 +115,8 @@ export namespace event {
|
||||
* @param priority {string} [LOWEST,LOW,NORMAL,HIGH,HIGHEST,MONITOR]
|
||||
* @param ignoreCancel
|
||||
*/
|
||||
listen(plugin: any, event: string, exec: () => void, priority: EventPriority = EventPriority.NORMAL, ignoreCancel = false) {
|
||||
if (!plugin || !plugin.description || !plugin.description.name) throw new TypeError('插件名称为空 请检查传入参数!');
|
||||
listen(plugin: any, event: string, exec: (event: any) => void, priority: EventPriority = EventPriority.NORMAL, ignoreCancel = false) {
|
||||
if (!plugin || !plugin.description || !plugin.description.name) throw new TypeError(i18n.translate("ms.api.event.listen.plugin.name.empty"));
|
||||
var name = plugin.description.name;
|
||||
var eventCls = this.name2Class(name, event);
|
||||
if (!eventCls) { return; }
|
||||
@@ -133,7 +133,7 @@ export namespace event {
|
||||
if (!listenerMap[name]) listenerMap[name] = [];
|
||||
var offExec = () => {
|
||||
this.unregister(eventCls, listener);
|
||||
console.debug(`[${name}] unregister event ${this.class2Name(eventCls)}`);
|
||||
console.debug(i18n.translate("ms.api.event.unregister", { name, event: this.class2Name(eventCls) }));
|
||||
};
|
||||
var off = {
|
||||
event: eventCls,
|
||||
@@ -142,7 +142,7 @@ export namespace event {
|
||||
};
|
||||
listenerMap[name].push(off);
|
||||
// noinspection JSUnresolvedVariable
|
||||
console.debug(`[${name}] register event ${this.class2Name(eventCls)} => ${exec.name || '[anonymous]'}`);
|
||||
console.debug(i18n.translate("ms.api.event.register", { name, event: this.class2Name(eventCls) }));
|
||||
return off;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference types='@ms/ployfill' />
|
||||
import "@ms/ployfill"
|
||||
export * from './task'
|
||||
export * from './event'
|
||||
export * from './console'
|
||||
export * from './channel'
|
||||
export * from './command'
|
||||
export * from './interfaces'
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
import { Container } from "@ms/container";
|
||||
|
||||
export namespace plugin {
|
||||
/**
|
||||
* MiaoScript Plugin
|
||||
*/
|
||||
export const Plugin = Symbol("Plugin");
|
||||
/**
|
||||
* MiaoScript Plugin
|
||||
*/
|
||||
export const PluginFolder = Symbol("PluginFolder");
|
||||
/**
|
||||
* Runtime Plugin Instance
|
||||
*/
|
||||
export const PluginInstance = Symbol("PluginInstance");
|
||||
/**
|
||||
* MiaoScript Plugin Manager
|
||||
* MiaoScript Plugin Manager Symbol
|
||||
*/
|
||||
export const PluginManager = Symbol("PluginManager");
|
||||
/**
|
||||
* MiaoScript Plugin Manager
|
||||
* MiaoScript Plugin Manager Interface
|
||||
*/
|
||||
export interface PluginManager {
|
||||
scan(folder: string): void;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@ms/bukkit",
|
||||
"version": "0.2.0",
|
||||
"description": "MiaoScript api package",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript bukkit package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
"minecraft",
|
||||
@@ -24,12 +24,12 @@
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/api": "^0.2.0",
|
||||
"@ms/common": "^0.2.0",
|
||||
"@ms/container": "^0.2.0",
|
||||
"@ms/types": "^0.2.0"
|
||||
"@ms/api": "^0.3.0",
|
||||
"@ms/common": "^0.3.0",
|
||||
"@ms/container": "^0.3.0",
|
||||
"@ms/types": "^0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
28
packages/bukkit/src/channel.ts
Normal file
28
packages/bukkit/src/channel.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { channel, plugin } from '@ms/api'
|
||||
import { inject, provideSingleton } from '@ms/container'
|
||||
|
||||
const Bukkit = org.bukkit.Bukkit
|
||||
const PluginMessageListener = Java.type("org.bukkit.plugin.messaging.PluginMessageListener")
|
||||
const Messenger = Bukkit.getMessenger()
|
||||
|
||||
@provideSingleton(channel.Channel)
|
||||
export class BukkitChannel extends channel.Channel {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any;
|
||||
|
||||
send(player: any, channel: string, data: any) {
|
||||
player.sendPluginMessage(this.pluginInstance, channel, data);
|
||||
}
|
||||
register(channel: string, listener: channel.ChannelListener) {
|
||||
Messenger.registerIncomingPluginChannel(this.pluginInstance, channel, new PluginMessageListener({
|
||||
onPluginMessageReceived: (/**String */ var1, /**Player */ var2, /**byte[] */var3) => {
|
||||
listener(var3)
|
||||
}
|
||||
}));
|
||||
Messenger.registerOutgoingPluginChannel(this.pluginInstance, channel);
|
||||
}
|
||||
unregister(channel: string, listener: any) {
|
||||
Messenger.unregisterIncomingPluginChannel(this.pluginInstance, channel)
|
||||
Messenger.unregisterOutgoingPluginChannel(this.pluginInstance, channel)
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,14 @@ import '@ms/nashorn'
|
||||
|
||||
import { command, plugin } from '@ms/api'
|
||||
import * as reflect from '@ms/common/dist/reflect'
|
||||
import { injectable, postConstruct, inject } from '@ms/container'
|
||||
import { provideSingleton, postConstruct, inject } from '@ms/container'
|
||||
|
||||
let Bukkit = org.bukkit.Bukkit;
|
||||
let TabCompleter = Java.type('org.bukkit.command.TabCompleter');
|
||||
let PluginCommand = Java.type('org.bukkit.command.PluginCommand');
|
||||
let CommandExecutor = Java.type('org.bukkit.command.CommandExecutor');
|
||||
|
||||
@injectable()
|
||||
@provideSingleton(command.Command)
|
||||
export class BukkitCommand extends command.Command {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any
|
||||
@@ -19,7 +19,6 @@ export class BukkitCommand extends command.Command {
|
||||
init() {
|
||||
this.commandMap = reflect.on(Bukkit.getPluginManager()).get('commandMap').get();
|
||||
}
|
||||
|
||||
create(plugin: any, command: string) {
|
||||
var cmd = this.commandMap.getCommand(command)
|
||||
if (cmd && cmd instanceof PluginCommand) { return cmd };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { event, server, plugin } from '@ms/api'
|
||||
import { injectable, inject } from '@ms/container';
|
||||
import { event, plugin } from '@ms/api'
|
||||
import { inject, provideSingleton } from '@ms/container';
|
||||
import * as reflect from '@ms/common/dist/reflect'
|
||||
|
||||
const Bukkit = Java.type("org.bukkit.Bukkit");
|
||||
@@ -9,7 +9,7 @@ const Listener = Java.type("org.bukkit.event.Listener");
|
||||
const EventPriority = Java.type("org.bukkit.event.EventPriority");
|
||||
const EventExecutor = Java.type("org.bukkit.plugin.EventExecutor");
|
||||
|
||||
@injectable()
|
||||
@provideSingleton(event.Event)
|
||||
export class BukkitEvent extends event.Event {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
/// <reference types="@ms/types/dist/typings/bukkit" />
|
||||
|
||||
import { server, command, event, task } from '@ms/api'
|
||||
import { server } from '@ms/api'
|
||||
import { Container } from '@ms/container'
|
||||
|
||||
import { BukkitConsole } from './console';
|
||||
import { BukkitEvent } from './event';
|
||||
import { BukkitServer } from './server';
|
||||
import { BukkitCommand } from './command';
|
||||
import { BukkitTaskManager } from './task';
|
||||
import './event';
|
||||
import './server';
|
||||
import './command';
|
||||
import './channel';
|
||||
import './task';
|
||||
|
||||
export default function BukkitImpl(container: Container) {
|
||||
container.bind(server.Console).toConstantValue(BukkitConsole);
|
||||
container.bind(event.Event).to(BukkitEvent).inSingletonScope();
|
||||
container.bind(server.Server).to(BukkitServer).inSingletonScope();
|
||||
container.bind(command.Command).to(BukkitCommand).inSingletonScope();
|
||||
container.bind(task.TaskManager).to(BukkitTaskManager).inSingletonScope();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { server } from '@ms/api'
|
||||
import { injectable } from '@ms/container';
|
||||
import { provideSingleton } from '@ms/container';
|
||||
|
||||
import chat from './enhance/chat'
|
||||
|
||||
let Bukkit = org.bukkit.Bukkit;
|
||||
|
||||
@injectable()
|
||||
@provideSingleton(server.Server)
|
||||
export class BukkitServer implements server.Server {
|
||||
getPlayer(name: string) {
|
||||
return Bukkit.getPlayer(name)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { task, plugin } from '@ms/api'
|
||||
import { injectable, inject } from '@ms/container';
|
||||
import { inject, provideSingleton } from '@ms/container';
|
||||
|
||||
const Bukkit = Java.type('org.bukkit.Bukkit');
|
||||
const BukkitRunnable = Java.type('org.bukkit.scheduler.BukkitRunnable');
|
||||
const Callable = Java.type('java.util.concurrent.Callable')
|
||||
|
||||
@injectable()
|
||||
@provideSingleton(task.TaskManager)
|
||||
export class BukkitTaskManager implements task.TaskManager {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ms/bungee",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript bungee package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -24,12 +24,12 @@
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/api": "^0.2.0",
|
||||
"@ms/common": "^0.2.0",
|
||||
"@ms/container": "^0.2.0",
|
||||
"@ms/types": "^0.2.0"
|
||||
"@ms/api": "^0.3.0",
|
||||
"@ms/common": "^0.3.0",
|
||||
"@ms/container": "^0.3.0",
|
||||
"@ms/types": "^0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
18
packages/bungee/src/channel.ts
Normal file
18
packages/bungee/src/channel.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { channel } from '@ms/api'
|
||||
import { provideSingleton } from '@ms/container'
|
||||
|
||||
const Bungee: net.md_5.bungee.api.ProxyServer = base.getInstance().getProxy()
|
||||
|
||||
@provideSingleton(channel.Channel)
|
||||
export class BungeeChannel extends channel.Channel {
|
||||
send(player: any, channel: string, data: any) {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
register(channel: string, listener: channel.ChannelListener) {
|
||||
Bungee.registerChannel(channel);
|
||||
console.console('§6[§eWARN§6] §eBungeeCord Channel only registerChannel you need self hanler PluginMessageEvent!')
|
||||
}
|
||||
unregister(channel: string, listener: any) {
|
||||
Bungee.unregisterChannel(channel);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { command, plugin } from "@ms/api";
|
||||
import { inject, injectable } from "@ms/container";
|
||||
import * as ref from '@ms/common/dist/reflect'
|
||||
import { inject, provideSingleton } from "@ms/container";
|
||||
|
||||
const Arrays = Java.type('java.util.Arrays')
|
||||
const Command = Java.extend(Java.type('net.md_5.bungee.api.plugin.Command'), Java.type('net.md_5.bungee.api.plugin.TabExecutor'));
|
||||
@@ -13,26 +12,7 @@ const createCommand = eval(`
|
||||
}
|
||||
`)
|
||||
|
||||
class SimpleCommand {
|
||||
public callable: any;
|
||||
private name: string;
|
||||
private executor: Function;
|
||||
private tabComplete: Function = () => [];
|
||||
|
||||
constructor(command: string) {
|
||||
this.name = command;
|
||||
this.callable = createCommand(Command, command,
|
||||
(sender, args) => this.executor(sender, '', command, args),
|
||||
(sender, args) => Arrays.asList(this.tabComplete(sender, '', command, args))
|
||||
);
|
||||
}
|
||||
|
||||
setExecutor = (executor: Function) => this.executor = executor;
|
||||
setTabComplete = (tabComplete: Function) => this.tabComplete = tabComplete;
|
||||
toString = () => `Bungee SimpleCommand(${this.name})`
|
||||
}
|
||||
|
||||
@injectable()
|
||||
@provideSingleton(command.Command)
|
||||
export class BungeeCommand extends command.Command {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any;
|
||||
@@ -64,3 +44,22 @@ export class BungeeCommand extends command.Command {
|
||||
return plugin.description.name.toLowerCase() + ":" + command;
|
||||
}
|
||||
}
|
||||
|
||||
class SimpleCommand {
|
||||
public callable: any;
|
||||
private name: string;
|
||||
private executor: Function;
|
||||
private tabComplete: Function = () => [];
|
||||
|
||||
constructor(command: string) {
|
||||
this.name = command;
|
||||
this.callable = createCommand(Command, command,
|
||||
(sender, args) => this.executor(sender, '', command, args),
|
||||
(sender, args) => Arrays.asList(this.tabComplete(sender, '', command, args))
|
||||
);
|
||||
}
|
||||
|
||||
setExecutor = (executor: Function) => this.executor = executor;
|
||||
setTabComplete = (tabComplete: Function) => this.tabComplete = tabComplete;
|
||||
toString = () => `Bungee SimpleCommand(${this.name})`
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { event, plugin } from '@ms/api'
|
||||
import { injectable, inject, postConstruct } from '@ms/container'
|
||||
import { event } from '@ms/api'
|
||||
import { provideSingleton, postConstruct } from '@ms/container'
|
||||
import * as reflect from '@ms/common/dist/reflect'
|
||||
|
||||
const Bungee: net.md_5.bungee.api.ProxyServer = base.getInstance().getProxy();
|
||||
@@ -21,10 +21,8 @@ EventPriority[event.EventPriority.HIGHEST] = Byte.valueOf(64);
|
||||
/**
|
||||
* Bungee Event Impl
|
||||
*/
|
||||
@injectable()
|
||||
@provideSingleton(event.Event)
|
||||
export class BungeeEvent extends event.Event {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any;
|
||||
private pluginManager = Bungee.getPluginManager()
|
||||
|
||||
// EventBus
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
/// <reference types="@ms/types/dist/typings/bungee" />
|
||||
|
||||
import { server, command, event, task } from '@ms/api'
|
||||
import { server } from '@ms/api'
|
||||
import { Container } from '@ms/container'
|
||||
|
||||
import { BungeeConsole } from './console';
|
||||
import { BungeeEvent } from './event';
|
||||
import { BungeeServer } from './server';
|
||||
import { BungeeCommand } from './command';
|
||||
import { BungeeTaskManager } from './task';
|
||||
import './event';
|
||||
import './server';
|
||||
import './command';
|
||||
import './channel';
|
||||
import './task';
|
||||
|
||||
export default function BungeeImpl(container: Container) {
|
||||
container.bind(server.Console).toConstantValue(BungeeConsole);
|
||||
container.bind(event.Event).to(BungeeEvent).inSingletonScope();
|
||||
container.bind(server.Server).to(BungeeServer).inSingletonScope();
|
||||
container.bind(command.Command).to(BungeeCommand).inSingletonScope();
|
||||
container.bind(task.TaskManager).to(BungeeTaskManager).inSingletonScope();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { server } from '@ms/api'
|
||||
import { injectable } from '@ms/container';
|
||||
import { provideSingleton } from '@ms/container';
|
||||
|
||||
let Bungee: net.md_5.bungee.api.ProxyServer = base.getInstance().getProxy();
|
||||
|
||||
@injectable()
|
||||
@provideSingleton(server.Server)
|
||||
export class BungeeServer implements server.Server {
|
||||
getPlayer(name: string) {
|
||||
return Bungee.getPlayer(name);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { task, plugin } from '@ms/api'
|
||||
import { injectable, inject } from '@ms/container';
|
||||
import { inject, provideSingleton } from '@ms/container';
|
||||
|
||||
var Runnable = Java.type('java.lang.Runnable')
|
||||
let TimeUnit = Java.type('java.util.concurrent.TimeUnit')
|
||||
|
||||
@injectable()
|
||||
@provideSingleton(task.TaskManager)
|
||||
export class BungeeTaskManager implements task.TaskManager {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@ms/client",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript client package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -30,6 +30,6 @@
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^6.14.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ms/common",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript api package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -24,11 +24,11 @@
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/nashorn": "^0.2.0",
|
||||
"@ms/ployfill": "^0.2.0"
|
||||
"@ms/nashorn": "^0.3.0",
|
||||
"@ms/ployfill": "^0.3.0"
|
||||
},
|
||||
"gitHead": "562e2d00175c9d3a99c8b672aa07e6d92706a027"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ms/compile",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript compile package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -24,6 +24,6 @@
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ms/container",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript container package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -24,7 +24,7 @@
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"inversify-binding-decorators": "^4.0.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ms/core",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript api package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -24,15 +24,15 @@
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/api": "^0.2.0",
|
||||
"@ms/bukkit": "^0.2.0",
|
||||
"@ms/common": "^0.2.0",
|
||||
"@ms/container": "^0.2.0",
|
||||
"@ms/plugin": "^0.2.0",
|
||||
"@ms/sponge": "^0.2.0"
|
||||
"@ms/api": "^0.3.0",
|
||||
"@ms/bukkit": "^0.3.0",
|
||||
"@ms/common": "^0.3.0",
|
||||
"@ms/container": "^0.3.0",
|
||||
"@ms/plugin": "^0.3.0",
|
||||
"@ms/sponge": "^0.3.0"
|
||||
},
|
||||
"gitHead": "781524f83e52cad26d7c480513e3c525df867121"
|
||||
}
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import '@ms/ployfill'
|
||||
let containerStartTime = new Date().getTime()
|
||||
console.log(`Initialization MiaoScript IOC Container @ms/container. Please wait...`)
|
||||
import { plugin, server, task } from '@ms/api'
|
||||
import { PluginManagerImpl } from '@ms/plugin'
|
||||
import { DefaultContainer as container, injectable, inject, ContainerInstance } from '@ms/container'
|
||||
console.log('MiaoScript IOC Container @ms/container loading completed(' + (new Date().getTime() - containerStartTime) / 1000 + 's)!');
|
||||
/// <reference types="@ms/nashorn" />
|
||||
import '@ms/i18n'
|
||||
|
||||
@injectable()
|
||||
let containerStartTime = Date.now();
|
||||
console.i18n("ms.core.ioc.initialize");
|
||||
import { plugin, server, task } from '@ms/api'
|
||||
import { DefaultContainer as container, inject, provideSingleton, ContainerInstance, buildProviderModule } from '@ms/container'
|
||||
console.i18n("ms.core.ioc.completed", { time: (Date.now() - containerStartTime) / 1000 })
|
||||
|
||||
@provideSingleton(MiaoScriptCore)
|
||||
class MiaoScriptCore {
|
||||
@inject(server.Console)
|
||||
private Console: Console;
|
||||
@inject(task.TaskManager)
|
||||
private taskManager: task.TaskManager;
|
||||
@inject(plugin.PluginFolder)
|
||||
private pluginFolder: string;
|
||||
@inject(plugin.PluginManager)
|
||||
private pluginManager: plugin.PluginManager;
|
||||
|
||||
@@ -37,15 +40,16 @@ class MiaoScriptCore {
|
||||
|
||||
loadPlugins() {
|
||||
let loadPluginStartTime = new Date().getTime()
|
||||
console.log(`Initialization MiaoScript Plugin System. Please wait...`)
|
||||
this.pluginManager.scan('plugins');
|
||||
console.i18n("ms.core.plugin.initialize")
|
||||
this.pluginManager.scan(this.pluginFolder);
|
||||
this.pluginManager.build();
|
||||
this.pluginManager.load();
|
||||
this.pluginManager.enable();
|
||||
console.log('MiaoScript Plugin System loading completed(' + (new Date().getTime() - loadPluginStartTime) / 1000 + 's)!');
|
||||
console.i18n("ms.core.plugin.completed", { time: (new Date().getTime() - loadPluginStartTime) / 1000 })
|
||||
}
|
||||
|
||||
disable() {
|
||||
console.i18n("ms.core.engine.disable")
|
||||
this.pluginManager.disable();
|
||||
}
|
||||
}
|
||||
@@ -61,6 +65,11 @@ function detectServer() {
|
||||
return 'sponge'
|
||||
} catch (ex) {
|
||||
}
|
||||
try {
|
||||
Java.type("cn.nukkit.Nukkit");
|
||||
return 'nukkit'
|
||||
} catch (ex) {
|
||||
}
|
||||
try {
|
||||
Java.type("net.md_5.bungee.api.ProxyServer");
|
||||
return 'bungee'
|
||||
@@ -73,16 +82,17 @@ function initialize() {
|
||||
let corePackageStartTime = new Date().getTime()
|
||||
container.bind(ContainerInstance).toConstantValue(container);
|
||||
container.bind(plugin.PluginInstance).toConstantValue(base.getInstance());
|
||||
container.bind(plugin.PluginFolder).toConstantValue('plugins');
|
||||
let type = detectServer();
|
||||
console.info(`Detect Compatible Server set ServerType to ${type} ...`)
|
||||
console.i18n("ms.core.initialize.detect", { type });
|
||||
container.bind(server.ServerType).toConstantValue(type);
|
||||
console.log(`Initialization MiaoScript Package @ms/core @ms/${type}. Please wait...`)
|
||||
console.i18n("ms.core.package.initialize", { type });
|
||||
require(`@ms/${type}`).default(container);
|
||||
container.bind(plugin.PluginManager).to(PluginManagerImpl).inSingletonScope();
|
||||
container.bind(MiaoScriptCore).to(MiaoScriptCore).inSingletonScope();
|
||||
console.log(`MiaoScript Package @ms/core @ms/${type} loading completed(` + (new Date().getTime() - corePackageStartTime) / 1000 + 's)!');
|
||||
require('@ms/plugin')
|
||||
container.load(buildProviderModule());
|
||||
console.i18n("ms.core.package.completed", { type, time: (Date.now() - corePackageStartTime) / 1000 });
|
||||
let disable = container.get<MiaoScriptCore>(MiaoScriptCore).enable()
|
||||
console.log('MiaoScript ScriptEngine loading completed... Done (' + (new Date().getTime() - global.NashornEngineStartTime) / 1000 + 's)!');
|
||||
console.i18n("ms.core.engine.completed", { time: (Date.now() - global.NashornEngineStartTime) / 1000 });
|
||||
return disable;
|
||||
}
|
||||
|
||||
|
||||
38
packages/i18n/languages/en.yml
Normal file
38
packages/i18n/languages/en.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
ms.ployfill.initialize: "Initialization Java Nashorn ployfill. Please wait..."
|
||||
ms.ployfill.completed: "Java Nashorn ployfill loading completed... Cost ({time}s)!"
|
||||
|
||||
ms.core.ioc.initialize: "Initialization MiaoScript IOC Container @ms/container. Please wait..."
|
||||
ms.core.ioc.completed: "MiaoScript IOC Container @ms/container loading completed({time}s)!"
|
||||
ms.core.initialize.detect: "Detect Compatible Server set ServerType to {type} ..."
|
||||
ms.core.package.initialize: "Initialization MiaoScript Package @ms/core @ms/{type} @ms/plugin. Please wait..."
|
||||
ms.core.package.completed: "MiaoScript Package @ms/core @ms/{type} @ms/plugin loading completed({time}s)!"
|
||||
ms.core.plugin.initialize: "Initialization MiaoScript Plugin System. Please wait..."
|
||||
ms.core.plugin.completed: "MiaoScript Plugin System loading completed({time}s)!"
|
||||
ms.core.engine.completed: "MiaoScript ScriptEngine loading completed... Done({time}s)!"
|
||||
ms.core.engine.disable: "Disable MiaoScript Engine..."
|
||||
|
||||
ms.api.event.resource.not.found: "Can't Mapping Event Because not found Resources {resource}!"
|
||||
ms.api.event.empty.event.dir: "base event dir is empty, can't map event name !"
|
||||
ms.api.event.mapping: "Mapping Event [{canonicalName}] => {simpleName}"
|
||||
ms.api.event.not.found: "§6Plugin §b{name} §6register {event} error. event not found!"
|
||||
ms.api.event.execute.slow: "§cWARN! §6Plugin §b{name} §6execute §d{event} §6evnet §ccost §4{cost}ms !"
|
||||
ms.api.event.execute.error: "§6Plugin §b{name} §6execute §d{event} §6event error §4{ex}"
|
||||
ms.api.event.listen.plugin.name.empty: "Plugin name can't be empty!"
|
||||
ms.api.event.register: "[{name}] register event {event}"
|
||||
ms.api.event.unregister: "[{name}] unregister event {event}"
|
||||
ms.api.command.register.input.error: "CommandExec Must be a function... Input: {exec}"
|
||||
ms.api.command.register: "[{plugin}] register command {name}({cmd})..."
|
||||
ms.api.command.unregister: "[{plugin}] unregister command {name}..."
|
||||
|
||||
ms.plugin.initialize: "Initialization MiaoScript Plugin System: {plugin} ..."
|
||||
ms.plugin.event.map: "Total {count} {type} Event Mapping Complate..."
|
||||
ms.plugin.manager.scan: "Scanning Plugins in {folder} ..."
|
||||
ms.plugin.manager.initialize.error: "§6Plugin §b{name} §6initialize error §4{ex}"
|
||||
ms.plugin.manager.stage: "{stage} {plugin} version {version} by {author}"
|
||||
ms.plugin.manager.stage.load: "Loading"
|
||||
ms.plugin.manager.stage.enable: "Enabling"
|
||||
ms.plugin.manager.stage.disable: "Disabling"
|
||||
ms.plugin.manager.build.update: "Auto Update Plugin {name} ..."
|
||||
ms.plugin.manager.build.not.extends: "§4Found error plugin §b{source} §4it's not extends interfaces.Plugin, the plugin will be ignore!"
|
||||
ms.plugin.manager.build.exists: "§4Found duplicate plugin §b{exists} §4and §b{source}§4. the first plugin will be ignore!"
|
||||
ms.plugin.manager.config.save.default: "[{plugin}] config {name}.{format} not exists. auto create from default variable..."
|
||||
38
packages/i18n/languages/zh_cn.yml
Normal file
38
packages/i18n/languages/zh_cn.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
ms.ployfill.initialize: "初始化 Java Nashorn 补丁. 请稍候..."
|
||||
ms.ployfill.completed: "Java Nashorn 补丁 加载完成... 耗时 ({time}s)!"
|
||||
|
||||
ms.core.ioc.initialize: "初始化 MiaoScript IOC 容器 @ms/container. 请稍候..."
|
||||
ms.core.ioc.completed: "MiaoScript IOC 容器 @ms/container 加载完成 耗时({time}s)"
|
||||
ms.core.initialize.detect: "检测到兼容的服务器类型. 设置 ServerType 值 {type} ..."
|
||||
ms.core.package.initialize: "初始化 MiaoScript 扩展 @ms/core @ms/{type} @ms/plugin. 请稍候..."
|
||||
ms.core.package.completed: "MiaoScript 扩展 @ms/core @ms/{type} @ms/plugin 加载完成 耗时({time}s)"
|
||||
ms.core.plugin.initialize: "MiaoScript 开始引导插件系统. 请稍候..."
|
||||
ms.core.plugin.completed: "MiaoScript 插件加载完毕 耗时({time}s)!"
|
||||
ms.core.engine.completed: "MiaoScript 脚本引擎 加载完毕... 耗时({time}s)!"
|
||||
ms.core.engine.disable: "关闭 MiaoScript 引擎..."
|
||||
|
||||
ms.api.event.resource.not.found: "无法映射事件 未找到资源文件 {resource}!"
|
||||
ms.api.event.empty.event.dir: "事件基础目录为空, 无法映射事件!"
|
||||
ms.api.event.mapping: "映射事件 [{canonicalName}] => {simpleName}"
|
||||
ms.api.event.not.found: "§6插件 §b{name} §6注册事件 §c{event} §6失败. §4事件未找到!"
|
||||
ms.api.event.execute.slow: "§c注意! §6插件 §b{name} §6处理 §d{event} §6事件 §c耗时 §4{cost}ms !"
|
||||
ms.api.event.execute.error: "§6插件 §b{name} §6处理 §d{event} §6事件时发生异常 §4{ex}"
|
||||
ms.api.event.listen.plugin.name.empty: "插件名称为空 请检查传入参数!"
|
||||
ms.api.event.register: "[{name}] 注册事件 {event}"
|
||||
ms.api.event.unregister: "[{name}] 注销事件 {event}"
|
||||
ms.api.command.register.input.error: "CommandExec 必须为一个函数... 输入: {exec}"
|
||||
ms.api.command.register: "[{plugin}] 注册命令 {name}({cmd})..."
|
||||
ms.api.command.unregister: "[{plugin}] 注销命令 {name}..."
|
||||
|
||||
ms.plugin.initialize: "初始化 MiaoScript 插件系统: {plugin} ..."
|
||||
ms.plugin.event.map: "总计 {count} 个 {type} 事件 映射完成..."
|
||||
ms.plugin.manager.scan: "在 {folder} 文件夹中扫描插件..."
|
||||
ms.plugin.manager.initialize.error: "§6插件 §b{name} §6初始化错误 §4{ex}"
|
||||
ms.plugin.manager.stage: "{stage} {plugin} 版本 {version} 作者 {author}"
|
||||
ms.plugin.manager.stage.load: "加载"
|
||||
ms.plugin.manager.stage.enable: "启用"
|
||||
ms.plugin.manager.stage.disable: "关闭"
|
||||
ms.plugin.manager.build.update: "自动更新插件 {name} ..."
|
||||
ms.plugin.manager.build.not.extends: "§4发现错误的插件 §b{source} §4未继承接口 interfaces.Plugin, 将不会被载入到服务器!"
|
||||
ms.plugin.manager.build.duplicate: "§4发现已存在插件 §b{exists} §4和 §b{source}§4 存在冲突. 已存在插件将会被替换!"
|
||||
ms.plugin.manager.config.save.default: "[{plugin}] 配置 {name}.{format} 不存在. 从默认值自动创建保存..."
|
||||
37
packages/i18n/package.json
Normal file
37
packages/i18n/package.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "@ms/i18n",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript i18n package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
"minecraft",
|
||||
"bukkit",
|
||||
"sponge"
|
||||
],
|
||||
"author": "MiaoWoo <admin@yumc.pw>",
|
||||
"homepage": "https://github.com/circlecloud/ms.git",
|
||||
"license": "ISC",
|
||||
"main": "dist/index.js",
|
||||
"publishConfig": {
|
||||
"registry": "https://repo.yumc.pw/repository/npm-hosted/"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"watch": "tsc --watch",
|
||||
"build": "yarn clean && tsc",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^3.12.2",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/common": "^0.3.0",
|
||||
"@ms/container": "^0.3.0",
|
||||
"@ms/ployfill": "^0.3.0",
|
||||
"js-yaml": "^3.13.1"
|
||||
},
|
||||
"gitHead": "781524f83e52cad26d7c480513e3c525df867121"
|
||||
}
|
||||
42
packages/i18n/src/index.ts
Normal file
42
packages/i18n/src/index.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import '@ms/ployfill'
|
||||
import * as yaml from 'js-yaml'
|
||||
|
||||
import * as fs from '@ms/common/dist/fs'
|
||||
|
||||
let langMap = {};
|
||||
let fallbackMap = {};
|
||||
|
||||
type TranslateParam = { [key: string]: any }
|
||||
|
||||
function translate(name: string, param?: TranslateParam) {
|
||||
let langText: string = langMap[name] || fallbackMap[name];
|
||||
if (!langText) { return '[WARN] @ms/i18n miss lang translate: ' + name }
|
||||
for (const key in param) {
|
||||
langText = langText.replace("{" + key + "}", param[key])
|
||||
}
|
||||
return langText;
|
||||
}
|
||||
|
||||
function initialize(lang: string = 'zh_cn', fallback: string = 'zh_cn') {
|
||||
langMap = readYamlFile(root, lang) || readYamlFile(fs.concat(__dirname, '..'), lang)
|
||||
fallbackMap = readYamlFile(root, fallback) || readYamlFile(fs.concat(__dirname, '..'), fallback)
|
||||
console.i18n = function i18n(name: string, param?: TranslateParam) {
|
||||
console.log(translate(name, param))
|
||||
}
|
||||
}
|
||||
|
||||
function readYamlFile(dir: string, name: string) {
|
||||
let langFile = fs.concat(dir, 'languages', name + '.yml');
|
||||
return fs.exists(langFile) && yaml.safeLoad(base.read(langFile))
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Console {
|
||||
i18n(name: string, param?: TranslateParam);
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
initialize,
|
||||
translate
|
||||
};
|
||||
7
packages/i18n/tsconfig.json
Normal file
7
packages/i18n/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "src",
|
||||
"outDir": "dist"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@ms/manager",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript manager package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -34,6 +34,6 @@
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-node-dev": "^1.0.0-pre.44",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# sponge bukkit jdk bungee
|
||||
TYPE=bungee
|
||||
# sponge bukkit jdk bungee nukkit
|
||||
TYPE=nukkit
|
||||
TARGET=../types/dist/typings
|
||||
npx tsc src/build.ts --outDir dist
|
||||
cd dist
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ms/nashorn",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript api package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -25,6 +25,6 @@
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ typeMap['Matrix4d'] = 'any /*Matrix4d*/'
|
||||
function mappingType(type: string): string {
|
||||
let outType = typeMap[type] || type || 'any';
|
||||
if (outType.indexOf('.') != -1) {
|
||||
if (outType.startsWith('java.') || outType.startsWith('org.') || outType.startsWith('net.')) {
|
||||
if (outType.startsWith('java.') || outType.startsWith('org.') || outType.startsWith('net.') || outType.startsWith('cn.')) {
|
||||
|
||||
} else {
|
||||
outType = `any /*${outType}*/`
|
||||
|
||||
35
packages/nukkit/package.json
Normal file
35
packages/nukkit/package.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "@ms/nukkit",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript nukkit package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
"minecraft",
|
||||
"bukkit",
|
||||
"sponge"
|
||||
],
|
||||
"author": "MiaoWoo <admin@yumc.pw>",
|
||||
"homepage": "https://github.com/circlecloud/ms.git",
|
||||
"license": "ISC",
|
||||
"main": "dist/index.js",
|
||||
"publishConfig": {
|
||||
"registry": "https://repo.yumc.pw/repository/npm-hosted/"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"watch": "tsc --watch",
|
||||
"build": "yarn clean && tsc",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/api": "^0.3.0",
|
||||
"@ms/common": "^0.3.0",
|
||||
"@ms/container": "^0.3.0",
|
||||
"@ms/types": "^0.3.0"
|
||||
}
|
||||
}
|
||||
40
packages/nukkit/src/command.ts
Normal file
40
packages/nukkit/src/command.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import '@ms/nashorn'
|
||||
|
||||
import { command, plugin } from '@ms/api'
|
||||
import { inject, provideSingleton, postConstruct } from '@ms/container'
|
||||
|
||||
let PluginCommand = Java.type('cn.nukkit.command.PluginCommand');
|
||||
let CommandExecutor = Java.type('cn.nukkit.command.CommandExecutor');
|
||||
|
||||
@provideSingleton(command.Command)
|
||||
export class NukkitCommand extends command.Command {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any
|
||||
private commandMap: any;
|
||||
|
||||
@postConstruct()
|
||||
init() {
|
||||
this.commandMap = base.getInstance().getServer().getCommandMap();
|
||||
}
|
||||
create(plugin: any, command: string) {
|
||||
var cmd = this.commandMap.getCommand(command)
|
||||
if (cmd && cmd instanceof PluginCommand) { return cmd };
|
||||
cmd = new PluginCommand(command, this.pluginInstance)
|
||||
this.commandMap.register(plugin.description.name, cmd);
|
||||
return cmd;
|
||||
}
|
||||
remove(plugin: any, command: string) {
|
||||
var cmd = this.commandMap.getCommand(command)
|
||||
if (cmd && cmd instanceof PluginCommand) {
|
||||
cmd.unregister(this.commandMap);
|
||||
}
|
||||
}
|
||||
onCommand(plugin: any, command: any, executor: Function) {
|
||||
command.setExecutor(new CommandExecutor({
|
||||
onCommand: super.setExecutor(plugin, command, executor)
|
||||
}));
|
||||
}
|
||||
onTabComplete(plugin: any, command: any, tabCompleter: Function) {
|
||||
// Not Support
|
||||
}
|
||||
}
|
||||
21
packages/nukkit/src/console.ts
Normal file
21
packages/nukkit/src/console.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { MiaoScriptConsole } from '@ms/api'
|
||||
|
||||
let Nukkit = base.getInstance().getServer();
|
||||
let CommandSender = Java.type('cn.nukkit.command.CommandSender')
|
||||
|
||||
export class NukkitConsole extends MiaoScriptConsole {
|
||||
sender(sender, ...args) {
|
||||
if (!(sender instanceof CommandSender)) {
|
||||
this.error(`First parameter ${sender} not instanceof cn.nukkit.command.CommandSender can't send message!`)
|
||||
return;
|
||||
}
|
||||
if (Object.prototype.toString.call(args[0]) === "[object Array]") {
|
||||
args[0].forEach(line => sender.sendMessage(this.prefix + line))
|
||||
} else {
|
||||
sender.sendMessage(this.prefix + args.join(' '));
|
||||
}
|
||||
}
|
||||
console(...args: string[]): void {
|
||||
this.sender(Nukkit.getConsoleSender(), args.join(' '));
|
||||
}
|
||||
}
|
||||
47
packages/nukkit/src/event.ts
Normal file
47
packages/nukkit/src/event.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { event, plugin } from '@ms/api'
|
||||
import { inject, provideSingleton } from '@ms/container'
|
||||
|
||||
const Nukkit: cn.nukkit.Server = base.getInstance().getServer();
|
||||
const Event = Java.type("cn.nukkit.event.Event");
|
||||
const Modifier = Java.type("java.lang.reflect.Modifier");
|
||||
const Listener = Java.type("cn.nukkit.event.Listener");
|
||||
const EventPriority = Java.type("cn.nukkit.event.EventPriority");
|
||||
const EventExecutor = Java.type("cn.nukkit.plugin.EventExecutor");
|
||||
|
||||
@provideSingleton(event.Event)
|
||||
export class NukkitEvent extends event.Event {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any
|
||||
|
||||
constructor() {
|
||||
super('cn/nukkit/event');
|
||||
}
|
||||
|
||||
getJarFile(resource: string) {
|
||||
return super.getJarFile('cn/nukkit/Nukkit.class')
|
||||
}
|
||||
isValidEvent(clazz: any): boolean {
|
||||
// 继承于 org.bukkit.event.Event
|
||||
return Event.class.isAssignableFrom(clazz) &&
|
||||
// 访问符为Public
|
||||
Modifier.isPublic(clazz.getModifiers()) &&
|
||||
// 不是抽象类
|
||||
!Modifier.isAbstract(clazz.getModifiers());
|
||||
}
|
||||
register(eventCls: any, exec: Function, priority: event.EventPriority, ignoreCancel: boolean) {
|
||||
let listener = new Listener({});
|
||||
Nukkit.getPluginManager().registerEvent(
|
||||
eventCls,
|
||||
listener,
|
||||
EventPriority[priority],
|
||||
new EventExecutor({
|
||||
execute: exec
|
||||
}),
|
||||
this.pluginInstance,
|
||||
ignoreCancel);
|
||||
return listener;
|
||||
}
|
||||
unregister(event: any, listener: any): void {
|
||||
event.getMethod('getHandlers').invoke(null).unregister(listener);
|
||||
}
|
||||
}
|
||||
14
packages/nukkit/src/index.ts
Normal file
14
packages/nukkit/src/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/// <reference types="@ms/types/dist/typings/nukkit" />
|
||||
|
||||
import { server } from '@ms/api'
|
||||
import { Container } from '@ms/container'
|
||||
|
||||
import { NukkitConsole } from './console';
|
||||
import './event';
|
||||
import './server';
|
||||
import './command';
|
||||
import './task';
|
||||
|
||||
export default function NukkitImpl(container: Container) {
|
||||
container.bind(server.Console).toConstantValue(NukkitConsole);
|
||||
}
|
||||
35
packages/nukkit/src/server.ts
Normal file
35
packages/nukkit/src/server.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { server } from '@ms/api'
|
||||
import { provideSingleton } from '@ms/container';
|
||||
|
||||
let Nukkit: cn.nukkit.Server = base.getInstance().getServer();
|
||||
|
||||
@provideSingleton(server.Server)
|
||||
export class NukkitServer implements server.Server {
|
||||
getPlayer(name: string) {
|
||||
return Nukkit.getPlayer(name)
|
||||
}
|
||||
getVersion(): string {
|
||||
return Nukkit.getVersion()
|
||||
}
|
||||
getOnlinePlayers() {
|
||||
return Nukkit.getOnlinePlayers() as unknown as any[]
|
||||
}
|
||||
getConsoleSender() {
|
||||
return Nukkit.getConsoleSender()
|
||||
}
|
||||
getService(service: string) {
|
||||
return Nukkit.getServiceManager().getProvider(base.getClass(service))
|
||||
}
|
||||
dispatchCommand(sender: string | any, command: string): boolean {
|
||||
if (typeof sender === 'string') {
|
||||
sender = this.getPlayer(sender)
|
||||
}
|
||||
return Nukkit.dispatchCommand(sender, command)
|
||||
}
|
||||
dispatchConsoleCommand(command: string): boolean {
|
||||
return Nukkit.dispatchCommand(Nukkit.getConsoleSender(), command)
|
||||
}
|
||||
sendJson(sender: string | any, json: object | string): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}
|
||||
33
packages/nukkit/src/task.ts
Normal file
33
packages/nukkit/src/task.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { task, plugin } from '@ms/api'
|
||||
import { inject, provideSingleton } from '@ms/container';
|
||||
|
||||
const NukkitRunnable = Java.type('cn.nukkit.scheduler.NukkitRunnable');
|
||||
|
||||
@provideSingleton(task.TaskManager)
|
||||
export class NukkitTaskManager implements task.TaskManager {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any;
|
||||
|
||||
create(func: Function): task.Task {
|
||||
if (Object.prototype.toString.call(func) !== "[object Function]") { throw TypeError('第一个参数 Task 必须为 function !'); };
|
||||
return new NukkitTask(this.pluginInstance, func);
|
||||
}
|
||||
callSyncMethod(func: Function): any {
|
||||
return func()
|
||||
}
|
||||
}
|
||||
|
||||
export class NukkitTask extends task.Task {
|
||||
submit(): task.Cancelable {
|
||||
let run = new NukkitRunnable({
|
||||
run: () => this.run()
|
||||
})
|
||||
let funcName = `runTask${this.interval ? 'Timer' : 'Later'}${this.isAsync ? 'Asynchronously' : ''}`
|
||||
if (this.interval) {
|
||||
run[funcName](this.plugin, this.laterTime, this.interval);
|
||||
} else {
|
||||
run[funcName](this.plugin, this.laterTime);
|
||||
}
|
||||
return run;
|
||||
}
|
||||
}
|
||||
7
packages/nukkit/tsconfig.json
Normal file
7
packages/nukkit/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "src",
|
||||
"outDir": "dist"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ms/ployfill",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript ployfill package",
|
||||
"author": "MiaoWoo <admin@yumc.pw>",
|
||||
"homepage": "https://github.com/circlecloud/ms.git",
|
||||
@@ -17,12 +17,12 @@
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/nashorn": "^0.2.0",
|
||||
"@ms/nashorn": "^0.3.0",
|
||||
"core-js": "^3.6.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ declare global {
|
||||
stack(err: Error): string[];
|
||||
sender(...args: any): void;
|
||||
console(...args: any): void;
|
||||
i18n(name: string, ...params: any[]);
|
||||
}
|
||||
}
|
||||
export { }
|
||||
@@ -1,10 +1,12 @@
|
||||
/// <reference path="./global.ts" />
|
||||
/// <reference types='@ms/nashorn' />
|
||||
import i18n from '@ms/i18n'
|
||||
let ployfillStartTime = new Date().getTime();
|
||||
console.info('Initialization Java Nashorn ployfill. Please wait...');
|
||||
i18n.initialize();
|
||||
console.i18n("ms.ployfill.initialize");
|
||||
require('./es5-ext');
|
||||
require('core-js');
|
||||
global.setGlobal('Proxy', require('./proxy').Proxy)
|
||||
global.setGlobal('XMLHttpRequest', require('./xml-http-request').XMLHttpRequest)
|
||||
global.setGlobal('Blob', require('blob-polyfill').Blob)
|
||||
console.info('Java Nashorn ployfill loading completed... Cost (' + (new Date().getTime() - ployfillStartTime) / 1000 + 's)!');
|
||||
console.i18n("ms.ployfill.completed", { time: (new Date().getTime() - ployfillStartTime) / 1000 });
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ms/plugin",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript api package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -22,13 +22,16 @@
|
||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^3.12.2",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/api": "^0.2.0",
|
||||
"@ms/common": "^0.2.0",
|
||||
"@ms/container": "^0.2.0"
|
||||
"@ms/api": "^0.3.0",
|
||||
"@ms/common": "^0.3.0",
|
||||
"@ms/container": "^0.3.0",
|
||||
"@ms/i18n": "^0.3.0",
|
||||
"js-yaml": "^3.13.1"
|
||||
}
|
||||
}
|
||||
|
||||
40
packages/plugin/src/config.ts
Normal file
40
packages/plugin/src/config.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import * as yaml from 'js-yaml'
|
||||
|
||||
export interface PluginConfigLoader {
|
||||
load(content: string): any;
|
||||
dump(variable: any): string;
|
||||
}
|
||||
|
||||
export class YamlPluginConfig implements PluginConfigLoader {
|
||||
load(content: string) {
|
||||
return yaml.safeLoad(content);
|
||||
}
|
||||
dump(variable: any): string {
|
||||
return yaml.safeDump(variable);
|
||||
}
|
||||
}
|
||||
|
||||
export class JsonPluginConfig implements PluginConfigLoader {
|
||||
load(content: string) {
|
||||
return JSON.parse(content);
|
||||
}
|
||||
dump(variable: any): string {
|
||||
return JSON.stringify(variable);
|
||||
}
|
||||
}
|
||||
|
||||
const configLoaderMap = new Map<string, PluginConfigLoader>();
|
||||
|
||||
export function getConfigLoader(format: string) {
|
||||
if (!configLoaderMap.has(format)) { throw new Error(`Unsupport config format ${format} !`) }
|
||||
return configLoaderMap.get(format);
|
||||
}
|
||||
|
||||
function init() {
|
||||
configLoaderMap.set("json", new JsonPluginConfig())
|
||||
let yaml = new YamlPluginConfig()
|
||||
configLoaderMap.set("yml", yaml)
|
||||
configLoaderMap.set("yaml", yaml)
|
||||
}
|
||||
|
||||
init()
|
||||
@@ -24,7 +24,6 @@ export function plugin(metadata: interfaces.PluginMetadata) {
|
||||
*/
|
||||
export function cmd(metadata: interfaces.CommandMetadata = {}) {
|
||||
return function(target: any, key: string, value: any) {
|
||||
checkFunction("command", target[key]);
|
||||
metadata.name = metadata.name || key;
|
||||
metadata.executor = key;
|
||||
metadata.paramtypes = Reflect.getMetadata("design:paramtypes", target, key)
|
||||
@@ -40,7 +39,6 @@ export function cmd(metadata: interfaces.CommandMetadata = {}) {
|
||||
*/
|
||||
export function tab(metadata: interfaces.TabCompleterMetadata = {}) {
|
||||
return function(target: any, key: string, value: any) {
|
||||
checkFunction("tab", target[key]);
|
||||
metadata.name = metadata.name || (key.startsWith('tab') ? key.split('tab', 2)[1] : key);
|
||||
if (!metadata.name) { return; }
|
||||
metadata.executor = key;
|
||||
@@ -57,7 +55,6 @@ export function tab(metadata: interfaces.TabCompleterMetadata = {}) {
|
||||
*/
|
||||
export function listener(metadata: interfaces.ListenerMetadata = {}) {
|
||||
return function(target: any, key: string, value: any) {
|
||||
checkFunction("listener", target[key]);
|
||||
metadata.name = metadata.name || key;
|
||||
metadata.executor = key;
|
||||
const previousMetadata: interfaces.ListenerMetadata[] = getPluginListenerMetadata(target)
|
||||
@@ -65,20 +62,12 @@ export function listener(metadata: interfaces.ListenerMetadata = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
export function config(metadata: interfaces.ConfigMetadata = { version: 1 }) {
|
||||
return function(target: any, key: string, value: any) {
|
||||
if (typeof value === "function") {
|
||||
throw new Error(`decorate config must config at prototype but is a ${typeof value}!`)
|
||||
}
|
||||
export function config(metadata: interfaces.ConfigMetadata = { version: 1, format: 'yml' }) {
|
||||
return function(target: any, key: string) {
|
||||
metadata.name = metadata.name || key;
|
||||
metadata.variable = key;
|
||||
const previousMetadata: Map<string, interfaces.ConfigMetadata> = getPluginConfigMetadata(target)
|
||||
previousMetadata.set(metadata.name, metadata);
|
||||
Reflect.defineMetadata(METADATA_KEY.config, previousMetadata, target.constructor);
|
||||
}
|
||||
}
|
||||
|
||||
function checkFunction(type: string, value: any) {
|
||||
if (typeof value !== "function") {
|
||||
throw new Error(`decorate ${type} must config at function but is a ${typeof value}!`)
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,13 @@ export namespace interfaces {
|
||||
public disable() { }
|
||||
}
|
||||
interface BaseMetadata {
|
||||
/**
|
||||
* 名称 为空则为对象名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 支持的服务器列表 为空则代表所有
|
||||
*/
|
||||
servers?: string[];
|
||||
}
|
||||
export interface PluginMetadata extends BaseMetadata {
|
||||
@@ -50,18 +56,38 @@ export namespace interfaces {
|
||||
target?: any;
|
||||
}
|
||||
interface ExecMetadata extends BaseMetadata {
|
||||
/**
|
||||
* 执行器
|
||||
*/
|
||||
executor?: string;
|
||||
}
|
||||
export interface CommandMetadata extends ExecMetadata {
|
||||
/**
|
||||
* 参数列表
|
||||
*/
|
||||
paramtypes?: string[];
|
||||
}
|
||||
export interface TabCompleterMetadata extends ExecMetadata {
|
||||
/**
|
||||
* 参数列表
|
||||
*/
|
||||
paramtypes?: string[];
|
||||
}
|
||||
export interface ListenerMetadata extends ExecMetadata {
|
||||
}
|
||||
export interface ConfigMetadata extends BaseMetadata {
|
||||
/**
|
||||
* 配置文件版本号
|
||||
*/
|
||||
version?: number;
|
||||
/**
|
||||
* 实体变量名称
|
||||
*/
|
||||
variable?: string;
|
||||
/**
|
||||
* 配置文件格式 默认 yml
|
||||
*/
|
||||
format?: string;
|
||||
}
|
||||
export type PluginLike = Plugin | string;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
import i18n from '@ms/i18n'
|
||||
import { plugin, server, command, event } from '@ms/api'
|
||||
import { injectable, inject, postConstruct, Container, ContainerInstance } from '@ms/container'
|
||||
import { inject, provideSingleton, postConstruct, Container, ContainerInstance } from '@ms/container'
|
||||
import * as fs from '@ms/common/dist/fs'
|
||||
|
||||
import { getPluginMetadatas, getPluginCommandMetadata, getPluginListenerMetadata, getPlugin, getPluginTabCompleterMetadata, getPluginConfigMetadata } from './utils'
|
||||
import { interfaces } from './interfaces'
|
||||
import { getConfigLoader } from './config'
|
||||
|
||||
@injectable()
|
||||
@provideSingleton(plugin.PluginManager)
|
||||
export class PluginManagerImpl implements plugin.PluginManager {
|
||||
@inject(ContainerInstance)
|
||||
private container: Container
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any
|
||||
@inject(plugin.PluginFolder)
|
||||
private pluginFolder: string;
|
||||
@inject(server.ServerType)
|
||||
private serverType: string
|
||||
@inject(command.Command)
|
||||
@@ -24,9 +28,9 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
initialize() {
|
||||
if (this.pluginInstance !== null) {
|
||||
// 如果plugin不等于null 则代表是正式环境
|
||||
console.info(`Initialization MiaoScript Plugin System: ${this.pluginInstance} ...`)
|
||||
console.i18n('ms.plugin.initialize', { plugin: this.pluginInstance })
|
||||
this.pluginMap = new Map()
|
||||
console.info(`${this.EventManager.mapEventName().toFixed(0)} ${this.serverType} Event Mapping Complate...`)
|
||||
console.i18n('ms.plugin.event.map', { count: this.EventManager.mapEventName().toFixed(0), type: this.serverType });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +38,9 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
var plugin = fs.file(root, folder)
|
||||
var files = []
|
||||
// load common plugin
|
||||
.concat(this.scanFloder(plugin))
|
||||
.concat(this.scanFolder(plugin))
|
||||
// load space plugin
|
||||
.concat(this.scanFloder(fs.file(plugin, this.serverType)))
|
||||
.concat(this.scanFolder(fs.file(plugin, this.serverType)))
|
||||
this.loadPlugins(files)
|
||||
}
|
||||
|
||||
@@ -45,21 +49,21 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
}
|
||||
|
||||
private logStage(plugin: interfaces.Plugin, stage: string) {
|
||||
console.log(`[${plugin.description.name}] ${stage} ${plugin.description.name} version ${plugin.description.version} by ${plugin.description.author || 'Unknow'}`)
|
||||
console.i18n("ms.plugin.manager.stage", { stage, plugin: plugin.description.name, version: plugin.description.version, author: plugin.description.author })
|
||||
}
|
||||
|
||||
load(...args: any[]): void {
|
||||
this.checkAndGet(args[0]).forEach((plugin: interfaces.Plugin) => {
|
||||
this.logStage(plugin, "Loading")
|
||||
this.logStage(plugin, i18n.translate("ms.plugin.manager.stage.load"))
|
||||
this.loadConfig(plugin)
|
||||
this.runCatch(plugin, 'load')
|
||||
this.runCatch(plugin, `${this.serverType}load`)
|
||||
this.loadConfig(plugin)
|
||||
})
|
||||
}
|
||||
|
||||
enable(...args: any[]): void {
|
||||
this.checkAndGet(args[0]).forEach((plugin: interfaces.Plugin) => {
|
||||
this.logStage(plugin, "Enabling")
|
||||
this.logStage(plugin, i18n.translate("ms.plugin.manager.stage.enable"))
|
||||
this.runCatch(plugin, 'enable')
|
||||
this.runCatch(plugin, `${this.serverType}enable`)
|
||||
this.registryCommand(plugin)
|
||||
@@ -69,7 +73,7 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
|
||||
disable(...args: any[]): void {
|
||||
this.checkAndGet(args[0]).forEach((plugin: interfaces.Plugin) => {
|
||||
this.logStage(plugin, "Disabling")
|
||||
this.logStage(plugin, i18n.translate("ms.plugin.manager.stage.disable"))
|
||||
this.runCatch(plugin, 'disable')
|
||||
this.runCatch(plugin, `${this.serverType}disable`)
|
||||
this.unregistryCommand(plugin)
|
||||
@@ -95,7 +99,7 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
try {
|
||||
if (pl[func]) pl[func].call(pl)
|
||||
} catch (ex) {
|
||||
console.console(`§6插件 §b${pl.description.name} §6执行 §d${func} §6方法时发生错误 §4${ex}`)
|
||||
console.console(`§6Plugin §b${pl.description.name} §6exec §d${func} §6function error §4${ex}`)
|
||||
console.ex(ex)
|
||||
}
|
||||
}
|
||||
@@ -107,12 +111,12 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
throw new Error(`Plugin ${JSON.stringify(name)} not exist!`)
|
||||
}
|
||||
|
||||
private scanFloder(plugin: any): string[] {
|
||||
private scanFolder(folder: any): string[] {
|
||||
var files = []
|
||||
console.info(`Scanning Plugins in ${plugin} ...`)
|
||||
this.checkUpdateFolder(plugin)
|
||||
console.i18n('ms.plugin.manager.scan', { folder })
|
||||
this.checkUpdateFolder(folder)
|
||||
// must check file is exist maybe is a illegal symbolic link file
|
||||
fs.list(plugin).forEach((file: any) => file.toFile().exists() ? files.push(file.toFile()) : void 0)
|
||||
fs.list(folder).forEach((file: any) => file.toFile().exists() ? files.push(file.toFile()) : void 0)
|
||||
return files
|
||||
}
|
||||
|
||||
@@ -143,7 +147,7 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
this.updatePlugin(file)
|
||||
this.createPlugin(file)
|
||||
} catch (ex) {
|
||||
console.console(`§6插件 §b${file.name} §6初始化时发生错误 §4${ex.message}`)
|
||||
console.i18n("ms.plugin.manager.initialize.error", { name: file.name, ex })
|
||||
console.ex(ex)
|
||||
}
|
||||
}
|
||||
@@ -151,14 +155,15 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
private updatePlugin(file: any) {
|
||||
var update = fs.file(fs.file(file.parentFile, 'update'), file.name)
|
||||
if (update.exists()) {
|
||||
console.info(`Auto Update Plugin ${file.name} ...`)
|
||||
console.i18n("ms.plugin.manager.build.update", { name: file.name })
|
||||
fs.move(update, file, true)
|
||||
}
|
||||
}
|
||||
|
||||
private checkServers(servers: string[]) {
|
||||
if (!servers) { return true }
|
||||
return servers?.indexOf(this.serverType) != -1 && servers?.indexOf(`!${this.serverType}`) == -1
|
||||
if (servers.indexOf(`!${this.serverType}`) != -1) { return false }
|
||||
return servers?.indexOf(this.serverType) != -1
|
||||
}
|
||||
|
||||
private createPlugin(file: string) {
|
||||
@@ -178,7 +183,7 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
this.bindPlugin(metadata)
|
||||
let pluginInstance = this.container.getNamed<interfaces.Plugin>(plugin.Plugin, metadata.name)
|
||||
if (!(pluginInstance instanceof interfaces.Plugin)) {
|
||||
console.console(`§4found error plugin §b${metadata.source} §4it's not extends interfaces.Plugin, the plugin will be ignore!`)
|
||||
console.i18n('ms.plugin.manager.build.not.extends', { source: metadata.source })
|
||||
return
|
||||
}
|
||||
this.pluginMap.set(metadata.name, pluginInstance)
|
||||
@@ -189,7 +194,7 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
try {
|
||||
let pluginInstance = this.container.getNamed<interfaces.Plugin>(plugin.Plugin, metadata.name)
|
||||
if (pluginInstance.description.source + '' !== metadata.source + '') {
|
||||
console.console(`§4found duplicate plugin §b${pluginInstance.description.source} §4and §b${metadata.source}§4. the first plugin will be ignore!`)
|
||||
console.i18n('ms.plugin.manager.build.duplicate', { exists: pluginInstance.description.source, source: metadata.source })
|
||||
}
|
||||
this.container.rebind(plugin.Plugin).to(metadata.target).inSingletonScope().whenTargetNamed(metadata.name)
|
||||
} catch{
|
||||
@@ -197,9 +202,18 @@ export class PluginManagerImpl implements plugin.PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
private loadConfig(pluginInstance: interfaces.Plugin) {
|
||||
let configs = getPluginConfigMetadata(pluginInstance);
|
||||
|
||||
private loadConfig(plugin: interfaces.Plugin) {
|
||||
let configs = getPluginConfigMetadata(plugin);
|
||||
for (let [_, config] of configs) {
|
||||
let configFile = fs.concat(root, this.pluginFolder, plugin.description.name, config.name + '.' + config.format)
|
||||
let configFactory = getConfigLoader(config.format);
|
||||
if (!fs.exists(configFile)) {
|
||||
base.save(configFile, configFactory.dump(plugin[config.variable]))
|
||||
console.i18n("ms.plugin.manager.config.save.default", { plugin: plugin.description.name, name: config.name, format: config.format })
|
||||
} else {
|
||||
plugin[config.variable] = configFactory.load(base.read(configFile));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private registryCommand(pluginInstance: interfaces.Plugin) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@ms/plugins",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript plugins package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -25,10 +25,10 @@
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/plugin": "^0.2.0",
|
||||
"@ms/plugin": "^0.3.0",
|
||||
"axios": "^0.19.2",
|
||||
"es6-map": "^0.1.5",
|
||||
"inversify": "^5.0.1"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/// <reference types="@ms/types/dist/typings/bukkit" />
|
||||
/// <reference types="@ms/types/dist/typings/sponge" />
|
||||
/// <reference types="@ms/types/dist/typings/bungee" />
|
||||
/// <reference types="@ms/types/dist/typings/nukkit" />
|
||||
|
||||
import { server } from '@ms/api';
|
||||
import { inject } from '@ms/container';
|
||||
@@ -62,7 +63,7 @@ export class HelloWorld extends interfaces.Plugin {
|
||||
return ['world']
|
||||
}
|
||||
|
||||
@listener({ servers: ['bukkit'] })
|
||||
@listener({ servers: ['bukkit', 'nukkit'] })
|
||||
PlayerJoin(event: org.bukkit.event.player.PlayerJoinEvent) {
|
||||
let plyaer = event.getPlayer();
|
||||
this.logger.console(`§cBukkit §aPlayerJoinEvent: §b${plyaer.getName()}`)
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/// <reference types="@ms/types/dist/typings/sponge" />
|
||||
/// <reference types="@ms/types/dist/typings/bungee" />
|
||||
|
||||
import { server, plugin as pluginApi } from '@ms/api'
|
||||
import { server, plugin as pluginApi, channel } from '@ms/api'
|
||||
import { inject } from '@ms/container';
|
||||
import { plugin, interfaces, cmd, listener, tab } from '@ms/plugin'
|
||||
import { plugin, interfaces, cmd, listener, tab, config } from '@ms/plugin'
|
||||
import Tellraw from '@ms/common/dist/tellraw'
|
||||
|
||||
const ByteArrayInputStream = Java.type("java.io.ByteArrayInputStream");
|
||||
@@ -20,8 +20,6 @@ const BiConsumer = Java.type('java.util.function.BiConsumer')
|
||||
class MiaoMessage {
|
||||
// public static final String CHANNEL = "MiaoChat:Default".toLowerCase();
|
||||
public static CHANNEL: string = "MiaoChat:Default".toLowerCase()
|
||||
// public static final String NORMAL_CHANNEL = "MiaoChat:Normal".toLowerCase();
|
||||
public static NORMAL_CHANNEL: string = "MiaoChat:Normal".toLowerCase()
|
||||
// private static final int MAX_MESSAGE_LENGTH = 32000;
|
||||
private static MAX_MESSAGE_LENGTH = 32000;
|
||||
|
||||
@@ -60,12 +58,12 @@ export class MiaoChat extends interfaces.Plugin {
|
||||
private Server: server.Server
|
||||
@inject(server.ServerType)
|
||||
private ServerType: string
|
||||
@inject(channel.Channel)
|
||||
private Channel: channel.Channel
|
||||
|
||||
private spongeChannel: any;
|
||||
private spongeListener: any;
|
||||
|
||||
@config()
|
||||
private config = {
|
||||
Version: "1.8.5",
|
||||
Version: "1.0.0",
|
||||
BungeeCord: true,
|
||||
Server: "生存服",
|
||||
ChatFormats: {
|
||||
@@ -171,6 +169,9 @@ export class MiaoChat extends interfaces.Plugin {
|
||||
return string;
|
||||
}
|
||||
}
|
||||
this.Channel.listen(this, MiaoMessage.CHANNEL, (data) => {
|
||||
this.sendChatAll(MiaoMessage.decode(data).json)
|
||||
})
|
||||
}
|
||||
|
||||
disable() {
|
||||
@@ -185,20 +186,9 @@ export class MiaoChat extends interfaces.Plugin {
|
||||
} catch (ex) {
|
||||
this.logger.console("§cCan't found me.clip.placeholderapi.PlaceholderAPI variable will not be replaced! Err: " + ex)
|
||||
}
|
||||
var Bukkit = org.bukkit.Bukkit;
|
||||
var PluginMessageListener = Java.type("org.bukkit.plugin.messaging.PluginMessageListener")
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(base.getInstance(), MiaoMessage.CHANNEL, new PluginMessageListener({
|
||||
onPluginMessageReceived: (/**String */ var1, /**Player */ var2, /**byte[] */var3) => {
|
||||
this.sendChatAll(MiaoMessage.decode(var3).json)
|
||||
}
|
||||
}));
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(base.getInstance(), MiaoMessage.CHANNEL);
|
||||
}
|
||||
|
||||
bukkitdisable() {
|
||||
var Bukkit = org.bukkit.Bukkit;
|
||||
Bukkit.getMessenger().unregisterIncomingPluginChannel(base.getInstance(), MiaoMessage.CHANNEL)
|
||||
Bukkit.getMessenger().unregisterOutgoingPluginChannel(base.getInstance(), MiaoMessage.CHANNEL)
|
||||
}
|
||||
|
||||
spongeenable() {
|
||||
@@ -217,32 +207,15 @@ export class MiaoChat extends interfaces.Plugin {
|
||||
} catch (ex) {
|
||||
this.logger.console("§cCan't found me.rojo8399.placeholderapi.PlaceholderService variable will not be replaced! Err: " + ex)
|
||||
}
|
||||
var Sponge = org.spongepowered.api.Sponge
|
||||
var RawDataListener = Java.type("org.spongepowered.api.network.RawDataListener")
|
||||
var ChannelRegistrar = Sponge.getChannelRegistrar()
|
||||
this.spongeChannel = ChannelRegistrar.getOrCreateRaw(base.getInstance(), MiaoMessage.CHANNEL)
|
||||
this.spongeListener = new RawDataListener({
|
||||
handlePayload: (/* ChannelBuf */ data, /**RemoteConnection */ connection, /**Platform.Type */ side) => {
|
||||
this.sendChatAll(MiaoMessage.decode(data.readBytes(data.available())).json)
|
||||
}
|
||||
})
|
||||
this.spongeChannel.addListener(this.spongeListener)
|
||||
}
|
||||
|
||||
spongedisable() {
|
||||
this.spongeChannel.removeListener(this.spongeListener)
|
||||
}
|
||||
|
||||
bungeeenable() {
|
||||
let bungee: net.md_5.bungee.api.ProxyServer = base.getInstance().getProxy()
|
||||
bungee.registerChannel(MiaoMessage.CHANNEL);
|
||||
bungee.registerChannel(MiaoMessage.NORMAL_CHANNEL);
|
||||
}
|
||||
|
||||
bungeedisable() {
|
||||
let bungee: net.md_5.bungee.api.ProxyServer = base.getInstance().getProxy()
|
||||
bungee.unregisterChannel(MiaoMessage.CHANNEL);
|
||||
bungee.unregisterChannel(MiaoMessage.NORMAL_CHANNEL);
|
||||
}
|
||||
|
||||
@cmd({ servers: ["bungee"] })
|
||||
@@ -288,7 +261,7 @@ export class MiaoChat extends interfaces.Plugin {
|
||||
PluginMessageEvent(e: any) {
|
||||
let bungee: net.md_5.bungee.api.ProxyServer = base.getInstance().getProxy()
|
||||
let event = e as net.md_5.bungee.api.event.PluginMessageEvent
|
||||
if (event.getTag() == MiaoMessage.CHANNEL || event.getTag() == MiaoMessage.NORMAL_CHANNEL) {
|
||||
if (event.getTag() == MiaoMessage.CHANNEL) {
|
||||
let origin = event.getSender().getAddress();
|
||||
bungee.getServers().forEach(new BiConsumer({
|
||||
accept: (s, server) => {
|
||||
@@ -360,27 +333,7 @@ export class MiaoChat extends interfaces.Plugin {
|
||||
});
|
||||
let json = tr.then(this.replace(player, plain)).json()
|
||||
this.sendChatAll(json)
|
||||
let mm = MiaoMessage.encode(json);
|
||||
switch (this.ServerType) {
|
||||
case "bukkit":
|
||||
if (mm == null) {
|
||||
player.sendPluginMessage(base.getInstance(), MiaoMessage.NORMAL_CHANNEL, MiaoMessage.encode(tr.string()));
|
||||
} else {
|
||||
player.sendPluginMessage(base.getInstance(), MiaoMessage.CHANNEL, mm);
|
||||
}
|
||||
break;
|
||||
case "sponge":
|
||||
if (mm == null) {
|
||||
this.spongeChannel.sendTo(player, new Consumer({
|
||||
accept: (channelBuf) => channelBuf.writeBytes(MiaoMessage.encode(tr.string()))
|
||||
}))
|
||||
} else {
|
||||
this.spongeChannel.sendTo(player, new Consumer({
|
||||
accept: (channelBuf) => channelBuf.writeBytes(mm)
|
||||
}))
|
||||
}
|
||||
break;
|
||||
}
|
||||
this.Channel.send(player, MiaoMessage.CHANNEL, MiaoMessage.encode(json))
|
||||
}
|
||||
|
||||
sendChatAll(json: string) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ms/sponge",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"description": "MiaoScript api package",
|
||||
"keywords": [
|
||||
"miaoscript",
|
||||
@@ -24,12 +24,12 @@
|
||||
"devDependencies": {
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "^3.7.5"
|
||||
"typescript": "^3.8.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ms/api": "^0.2.0",
|
||||
"@ms/common": "^0.2.0",
|
||||
"@ms/container": "^0.2.0",
|
||||
"@ms/types": "^0.2.0"
|
||||
"@ms/api": "^0.3.0",
|
||||
"@ms/common": "^0.3.0",
|
||||
"@ms/container": "^0.3.0",
|
||||
"@ms/types": "^0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
38
packages/sponge/src/channel.ts
Normal file
38
packages/sponge/src/channel.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { channel, plugin } from '@ms/api'
|
||||
import { inject, provideSingleton } from '@ms/container'
|
||||
|
||||
const Sponge = org.spongepowered.api.Sponge
|
||||
const RawDataListener = Java.type("org.spongepowered.api.network.RawDataListener")
|
||||
const ChannelRegistrar = Sponge.getChannelRegistrar()
|
||||
const Consumer = Java.type("java.util.function.Consumer");
|
||||
|
||||
@provideSingleton(channel.Channel)
|
||||
export class SpongeChannel extends channel.Channel {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any;
|
||||
|
||||
private channelMap = new Map<string, any>();
|
||||
|
||||
send(player: any, channel: string, data: any) {
|
||||
if (!this.channelMap.has(channel)) { return }
|
||||
this.channelMap.get(channel).sendTo(player, new Consumer({
|
||||
accept: (channelBuf: any) => channelBuf.writeBytes(data)
|
||||
}))
|
||||
}
|
||||
register(channel: string, listener: channel.ChannelListener) {
|
||||
if (!this.channelMap.has(channel)) {
|
||||
this.channelMap.set(channel, ChannelRegistrar.getOrCreateRaw(this.pluginInstance, channel))
|
||||
}
|
||||
let innerListener = new RawDataListener({
|
||||
handlePayload: (/* ChannelBuf */ data: any, /**RemoteConnection */ connection: any, /**Platform.Type */ side: any) => {
|
||||
listener(data.readBytes(data.available()))
|
||||
}
|
||||
})
|
||||
this.channelMap.get(channel).addListener(innerListener);
|
||||
return innerListener;
|
||||
}
|
||||
unregister(channel: string, listener: any) {
|
||||
if (!this.channelMap.has(channel)) { return }
|
||||
this.channelMap.get(channel).removeListener(listener);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,43 @@
|
||||
import { command, plugin } from "@ms/api";
|
||||
import { inject, injectable } from "@ms/container";
|
||||
import { inject, provideSingleton } from "@ms/container";
|
||||
|
||||
let Sponge = Java.type('org.spongepowered.api.Sponge');
|
||||
|
||||
let Text = Java.type('org.spongepowered.api.text.Text');
|
||||
var CommandCallable = Java.type('org.spongepowered.api.command.CommandCallable');
|
||||
var CommandResult = Java.type('org.spongepowered.api.command.CommandResult');
|
||||
|
||||
let Text = Java.type('org.spongepowered.api.text.Text');
|
||||
|
||||
var Optional = Java.type('java.util.Optional');
|
||||
|
||||
@provideSingleton(command.Command)
|
||||
export class SpongeCommand extends command.Command {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any
|
||||
private commandMapping: any[] = [];
|
||||
|
||||
create(plugin: any, command: string) {
|
||||
let commandKey = this.getCommandKey(plugin, command);
|
||||
let commandCallable = new SimpleCommandCallable(command);
|
||||
this.commandMapping[commandKey] = Sponge.getCommandManager().register(this.pluginInstance, commandCallable.callable, command, commandKey).orElse(null);
|
||||
return commandCallable;
|
||||
}
|
||||
remove(plugin: any, command: string) {
|
||||
var commandKey = this.getCommandKey(plugin, command);
|
||||
if (this.commandMapping[commandKey]) {
|
||||
Sponge.getCommandManager().removeMapping(this.commandMapping[commandKey]);
|
||||
delete this.commandMapping[commandKey];
|
||||
}
|
||||
}
|
||||
onCommand(plugin: any, command: any, executor: Function) {
|
||||
command.setExecutor(super.setExecutor(plugin, command, executor));
|
||||
}
|
||||
onTabComplete(plugin: any, command: any, tabCompleter: Function) {
|
||||
command.setTabCompleter(super.setTabCompleter(plugin, command, tabCompleter));
|
||||
}
|
||||
|
||||
private getCommandKey(plugin: any, command: string) {
|
||||
return plugin.description.name.toLowerCase() + ":" + command;
|
||||
}
|
||||
}
|
||||
|
||||
class SimpleCommandCallable {
|
||||
public callable: any;
|
||||
private name: string;
|
||||
@@ -49,35 +77,4 @@ class SimpleCommandCallable {
|
||||
setExecutor = (executor: Function) => this.executor = executor;
|
||||
setTabCompleter = (tabCompleter: Function) => this.tabCompleter = tabCompleter;
|
||||
toString = () => `Sponge SimpleCommandCallable(${this.name})`
|
||||
}
|
||||
|
||||
@injectable()
|
||||
export class SpongeCommand extends command.Command {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any
|
||||
private commandMapping: any[] = [];
|
||||
|
||||
create(plugin: any, command: string) {
|
||||
let commandKey = this.getCommandKey(plugin, command);
|
||||
let commandCallable = new SimpleCommandCallable(command);
|
||||
this.commandMapping[commandKey] = Sponge.getCommandManager().register(this.pluginInstance, commandCallable.callable, command, commandKey).orElse(null);
|
||||
return commandCallable;
|
||||
}
|
||||
remove(plugin: any, command: string) {
|
||||
var commandKey = this.getCommandKey(plugin, command);
|
||||
if (this.commandMapping[commandKey]) {
|
||||
Sponge.getCommandManager().removeMapping(this.commandMapping[commandKey]);
|
||||
delete this.commandMapping[commandKey];
|
||||
}
|
||||
}
|
||||
onCommand(plugin: any, command: any, executor: Function) {
|
||||
command.setExecutor(super.setExecutor(plugin, command, executor));
|
||||
}
|
||||
onTabComplete(plugin: any, command: any, tabCompleter: Function) {
|
||||
command.setTabCompleter(super.setTabCompleter(plugin, command, tabCompleter));
|
||||
}
|
||||
|
||||
private getCommandKey(plugin: any, command: string) {
|
||||
return plugin.description.name.toLowerCase() + ":" + command;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { event, plugin } from '@ms/api'
|
||||
import { injectable, inject } from '@ms/container';
|
||||
import { inject, provideSingleton } from '@ms/container';
|
||||
|
||||
let Modifier = Java.type("java.lang.reflect.Modifier");
|
||||
let Order = Java.type("org.spongepowered.api.event.Order");
|
||||
@@ -19,7 +19,7 @@ let priorityMap = {
|
||||
/**
|
||||
* Sponge Event Impl
|
||||
*/
|
||||
@injectable()
|
||||
@provideSingleton(event.Event)
|
||||
export class SpongeEvent extends event.Event {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any;
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
/// <reference types="@ms/types/dist/typings/sponge" />
|
||||
|
||||
import { server, command, event, task } from '@ms/api'
|
||||
import { server } from '@ms/api'
|
||||
import { Container } from '@ms/container'
|
||||
|
||||
import { SpongeConsole } from './console';
|
||||
import { SpongeEvent } from './event';
|
||||
import { SpongeServer } from './server';
|
||||
import { SpongeCommand } from './command';
|
||||
import { SpongeTaskManager } from './task';
|
||||
import './event';
|
||||
import './server';
|
||||
import './command';
|
||||
import './channel';
|
||||
import './task';
|
||||
|
||||
export default function SpongeImpl(container: Container) {
|
||||
container.bind(server.Console).toConstantValue(SpongeConsole);
|
||||
container.bind(event.Event).to(SpongeEvent).inSingletonScope();
|
||||
container.bind(server.Server).to(SpongeServer).inSingletonScope();
|
||||
container.bind(command.Command).to(SpongeCommand).inSingletonScope();
|
||||
container.bind(task.TaskManager).to(SpongeTaskManager).inSingletonScope();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { server } from '@ms/api'
|
||||
import { injectable } from '@ms/container';
|
||||
import { provideSingleton } from '@ms/container';
|
||||
|
||||
let Sponge = org.spongepowered.api.Sponge;
|
||||
let TextSerializers = org.spongepowered.api.text.serializer.TextSerializers;
|
||||
|
||||
@injectable()
|
||||
@provideSingleton(server.Server)
|
||||
export class SpongeServer implements server.Server {
|
||||
getPlayer(name: string) {
|
||||
return Sponge.getServer().getPlayer(name).orElse(null)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { task, plugin } from '@ms/api'
|
||||
import { injectable, inject } from '@ms/container';
|
||||
import { inject, provideSingleton } from '@ms/container';
|
||||
|
||||
const Sponge = Java.type("org.spongepowered.api.Sponge");
|
||||
const Task = Java.type("org.spongepowered.api.scheduler.Task");
|
||||
@@ -7,7 +7,7 @@ const Consumer = Java.type('java.util.function.Consumer');
|
||||
const Callable = Java.type('java.util.concurrent.Callable');
|
||||
const TimeUnit = Java.type('java.util.concurrent.TimeUnit');
|
||||
|
||||
@injectable()
|
||||
@provideSingleton(task.TaskManager)
|
||||
export class SpongeTaskManager implements task.TaskManager {
|
||||
@inject(plugin.PluginInstance)
|
||||
private pluginInstance: any;
|
||||
|
||||
23
packages/types/dist/typings/nukkit/cn.nukkit.Achievement.d.ts
vendored
Normal file
23
packages/types/dist/typings/nukkit/cn.nukkit.Achievement.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
// @ts-ignore
|
||||
class Achievement extends java.lang.Object {
|
||||
// @ts-ignore
|
||||
constructor(message: string, requires: string)
|
||||
// @ts-ignore
|
||||
public static achievements: java.util.HashMap;
|
||||
// @ts-ignore
|
||||
public message: string;
|
||||
// @ts-ignore
|
||||
public requires: java.lang.String[];
|
||||
// @ts-ignore
|
||||
public static broadcast(player: cn.nukkit.Player, achievementId: string): boolean;
|
||||
// @ts-ignore
|
||||
public static add(name: string, achievement: cn.nukkit.Achievement): boolean;
|
||||
// @ts-ignore
|
||||
public getMessage(): string;
|
||||
// @ts-ignore
|
||||
public broadcast(player: cn.nukkit.Player): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
packages/types/dist/typings/nukkit/cn.nukkit.AdventureSettings.Type.d.ts
vendored
Normal file
45
packages/types/dist/typings/nukkit/cn.nukkit.AdventureSettings.Type.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace AdventureSettings {
|
||||
// @ts-ignore
|
||||
class Type extends java.lang.Enum {
|
||||
// @ts-ignore
|
||||
public static WORLD_IMMUTABLE: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static AUTO_JUMP: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static ALLOW_FLIGHT: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static NO_CLIP: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static WORLD_BUILDER: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static FLYING: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static MUTED: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static BUILD_AND_MINE: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static DOORS_AND_SWITCHED: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static OPEN_CONTAINERS: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static ATTACK_PLAYERS: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static ATTACK_MOBS: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static OPERATOR: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static TELEPORT: cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public static values(): cn.nukkit.AdventureSettings.Type[];
|
||||
// @ts-ignore
|
||||
public static valueOf(name: string): cn.nukkit.AdventureSettings.Type;
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getDefaultValue(): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
packages/types/dist/typings/nukkit/cn.nukkit.AdventureSettings.d.ts
vendored
Normal file
27
packages/types/dist/typings/nukkit/cn.nukkit.AdventureSettings.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
// @ts-ignore
|
||||
class AdventureSettings extends java.lang.Object {
|
||||
// @ts-ignore
|
||||
constructor(player: cn.nukkit.Player)
|
||||
// @ts-ignore
|
||||
public static PERMISSION_NORMAL: number;
|
||||
// @ts-ignore
|
||||
public static PERMISSION_OPERATOR: number;
|
||||
// @ts-ignore
|
||||
public static PERMISSION_HOST: number;
|
||||
// @ts-ignore
|
||||
public static PERMISSION_AUTOMATION: number;
|
||||
// @ts-ignore
|
||||
public static PERMISSION_ADMIN: number;
|
||||
// @ts-ignore
|
||||
public clone(newPlayer: cn.nukkit.Player): cn.nukkit.AdventureSettings;
|
||||
// @ts-ignore
|
||||
public set(type: cn.nukkit.AdventureSettings.Type, value: boolean): cn.nukkit.AdventureSettings;
|
||||
// @ts-ignore
|
||||
public get(type: cn.nukkit.AdventureSettings.Type): boolean;
|
||||
// @ts-ignore
|
||||
public update(): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
82
packages/types/dist/typings/nukkit/cn.nukkit.IPlayer.d.ts
vendored
Normal file
82
packages/types/dist/typings/nukkit/cn.nukkit.IPlayer.d.ts
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
// @ts-ignore
|
||||
interface IPlayer extends cn.nukkit.permission.ServerOperator, cn.nukkit.metadata.Metadatable {
|
||||
/**
|
||||
* 返回这个玩家是否在线。<br>
|
||||
* Returns if this player is online.
|
||||
*/
|
||||
// @ts-ignore
|
||||
isOnline(): boolean;
|
||||
/**
|
||||
* 返回这个玩家的名称。<br>
|
||||
* Returns the name of this player.
|
||||
* <p>如果是在线的玩家,这个函数只会返回登录名字。如果要返回显示的名字,参见{@link cn.nukkit.Player#getDisplayName}<br>
|
||||
* Notice that this will only return its login name. If you need its display name, turn to
|
||||
* {@link cn.nukkit.Player#getDisplayName}</p>
|
||||
*/
|
||||
// @ts-ignore
|
||||
getName(): string;
|
||||
// @ts-ignore
|
||||
getUniqueId(): java.util.UUID;
|
||||
/**
|
||||
* 返回这个玩家是否被封禁(ban)。<br>
|
||||
* Returns if this player is banned.
|
||||
*/
|
||||
// @ts-ignore
|
||||
isBanned(): boolean;
|
||||
/**
|
||||
* 设置这个玩家是否被封禁(ban)。<br>
|
||||
* Sets this player to be banned or to be pardoned.
|
||||
*/
|
||||
// @ts-ignore
|
||||
setBanned(value: boolean): void;
|
||||
/**
|
||||
* 返回这个玩家是否已加入白名单。<br>
|
||||
* Returns if this player is pardoned by whitelist.
|
||||
*/
|
||||
// @ts-ignore
|
||||
isWhitelisted(): boolean;
|
||||
/**
|
||||
* 把这个玩家加入白名单,或者取消这个玩家的白名单。<br>
|
||||
* Adds this player to the white list, or removes it from the whitelist.
|
||||
*/
|
||||
// @ts-ignore
|
||||
setWhitelisted(value: boolean): void;
|
||||
/**
|
||||
* 得到这个接口的{@code Player}对象。<br>
|
||||
* Returns a {@code Player} object for this interface.
|
||||
*/
|
||||
// @ts-ignore
|
||||
getPlayer(): cn.nukkit.Player;
|
||||
/**
|
||||
* 返回玩家所在的服务器。<br>
|
||||
* Returns the server carrying this player.
|
||||
*/
|
||||
// @ts-ignore
|
||||
getServer(): cn.nukkit.Server;
|
||||
/**
|
||||
* 得到这个玩家第一次游戏的时间。<br>
|
||||
* Returns the time this player first played in this server.
|
||||
*/
|
||||
// @ts-ignore
|
||||
getFirstPlayed(): java.lang.Long;
|
||||
/**
|
||||
* 得到这个玩家上次加入游戏的时间。<br>
|
||||
* Returns the time this player last joined in this server.
|
||||
*/
|
||||
// @ts-ignore
|
||||
getLastPlayed(): java.lang.Long;
|
||||
/**
|
||||
* 返回这个玩家以前是否来过服务器。<br>
|
||||
* Returns if this player has played in this server before.
|
||||
* <p>如果想得到这个玩家是不是第一次玩,可以使用:<br>
|
||||
* If you want to know if this player is the first time playing in this server, you can use:<br>
|
||||
* </p>
|
||||
* <pre>if(!player.hasPlayerBefore()) {...}</pre>
|
||||
*/
|
||||
// @ts-ignore
|
||||
hasPlayedBefore(): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
packages/types/dist/typings/nukkit/cn.nukkit.InterruptibleThread.d.ts
vendored
Normal file
7
packages/types/dist/typings/nukkit/cn.nukkit.InterruptibleThread.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
// @ts-ignore
|
||||
interface InterruptibleThread {
|
||||
}
|
||||
}
|
||||
}
|
||||
43
packages/types/dist/typings/nukkit/cn.nukkit.Nukkit.d.ts
vendored
Normal file
43
packages/types/dist/typings/nukkit/cn.nukkit.Nukkit.d.ts
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
// @ts-ignore
|
||||
class Nukkit extends java.lang.Object {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public static GIT_INFO: java.util.Properties;
|
||||
// @ts-ignore
|
||||
public static VERSION: string;
|
||||
// @ts-ignore
|
||||
public static API_VERSION: string;
|
||||
// @ts-ignore
|
||||
public static CODENAME: string;
|
||||
// @ts-ignore
|
||||
public static MINECRAFT_VERSION: string;
|
||||
// @ts-ignore
|
||||
public static MINECRAFT_VERSION_NETWORK: string;
|
||||
// @ts-ignore
|
||||
public static PATH: string;
|
||||
// @ts-ignore
|
||||
public static DATA_PATH: string;
|
||||
// @ts-ignore
|
||||
public static PLUGIN_PATH: string;
|
||||
// @ts-ignore
|
||||
public static START_TIME: number;
|
||||
// @ts-ignore
|
||||
public static ANSI: boolean;
|
||||
// @ts-ignore
|
||||
public static TITLE: boolean;
|
||||
// @ts-ignore
|
||||
public static shortTitle: boolean;
|
||||
// @ts-ignore
|
||||
public static DEBUG: number;
|
||||
// @ts-ignore
|
||||
public static main(args: string): void;
|
||||
// @ts-ignore
|
||||
public static setLogLevel(level: Level): void;
|
||||
// @ts-ignore
|
||||
public static getLogLevel(): Level;
|
||||
}
|
||||
}
|
||||
}
|
||||
53
packages/types/dist/typings/nukkit/cn.nukkit.OfflinePlayer.d.ts
vendored
Normal file
53
packages/types/dist/typings/nukkit/cn.nukkit.OfflinePlayer.d.ts
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
// @ts-ignore
|
||||
class OfflinePlayer extends java.lang.Object implements cn.nukkit.IPlayer {
|
||||
/**
|
||||
* 初始化这个{@code OfflinePlayer}对象。<br>
|
||||
* Initializes the object {@code OfflinePlayer}.
|
||||
*/
|
||||
// @ts-ignore
|
||||
constructor(server: cn.nukkit.Server, uuid: java.util.UUID)
|
||||
// @ts-ignore
|
||||
constructor(server: cn.nukkit.Server, name: string)
|
||||
// @ts-ignore
|
||||
constructor(server: cn.nukkit.Server, uuid: java.util.UUID, name: string)
|
||||
// @ts-ignore
|
||||
public isOnline(): boolean;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getUniqueId(): java.util.UUID;
|
||||
// @ts-ignore
|
||||
public getServer(): cn.nukkit.Server;
|
||||
// @ts-ignore
|
||||
public isOp(): boolean;
|
||||
// @ts-ignore
|
||||
public setOp(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public isBanned(): boolean;
|
||||
// @ts-ignore
|
||||
public setBanned(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public isWhitelisted(): boolean;
|
||||
// @ts-ignore
|
||||
public setWhitelisted(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public getPlayer(): cn.nukkit.Player;
|
||||
// @ts-ignore
|
||||
public getFirstPlayed(): java.lang.Long;
|
||||
// @ts-ignore
|
||||
public getLastPlayed(): java.lang.Long;
|
||||
// @ts-ignore
|
||||
public hasPlayedBefore(): boolean;
|
||||
// @ts-ignore
|
||||
public setMetadata(metadataKey: string, newMetadataValue: cn.nukkit.metadata.MetadataValue): void;
|
||||
// @ts-ignore
|
||||
public getMetadata(metadataKey: string): java.util.List;
|
||||
// @ts-ignore
|
||||
public hasMetadata(metadataKey: string): boolean;
|
||||
// @ts-ignore
|
||||
public removeMetadata(metadataKey: string, owningPlugin: cn.nukkit.plugin.Plugin): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
731
packages/types/dist/typings/nukkit/cn.nukkit.Player.d.ts
vendored
Normal file
731
packages/types/dist/typings/nukkit/cn.nukkit.Player.d.ts
vendored
Normal file
@@ -0,0 +1,731 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
// @ts-ignore
|
||||
class Player extends cn.nukkit.entity.EntityHuman implements cn.nukkit.command.CommandSender, cn.nukkit.inventory.InventoryHolder, cn.nukkit.level.ChunkLoader, cn.nukkit.IPlayer {
|
||||
// @ts-ignore
|
||||
constructor(interfaz: cn.nukkit.network.SourceInterface, clientID: java.lang.Long, ip: string, port: number)
|
||||
// @ts-ignore
|
||||
public static SURVIVAL: number;
|
||||
// @ts-ignore
|
||||
public static CREATIVE: number;
|
||||
// @ts-ignore
|
||||
public static ADVENTURE: number;
|
||||
// @ts-ignore
|
||||
public static SPECTATOR: number;
|
||||
// @ts-ignore
|
||||
public static VIEW: number;
|
||||
// @ts-ignore
|
||||
public static SURVIVAL_SLOTS: number;
|
||||
// @ts-ignore
|
||||
public static CREATIVE_SLOTS: number;
|
||||
// @ts-ignore
|
||||
public static CRAFTING_SMALL: number;
|
||||
// @ts-ignore
|
||||
public static CRAFTING_BIG: number;
|
||||
// @ts-ignore
|
||||
public static CRAFTING_ANVIL: number;
|
||||
// @ts-ignore
|
||||
public static CRAFTING_ENCHANT: number;
|
||||
// @ts-ignore
|
||||
public static CRAFTING_BEACON: number;
|
||||
// @ts-ignore
|
||||
public static DEFAULT_SPEED: number;
|
||||
// @ts-ignore
|
||||
public static MAXIMUM_SPEED: number;
|
||||
// @ts-ignore
|
||||
public static PERMISSION_CUSTOM: number;
|
||||
// @ts-ignore
|
||||
public static PERMISSION_OPERATOR: number;
|
||||
// @ts-ignore
|
||||
public static PERMISSION_MEMBER: number;
|
||||
// @ts-ignore
|
||||
public static PERMISSION_VISITOR: number;
|
||||
// @ts-ignore
|
||||
public static ANVIL_WINDOW_ID: number;
|
||||
// @ts-ignore
|
||||
public static ENCHANT_WINDOW_ID: number;
|
||||
// @ts-ignore
|
||||
public static BEACON_WINDOW_ID: number;
|
||||
// @ts-ignore
|
||||
protected interfaz: cn.nukkit.network.SourceInterface;
|
||||
// @ts-ignore
|
||||
public playedBefore: boolean;
|
||||
// @ts-ignore
|
||||
public spawned: boolean;
|
||||
// @ts-ignore
|
||||
public loggedIn: boolean;
|
||||
// @ts-ignore
|
||||
public gamemode: number;
|
||||
// @ts-ignore
|
||||
public lastBreak: number;
|
||||
// @ts-ignore
|
||||
protected windowCnt: number;
|
||||
// @ts-ignore
|
||||
protected windows: any;
|
||||
// @ts-ignore
|
||||
protected windowIndex: any;
|
||||
// @ts-ignore
|
||||
protected permanentWindows: java.util.Set;
|
||||
// @ts-ignore
|
||||
protected messageCounter: number;
|
||||
// @ts-ignore
|
||||
public speed: cn.nukkit.math.Vector3;
|
||||
// @ts-ignore
|
||||
public achievements: java.util.HashSet;
|
||||
// @ts-ignore
|
||||
public craftingType: number;
|
||||
// @ts-ignore
|
||||
protected playerUIInventory: cn.nukkit.inventory.PlayerUIInventory;
|
||||
// @ts-ignore
|
||||
protected craftingGrid: cn.nukkit.inventory.CraftingGrid;
|
||||
// @ts-ignore
|
||||
protected craftingTransaction: cn.nukkit.inventory.transaction.CraftingTransaction;
|
||||
// @ts-ignore
|
||||
public creationTime: number;
|
||||
// @ts-ignore
|
||||
protected randomClientId: number;
|
||||
// @ts-ignore
|
||||
protected forceMovement: cn.nukkit.math.Vector3;
|
||||
// @ts-ignore
|
||||
protected teleportPosition: cn.nukkit.math.Vector3;
|
||||
// @ts-ignore
|
||||
protected connected: boolean;
|
||||
// @ts-ignore
|
||||
protected ip: string;
|
||||
// @ts-ignore
|
||||
protected removeFormat: boolean;
|
||||
// @ts-ignore
|
||||
protected port: number;
|
||||
// @ts-ignore
|
||||
protected username: string;
|
||||
// @ts-ignore
|
||||
protected iusername: string;
|
||||
// @ts-ignore
|
||||
protected displayName: string;
|
||||
// @ts-ignore
|
||||
protected sleeping: cn.nukkit.math.Vector3;
|
||||
// @ts-ignore
|
||||
protected clientID: java.lang.Long;
|
||||
// @ts-ignore
|
||||
protected stepHeight: number;
|
||||
// @ts-ignore
|
||||
public usedChunks: java.util.Map;
|
||||
// @ts-ignore
|
||||
protected chunkLoadCount: number;
|
||||
// @ts-ignore
|
||||
protected loadQueue: any;
|
||||
// @ts-ignore
|
||||
protected nextChunkOrderRun: number;
|
||||
// @ts-ignore
|
||||
protected hiddenPlayers: java.util.Map;
|
||||
// @ts-ignore
|
||||
protected newPosition: cn.nukkit.math.Vector3;
|
||||
// @ts-ignore
|
||||
protected chunkRadius: number;
|
||||
// @ts-ignore
|
||||
protected viewDistance: number;
|
||||
// @ts-ignore
|
||||
protected chunksPerTick: number;
|
||||
// @ts-ignore
|
||||
protected spawnThreshold: number;
|
||||
// @ts-ignore
|
||||
protected spawnPosition: cn.nukkit.level.Position;
|
||||
// @ts-ignore
|
||||
protected inAirTicks: number;
|
||||
// @ts-ignore
|
||||
protected startAirTicks: number;
|
||||
// @ts-ignore
|
||||
protected adventureSettings: cn.nukkit.AdventureSettings;
|
||||
// @ts-ignore
|
||||
protected checkMovement: boolean;
|
||||
// @ts-ignore
|
||||
protected foodData: cn.nukkit.PlayerFood;
|
||||
// @ts-ignore
|
||||
protected enableClientCommand: boolean;
|
||||
// @ts-ignore
|
||||
protected lastEnderPearl: number;
|
||||
// @ts-ignore
|
||||
protected lastChorusFruitTeleport: number;
|
||||
// @ts-ignore
|
||||
public breakingBlock: cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public pickedXPOrb: number;
|
||||
// @ts-ignore
|
||||
protected formWindowCount: number;
|
||||
// @ts-ignore
|
||||
protected formWindows: java.util.Map;
|
||||
// @ts-ignore
|
||||
protected serverSettings: java.util.Map;
|
||||
// @ts-ignore
|
||||
protected dummyBossBars: java.util.Map;
|
||||
// @ts-ignore
|
||||
protected shouldLogin: boolean;
|
||||
// @ts-ignore
|
||||
public fishing: cn.nukkit.entity.item.EntityFishingHook;
|
||||
// @ts-ignore
|
||||
public lastSkinChange: number;
|
||||
// @ts-ignore
|
||||
protected lastRightClickTime: number;
|
||||
// @ts-ignore
|
||||
protected lastRightClickPos: cn.nukkit.math.Vector3;
|
||||
// @ts-ignore
|
||||
public getStartActionTick(): number;
|
||||
// @ts-ignore
|
||||
public startAction(): void;
|
||||
// @ts-ignore
|
||||
public stopAction(): void;
|
||||
// @ts-ignore
|
||||
public getLastEnderPearlThrowingTick(): number;
|
||||
// @ts-ignore
|
||||
public onThrowEnderPearl(): void;
|
||||
// @ts-ignore
|
||||
public getLastChorusFruitTeleport(): number;
|
||||
// @ts-ignore
|
||||
public onChorusFruitTeleport(): void;
|
||||
// @ts-ignore
|
||||
public getViewingEnderChest(): cn.nukkit.block.BlockEnderChest;
|
||||
// @ts-ignore
|
||||
public setViewingEnderChest(chest: cn.nukkit.block.BlockEnderChest): void;
|
||||
// @ts-ignore
|
||||
public getLeaveMessage(): cn.nukkit.lang.TranslationContainer;
|
||||
// @ts-ignore
|
||||
public getClientSecret(): string;
|
||||
/**
|
||||
* This might disappear in the future.
|
||||
* Please use getUniqueId() instead (IP + clientId + name combo, in the future it'll change to real UUID for online auth)
|
||||
*/
|
||||
// @ts-ignore
|
||||
public getClientId(): java.lang.Long;
|
||||
// @ts-ignore
|
||||
public isBanned(): boolean;
|
||||
// @ts-ignore
|
||||
public setBanned(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public isWhitelisted(): boolean;
|
||||
// @ts-ignore
|
||||
public setWhitelisted(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public getPlayer(): cn.nukkit.Player;
|
||||
// @ts-ignore
|
||||
public getFirstPlayed(): java.lang.Long;
|
||||
// @ts-ignore
|
||||
public getLastPlayed(): java.lang.Long;
|
||||
// @ts-ignore
|
||||
public hasPlayedBefore(): boolean;
|
||||
// @ts-ignore
|
||||
public getAdventureSettings(): cn.nukkit.AdventureSettings;
|
||||
// @ts-ignore
|
||||
public setAdventureSettings(adventureSettings: cn.nukkit.AdventureSettings): void;
|
||||
// @ts-ignore
|
||||
public resetInAirTicks(): void;
|
||||
// @ts-ignore
|
||||
public setAllowFlight(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public getAllowFlight(): boolean;
|
||||
// @ts-ignore
|
||||
public setAllowModifyWorld(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public setAllowInteract(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public setAllowInteract(value: boolean, containers: boolean): void;
|
||||
// @ts-ignore
|
||||
public setAutoJump(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public hasAutoJump(): boolean;
|
||||
// @ts-ignore
|
||||
public spawnTo(player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public getServer(): cn.nukkit.Server;
|
||||
// @ts-ignore
|
||||
public getRemoveFormat(): boolean;
|
||||
// @ts-ignore
|
||||
public setRemoveFormat(): void;
|
||||
// @ts-ignore
|
||||
public setRemoveFormat(remove: boolean): void;
|
||||
// @ts-ignore
|
||||
public canSee(player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public hidePlayer(player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public showPlayer(player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public canCollideWith(entity: cn.nukkit.entity.Entity): boolean;
|
||||
// @ts-ignore
|
||||
public resetFallDistance(): void;
|
||||
// @ts-ignore
|
||||
public isOnline(): boolean;
|
||||
// @ts-ignore
|
||||
public isOp(): boolean;
|
||||
// @ts-ignore
|
||||
public setOp(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public isPermissionSet(name: string): boolean;
|
||||
// @ts-ignore
|
||||
public isPermissionSet(permission: cn.nukkit.permission.Permission): boolean;
|
||||
// @ts-ignore
|
||||
public hasPermission(name: string): boolean;
|
||||
// @ts-ignore
|
||||
public hasPermission(permission: cn.nukkit.permission.Permission): boolean;
|
||||
// @ts-ignore
|
||||
public addAttachment(plugin: cn.nukkit.plugin.Plugin): cn.nukkit.permission.PermissionAttachment;
|
||||
// @ts-ignore
|
||||
public addAttachment(plugin: cn.nukkit.plugin.Plugin, name: string): cn.nukkit.permission.PermissionAttachment;
|
||||
// @ts-ignore
|
||||
public addAttachment(plugin: cn.nukkit.plugin.Plugin, name: string, value: java.lang.Boolean): cn.nukkit.permission.PermissionAttachment;
|
||||
// @ts-ignore
|
||||
public removeAttachment(attachment: cn.nukkit.permission.PermissionAttachment): void;
|
||||
// @ts-ignore
|
||||
public recalculatePermissions(): void;
|
||||
// @ts-ignore
|
||||
public isEnableClientCommand(): boolean;
|
||||
// @ts-ignore
|
||||
public setEnableClientCommand(enable: boolean): void;
|
||||
// @ts-ignore
|
||||
public sendCommandData(): void;
|
||||
// @ts-ignore
|
||||
public getEffectivePermissions(): java.util.Map;
|
||||
// @ts-ignore
|
||||
protected initEntity(): void;
|
||||
// @ts-ignore
|
||||
public isPlayer(): boolean;
|
||||
// @ts-ignore
|
||||
public removeAchievement(achievementId: string): void;
|
||||
// @ts-ignore
|
||||
public hasAchievement(achievementId: string): boolean;
|
||||
// @ts-ignore
|
||||
public isConnected(): boolean;
|
||||
// @ts-ignore
|
||||
public getDisplayName(): string;
|
||||
// @ts-ignore
|
||||
public setDisplayName(displayName: string): void;
|
||||
// @ts-ignore
|
||||
public setSkin(skin: cn.nukkit.entity.data.Skin): void;
|
||||
// @ts-ignore
|
||||
public getAddress(): string;
|
||||
// @ts-ignore
|
||||
public getPort(): number;
|
||||
// @ts-ignore
|
||||
public getNextPosition(): cn.nukkit.level.Position;
|
||||
// @ts-ignore
|
||||
public isSleeping(): boolean;
|
||||
// @ts-ignore
|
||||
public getInAirTicks(): number;
|
||||
/**
|
||||
* Returns whether the player is currently using an item (right-click and hold).
|
||||
*/
|
||||
// @ts-ignore
|
||||
public isUsingItem(): boolean;
|
||||
// @ts-ignore
|
||||
public setUsingItem(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public getButtonText(): string;
|
||||
// @ts-ignore
|
||||
public setButtonText(text: string): void;
|
||||
// @ts-ignore
|
||||
public unloadChunk(x: number, z: number): void;
|
||||
// @ts-ignore
|
||||
public unloadChunk(x: number, z: number, level: cn.nukkit.level.Level): void;
|
||||
// @ts-ignore
|
||||
public getSpawn(): cn.nukkit.level.Position;
|
||||
// @ts-ignore
|
||||
public sendChunk(x: number, z: number, packet: cn.nukkit.network.protocol.DataPacket): void;
|
||||
// @ts-ignore
|
||||
public sendChunk(x: number, z: number, subChunkCount: number, payload: number): void;
|
||||
// @ts-ignore
|
||||
protected sendNextChunk(): void;
|
||||
// @ts-ignore
|
||||
protected doFirstSpawn(): void;
|
||||
// @ts-ignore
|
||||
protected orderChunks(): boolean;
|
||||
// @ts-ignore
|
||||
public batchDataPacket(packet: cn.nukkit.network.protocol.DataPacket): boolean;
|
||||
/**
|
||||
* 0 is true
|
||||
* -1 is false
|
||||
* other is identifer
|
||||
*/
|
||||
// @ts-ignore
|
||||
public dataPacket(packet: cn.nukkit.network.protocol.DataPacket): boolean;
|
||||
// @ts-ignore
|
||||
public dataPacket(packet: cn.nukkit.network.protocol.DataPacket, needACK: boolean): number;
|
||||
/**
|
||||
* 0 is true
|
||||
* -1 is false
|
||||
* other is identifer
|
||||
*/
|
||||
// @ts-ignore
|
||||
public directDataPacket(packet: cn.nukkit.network.protocol.DataPacket): boolean;
|
||||
// @ts-ignore
|
||||
public directDataPacket(packet: cn.nukkit.network.protocol.DataPacket, needACK: boolean): number;
|
||||
// @ts-ignore
|
||||
public getPing(): number;
|
||||
// @ts-ignore
|
||||
public sleepOn(pos: cn.nukkit.math.Vector3): boolean;
|
||||
// @ts-ignore
|
||||
public setSpawn(pos: cn.nukkit.math.Vector3): void;
|
||||
// @ts-ignore
|
||||
public stopSleep(): void;
|
||||
// @ts-ignore
|
||||
public awardAchievement(achievementId: string): boolean;
|
||||
// @ts-ignore
|
||||
public getGamemode(): number;
|
||||
// @ts-ignore
|
||||
public setGamemode(gamemode: number): boolean;
|
||||
// @ts-ignore
|
||||
public setGamemode(gamemode: number, clientSide: boolean): boolean;
|
||||
// @ts-ignore
|
||||
public setGamemode(gamemode: number, clientSide: boolean, newSettings: cn.nukkit.AdventureSettings): boolean;
|
||||
// @ts-ignore
|
||||
public sendSettings(): void;
|
||||
// @ts-ignore
|
||||
public isSurvival(): boolean;
|
||||
// @ts-ignore
|
||||
public isCreative(): boolean;
|
||||
// @ts-ignore
|
||||
public isSpectator(): boolean;
|
||||
// @ts-ignore
|
||||
public isAdventure(): boolean;
|
||||
// @ts-ignore
|
||||
public getDrops(): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public setDataProperty(data: cn.nukkit.entity.data.EntityData): boolean;
|
||||
// @ts-ignore
|
||||
public setDataProperty(data: cn.nukkit.entity.data.EntityData, send: boolean): boolean;
|
||||
// @ts-ignore
|
||||
protected checkGroundState(movX: number, movY: number, movZ: number, dx: number, dy: number, dz: number): void;
|
||||
// @ts-ignore
|
||||
protected checkBlockCollision(): void;
|
||||
// @ts-ignore
|
||||
protected checkNearEntities(): void;
|
||||
// @ts-ignore
|
||||
protected processMovement(tickDiff: number): void;
|
||||
// @ts-ignore
|
||||
public addMovement(x: number, y: number, z: number, yaw: number, pitch: number, headYaw: number): void;
|
||||
// @ts-ignore
|
||||
public setMotion(motion: cn.nukkit.math.Vector3): boolean;
|
||||
// @ts-ignore
|
||||
public sendAttributes(): void;
|
||||
// @ts-ignore
|
||||
public onUpdate(currentTick: number): boolean;
|
||||
// @ts-ignore
|
||||
public checkInteractNearby(): void;
|
||||
/**
|
||||
* Returns the Entity the player is looking at currently
|
||||
*/
|
||||
// @ts-ignore
|
||||
public getEntityPlayerLookingAt(maxDistance: number): cn.nukkit.entity.EntityInteractable;
|
||||
// @ts-ignore
|
||||
public checkNetwork(): void;
|
||||
// @ts-ignore
|
||||
public canInteract(pos: cn.nukkit.math.Vector3, maxDistance: number): boolean;
|
||||
// @ts-ignore
|
||||
public canInteract(pos: cn.nukkit.math.Vector3, maxDistance: number, maxDiff: number): boolean;
|
||||
// @ts-ignore
|
||||
protected processLogin(): void;
|
||||
// @ts-ignore
|
||||
protected completeLoginSequence(): void;
|
||||
// @ts-ignore
|
||||
public handleDataPacket(packet: cn.nukkit.network.protocol.DataPacket): void;
|
||||
/**
|
||||
* Sends a chat message as this player. If the message begins with a / (forward-slash) it will be treated
|
||||
* as a command.
|
||||
*/
|
||||
// @ts-ignore
|
||||
public chat(message: string): boolean;
|
||||
// @ts-ignore
|
||||
public kick(): boolean;
|
||||
// @ts-ignore
|
||||
public kick(reason: string, isAdmin: boolean): boolean;
|
||||
// @ts-ignore
|
||||
public kick(reason: string): boolean;
|
||||
// @ts-ignore
|
||||
public kick(reason: cn.nukkit.event.player.PlayerKickEvent.Reason): boolean;
|
||||
// @ts-ignore
|
||||
public kick(reason: cn.nukkit.event.player.PlayerKickEvent.Reason, reasonString: string): boolean;
|
||||
// @ts-ignore
|
||||
public kick(reason: cn.nukkit.event.player.PlayerKickEvent.Reason, isAdmin: boolean): boolean;
|
||||
// @ts-ignore
|
||||
public kick(reason: cn.nukkit.event.player.PlayerKickEvent.Reason, reasonString: string, isAdmin: boolean): boolean;
|
||||
// @ts-ignore
|
||||
public setViewDistance(distance: number): void;
|
||||
// @ts-ignore
|
||||
public getViewDistance(): number;
|
||||
// @ts-ignore
|
||||
public sendMessage(message: string): void;
|
||||
// @ts-ignore
|
||||
public sendMessage(message: cn.nukkit.lang.TextContainer): void;
|
||||
// @ts-ignore
|
||||
public sendTranslation(message: string): void;
|
||||
// @ts-ignore
|
||||
public sendTranslation(message: string, parameters: string): void;
|
||||
// @ts-ignore
|
||||
public sendChat(message: string): void;
|
||||
// @ts-ignore
|
||||
public sendChat(source: string, message: string): void;
|
||||
// @ts-ignore
|
||||
public sendPopup(message: string): void;
|
||||
// @ts-ignore
|
||||
public sendPopup(message: string, subtitle: string): void;
|
||||
// @ts-ignore
|
||||
public sendTip(message: string): void;
|
||||
// @ts-ignore
|
||||
public clearTitle(): void;
|
||||
/**
|
||||
* Resets both title animation times and subtitle for the next shown title
|
||||
*/
|
||||
// @ts-ignore
|
||||
public resetTitleSettings(): void;
|
||||
// @ts-ignore
|
||||
public setSubtitle(subtitle: string): void;
|
||||
// @ts-ignore
|
||||
public setTitleAnimationTimes(fadein: number, duration: number, fadeout: number): void;
|
||||
// @ts-ignore
|
||||
public sendTitle(title: string): void;
|
||||
// @ts-ignore
|
||||
public sendTitle(title: string, subtitle: string): void;
|
||||
// @ts-ignore
|
||||
public sendTitle(title: string, subtitle: string, fadeIn: number, stay: number, fadeOut: number): void;
|
||||
// @ts-ignore
|
||||
public sendActionBar(title: string): void;
|
||||
// @ts-ignore
|
||||
public sendActionBar(title: string, fadein: number, duration: number, fadeout: number): void;
|
||||
// @ts-ignore
|
||||
public close(): void;
|
||||
// @ts-ignore
|
||||
public close(message: string): void;
|
||||
// @ts-ignore
|
||||
public close(message: string, reason: string): void;
|
||||
// @ts-ignore
|
||||
public close(message: string, reason: string, notify: boolean): void;
|
||||
// @ts-ignore
|
||||
public close(message: cn.nukkit.lang.TextContainer): void;
|
||||
// @ts-ignore
|
||||
public close(message: cn.nukkit.lang.TextContainer, reason: string): void;
|
||||
// @ts-ignore
|
||||
public close(message: cn.nukkit.lang.TextContainer, reason: string, notify: boolean): void;
|
||||
// @ts-ignore
|
||||
public save(): void;
|
||||
// @ts-ignore
|
||||
public save(async: boolean): void;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public kill(): void;
|
||||
// @ts-ignore
|
||||
protected respawn(): void;
|
||||
// @ts-ignore
|
||||
public setHealth(health: number): void;
|
||||
// @ts-ignore
|
||||
public setMaxHealth(maxHealth: number): void;
|
||||
// @ts-ignore
|
||||
public getExperience(): number;
|
||||
// @ts-ignore
|
||||
public getExperienceLevel(): number;
|
||||
// @ts-ignore
|
||||
public addExperience(add: number): void;
|
||||
// @ts-ignore
|
||||
public static calculateRequireExperience(level: number): number;
|
||||
// @ts-ignore
|
||||
public setExperience(exp: number): void;
|
||||
// @ts-ignore
|
||||
public setExperience(exp: number, level: number): void;
|
||||
// @ts-ignore
|
||||
public sendExperience(): void;
|
||||
// @ts-ignore
|
||||
public sendExperience(exp: number): void;
|
||||
// @ts-ignore
|
||||
public sendExperienceLevel(): void;
|
||||
// @ts-ignore
|
||||
public sendExperienceLevel(level: number): void;
|
||||
// @ts-ignore
|
||||
public setAttribute(attribute: cn.nukkit.entity.Attribute): void;
|
||||
// @ts-ignore
|
||||
public setMovementSpeed(speed: number): void;
|
||||
// @ts-ignore
|
||||
public setMovementSpeed(speed: number, send: boolean): void;
|
||||
// @ts-ignore
|
||||
public getKiller(): cn.nukkit.entity.Entity;
|
||||
// @ts-ignore
|
||||
public attack(source: cn.nukkit.event.entity.EntityDamageEvent): boolean;
|
||||
/**
|
||||
* Drops an item on the ground in front of the player. Returns if the item drop was successful.
|
||||
*/
|
||||
// @ts-ignore
|
||||
public dropItem(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public sendPosition(pos: cn.nukkit.math.Vector3): void;
|
||||
// @ts-ignore
|
||||
public sendPosition(pos: cn.nukkit.math.Vector3, yaw: number): void;
|
||||
// @ts-ignore
|
||||
public sendPosition(pos: cn.nukkit.math.Vector3, yaw: number, pitch: number): void;
|
||||
// @ts-ignore
|
||||
public sendPosition(pos: cn.nukkit.math.Vector3, yaw: number, pitch: number, mode: number): void;
|
||||
// @ts-ignore
|
||||
public sendPosition(pos: cn.nukkit.math.Vector3, yaw: number, pitch: number, mode: number, targets: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
protected checkChunks(): void;
|
||||
// @ts-ignore
|
||||
protected checkTeleportPosition(): boolean;
|
||||
// @ts-ignore
|
||||
protected sendPlayStatus(status: number): void;
|
||||
// @ts-ignore
|
||||
protected sendPlayStatus(status: number, immediate: boolean): void;
|
||||
// @ts-ignore
|
||||
public teleport(location: cn.nukkit.level.Location, cause: cn.nukkit.event.player.PlayerTeleportEvent.TeleportCause): boolean;
|
||||
// @ts-ignore
|
||||
protected forceSendEmptyChunks(): void;
|
||||
// @ts-ignore
|
||||
public teleportImmediate(location: cn.nukkit.level.Location): void;
|
||||
// @ts-ignore
|
||||
public teleportImmediate(location: cn.nukkit.level.Location, cause: cn.nukkit.event.player.PlayerTeleportEvent.TeleportCause): void;
|
||||
/**
|
||||
* Shows a new FormWindow to the player
|
||||
* You can find out FormWindow result by listening to PlayerFormRespondedEvent
|
||||
*/
|
||||
// @ts-ignore
|
||||
public showFormWindow(window: cn.nukkit.form.window.FormWindow): number;
|
||||
/**
|
||||
* Shows a new FormWindow to the player
|
||||
* You can find out FormWindow result by listening to PlayerFormRespondedEvent
|
||||
*/
|
||||
// @ts-ignore
|
||||
public showFormWindow(window: cn.nukkit.form.window.FormWindow, id: number): number;
|
||||
/**
|
||||
* Shows a new setting page in game settings
|
||||
* You can find out settings result by listening to PlayerFormRespondedEvent
|
||||
*/
|
||||
// @ts-ignore
|
||||
public addServerSettings(window: cn.nukkit.form.window.FormWindow): number;
|
||||
/**
|
||||
* Creates and sends a BossBar to the player
|
||||
*/
|
||||
// @ts-ignore
|
||||
public createBossBar(text: string, length: number): number;
|
||||
/**
|
||||
* Creates and sends a BossBar to the player
|
||||
*/
|
||||
// @ts-ignore
|
||||
public createBossBar(dummyBossBar: cn.nukkit.utils.DummyBossBar): number;
|
||||
/**
|
||||
* Get a DummyBossBar object
|
||||
*/
|
||||
// @ts-ignore
|
||||
public getDummyBossBar(bossBarId: number): cn.nukkit.utils.DummyBossBar;
|
||||
/**
|
||||
* Get all DummyBossBar objects
|
||||
*/
|
||||
// @ts-ignore
|
||||
public getDummyBossBars(): java.util.Map;
|
||||
/**
|
||||
* Updates a BossBar
|
||||
*/
|
||||
// @ts-ignore
|
||||
public updateBossBar(text: string, length: number, bossBarId: number): void;
|
||||
/**
|
||||
* Removes a BossBar
|
||||
*/
|
||||
// @ts-ignore
|
||||
public removeBossBar(bossBarId: number): void;
|
||||
// @ts-ignore
|
||||
public getWindowId(inventory: cn.nukkit.inventory.Inventory): number;
|
||||
// @ts-ignore
|
||||
public getWindowById(id: number): cn.nukkit.inventory.Inventory;
|
||||
// @ts-ignore
|
||||
public addWindow(inventory: cn.nukkit.inventory.Inventory): number;
|
||||
// @ts-ignore
|
||||
public addWindow(inventory: cn.nukkit.inventory.Inventory, forceId: java.lang.Integer): number;
|
||||
// @ts-ignore
|
||||
public addWindow(inventory: cn.nukkit.inventory.Inventory, forceId: java.lang.Integer, isPermanent: boolean): number;
|
||||
// @ts-ignore
|
||||
public getTopWindow(): java.util.Optional;
|
||||
// @ts-ignore
|
||||
public removeWindow(inventory: cn.nukkit.inventory.Inventory): void;
|
||||
// @ts-ignore
|
||||
public sendAllInventories(): void;
|
||||
// @ts-ignore
|
||||
protected addDefaultWindows(): void;
|
||||
// @ts-ignore
|
||||
public getUIInventory(): cn.nukkit.inventory.PlayerUIInventory;
|
||||
// @ts-ignore
|
||||
public getCursorInventory(): cn.nukkit.inventory.PlayerCursorInventory;
|
||||
// @ts-ignore
|
||||
public getCraftingGrid(): cn.nukkit.inventory.CraftingGrid;
|
||||
// @ts-ignore
|
||||
public setCraftingGrid(grid: cn.nukkit.inventory.CraftingGrid): void;
|
||||
// @ts-ignore
|
||||
public resetCraftingGridType(): void;
|
||||
// @ts-ignore
|
||||
public removeAllWindows(): void;
|
||||
// @ts-ignore
|
||||
public removeAllWindows(permanent: boolean): void;
|
||||
// @ts-ignore
|
||||
public setMetadata(metadataKey: string, newMetadataValue: cn.nukkit.metadata.MetadataValue): void;
|
||||
// @ts-ignore
|
||||
public getMetadata(metadataKey: string): java.util.List;
|
||||
// @ts-ignore
|
||||
public hasMetadata(metadataKey: string): boolean;
|
||||
// @ts-ignore
|
||||
public removeMetadata(metadataKey: string, owningPlugin: cn.nukkit.plugin.Plugin): void;
|
||||
// @ts-ignore
|
||||
public onChunkChanged(chunk: cn.nukkit.level.format.FullChunk): void;
|
||||
// @ts-ignore
|
||||
public onChunkLoaded(chunk: cn.nukkit.level.format.FullChunk): void;
|
||||
// @ts-ignore
|
||||
public onChunkPopulated(chunk: cn.nukkit.level.format.FullChunk): void;
|
||||
// @ts-ignore
|
||||
public onChunkUnloaded(chunk: cn.nukkit.level.format.FullChunk): void;
|
||||
// @ts-ignore
|
||||
public onBlockChanged(block: cn.nukkit.math.Vector3): void;
|
||||
// @ts-ignore
|
||||
public getLoaderId(): number;
|
||||
// @ts-ignore
|
||||
public isLoaderActive(): boolean;
|
||||
// @ts-ignore
|
||||
public static getChunkCacheFromData(chunkX: number, chunkZ: number, subChunkCount: number, payload: number): cn.nukkit.network.protocol.BatchPacket;
|
||||
// @ts-ignore
|
||||
public isFoodEnabled(): boolean;
|
||||
// @ts-ignore
|
||||
public setFoodEnabled(foodEnabled: boolean): void;
|
||||
// @ts-ignore
|
||||
public getFoodData(): cn.nukkit.PlayerFood;
|
||||
// @ts-ignore
|
||||
public switchLevel(level: cn.nukkit.level.Level): boolean;
|
||||
// @ts-ignore
|
||||
public setCheckMovement(checkMovement: boolean): void;
|
||||
// @ts-ignore
|
||||
public setLocale(locale: java.util.Locale): void;
|
||||
// @ts-ignore
|
||||
public getLocale(): java.util.Locale;
|
||||
// @ts-ignore
|
||||
public setSprinting(value: boolean): void;
|
||||
// @ts-ignore
|
||||
public transfer(address: java.net.InetSocketAddress): void;
|
||||
// @ts-ignore
|
||||
public getLoginChainData(): cn.nukkit.utils.LoginChainData;
|
||||
// @ts-ignore
|
||||
public pickupEntity(entity: cn.nukkit.entity.Entity, near: boolean): boolean;
|
||||
// @ts-ignore
|
||||
public hashCode(): number;
|
||||
// @ts-ignore
|
||||
public equals(obj: java.lang.Object): boolean;
|
||||
/**
|
||||
* Notifies an ACK response from the client
|
||||
*/
|
||||
// @ts-ignore
|
||||
public notifyACK(identification: number): void;
|
||||
// @ts-ignore
|
||||
public isBreakingBlock(): boolean;
|
||||
/**
|
||||
* Show a window of a XBOX account's profile
|
||||
*/
|
||||
// @ts-ignore
|
||||
public showXboxProfile(xuid: string): void;
|
||||
// @ts-ignore
|
||||
public startFishing(fishingRod: cn.nukkit.item.Item): void;
|
||||
// @ts-ignore
|
||||
public stopFishing(click: boolean): void;
|
||||
// @ts-ignore
|
||||
public toString(): string;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
packages/types/dist/typings/nukkit/cn.nukkit.PlayerFood.d.ts
vendored
Normal file
45
packages/types/dist/typings/nukkit/cn.nukkit.PlayerFood.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
// @ts-ignore
|
||||
class PlayerFood extends java.lang.Object {
|
||||
// @ts-ignore
|
||||
constructor(player: cn.nukkit.Player, foodLevel: number, foodSaturationLevel: number)
|
||||
// @ts-ignore
|
||||
public getPlayer(): cn.nukkit.Player;
|
||||
// @ts-ignore
|
||||
public getLevel(): number;
|
||||
// @ts-ignore
|
||||
public getMaxLevel(): number;
|
||||
// @ts-ignore
|
||||
public setLevel(foodLevel: number): void;
|
||||
// @ts-ignore
|
||||
public setLevel(foodLevel: number, saturationLevel: number): void;
|
||||
// @ts-ignore
|
||||
public getFoodSaturationLevel(): number;
|
||||
// @ts-ignore
|
||||
public setFoodSaturationLevel(fsl: number): void;
|
||||
// @ts-ignore
|
||||
public useHunger(): void;
|
||||
// @ts-ignore
|
||||
public useHunger(amount: number): void;
|
||||
// @ts-ignore
|
||||
public addFoodLevel(food: cn.nukkit.item.food.Food): void;
|
||||
// @ts-ignore
|
||||
public addFoodLevel(foodLevel: number, fsl: number): void;
|
||||
// @ts-ignore
|
||||
public sendFoodLevel(): void;
|
||||
// @ts-ignore
|
||||
public reset(): void;
|
||||
// @ts-ignore
|
||||
public sendFoodLevel(foodLevel: number): void;
|
||||
// @ts-ignore
|
||||
public update(tickDiff: number): void;
|
||||
// @ts-ignore
|
||||
public updateFoodExpLevel(use: number): void;
|
||||
// @ts-ignore
|
||||
public setFoodLevel(foodLevel: number): void;
|
||||
// @ts-ignore
|
||||
public setFoodLevel(foodLevel: number, saturationLevel: number): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
348
packages/types/dist/typings/nukkit/cn.nukkit.Server.d.ts
vendored
Normal file
348
packages/types/dist/typings/nukkit/cn.nukkit.Server.d.ts
vendored
Normal file
@@ -0,0 +1,348 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
// @ts-ignore
|
||||
class Server extends java.lang.Object {
|
||||
// @ts-ignore
|
||||
public static BROADCAST_CHANNEL_ADMINISTRATIVE: string;
|
||||
// @ts-ignore
|
||||
public static BROADCAST_CHANNEL_USERS: string;
|
||||
// @ts-ignore
|
||||
public networkCompressionLevel: number;
|
||||
// @ts-ignore
|
||||
public broadcastMessage(message: string): number;
|
||||
// @ts-ignore
|
||||
public broadcastMessage(message: cn.nukkit.lang.TextContainer): number;
|
||||
// @ts-ignore
|
||||
public broadcastMessage(message: string, recipients: cn.nukkit.command.CommandSender): number;
|
||||
// @ts-ignore
|
||||
public broadcastMessage(message: string, recipients: java.util.Collection): number;
|
||||
// @ts-ignore
|
||||
public broadcastMessage(message: cn.nukkit.lang.TextContainer, recipients: java.util.Collection): number;
|
||||
// @ts-ignore
|
||||
public broadcast(message: string, permissions: string): number;
|
||||
// @ts-ignore
|
||||
public broadcast(message: cn.nukkit.lang.TextContainer, permissions: string): number;
|
||||
// @ts-ignore
|
||||
public static broadcastPacket(players: java.util.Collection, packet: cn.nukkit.network.protocol.DataPacket): void;
|
||||
// @ts-ignore
|
||||
public static broadcastPacket(players: cn.nukkit.Player, packet: cn.nukkit.network.protocol.DataPacket): void;
|
||||
// @ts-ignore
|
||||
public batchPackets(players: cn.nukkit.Player, packets: cn.nukkit.network.protocol.DataPacket): void;
|
||||
// @ts-ignore
|
||||
public batchPackets(players: cn.nukkit.Player, packets: cn.nukkit.network.protocol.DataPacket, forceSync: boolean): void;
|
||||
// @ts-ignore
|
||||
public broadcastPacketsCallback(data: number, identifiers: java.util.List): void;
|
||||
// @ts-ignore
|
||||
public enablePlugins(type: cn.nukkit.plugin.PluginLoadOrder): void;
|
||||
// @ts-ignore
|
||||
public enablePlugin(plugin: cn.nukkit.plugin.Plugin): void;
|
||||
// @ts-ignore
|
||||
public disablePlugins(): void;
|
||||
// @ts-ignore
|
||||
public dispatchCommand(sender: cn.nukkit.command.CommandSender, commandLine: string): boolean;
|
||||
// @ts-ignore
|
||||
public getConsoleSender(): cn.nukkit.command.ConsoleCommandSender;
|
||||
// @ts-ignore
|
||||
public reload(): void;
|
||||
// @ts-ignore
|
||||
public shutdown(): void;
|
||||
// @ts-ignore
|
||||
public forceShutdown(): void;
|
||||
// @ts-ignore
|
||||
public start(): void;
|
||||
// @ts-ignore
|
||||
public handlePacket(address: string, port: number, payload: number): void;
|
||||
// @ts-ignore
|
||||
public tickProcessor(): void;
|
||||
// @ts-ignore
|
||||
public onPlayerCompleteLoginSequence(player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public onPlayerLogin(player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public addPlayer(identifier: string, player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public addOnlinePlayer(player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public removeOnlinePlayer(player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public updatePlayerListData(uuid: java.util.UUID, entityId: number, name: string, skin: cn.nukkit.entity.data.Skin): void;
|
||||
// @ts-ignore
|
||||
public updatePlayerListData(uuid: java.util.UUID, entityId: number, name: string, skin: cn.nukkit.entity.data.Skin, xboxUserId: string): void;
|
||||
// @ts-ignore
|
||||
public updatePlayerListData(uuid: java.util.UUID, entityId: number, name: string, skin: cn.nukkit.entity.data.Skin, players: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public updatePlayerListData(uuid: java.util.UUID, entityId: number, name: string, skin: cn.nukkit.entity.data.Skin, xboxUserId: string, players: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public updatePlayerListData(uuid: java.util.UUID, entityId: number, name: string, skin: cn.nukkit.entity.data.Skin, xboxUserId: string, players: java.util.Collection): void;
|
||||
// @ts-ignore
|
||||
public removePlayerListData(uuid: java.util.UUID): void;
|
||||
// @ts-ignore
|
||||
public removePlayerListData(uuid: java.util.UUID, players: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public removePlayerListData(uuid: java.util.UUID, players: java.util.Collection): void;
|
||||
// @ts-ignore
|
||||
public sendFullPlayerListData(player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public sendRecipeList(player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public doAutoSave(): void;
|
||||
// @ts-ignore
|
||||
public getNextTick(): number;
|
||||
// @ts-ignore
|
||||
public titleTick(): void;
|
||||
// @ts-ignore
|
||||
public getQueryInformation(): cn.nukkit.event.server.QueryRegenerateEvent;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public isRunning(): boolean;
|
||||
// @ts-ignore
|
||||
public getNukkitVersion(): string;
|
||||
// @ts-ignore
|
||||
public getCodename(): string;
|
||||
// @ts-ignore
|
||||
public getVersion(): string;
|
||||
// @ts-ignore
|
||||
public getApiVersion(): string;
|
||||
// @ts-ignore
|
||||
public getFilePath(): string;
|
||||
// @ts-ignore
|
||||
public getDataPath(): string;
|
||||
// @ts-ignore
|
||||
public getPluginPath(): string;
|
||||
// @ts-ignore
|
||||
public getMaxPlayers(): number;
|
||||
// @ts-ignore
|
||||
public setMaxPlayers(maxPlayers: number): void;
|
||||
// @ts-ignore
|
||||
public getPort(): number;
|
||||
// @ts-ignore
|
||||
public getViewDistance(): number;
|
||||
// @ts-ignore
|
||||
public getIp(): string;
|
||||
// @ts-ignore
|
||||
public getServerUniqueId(): java.util.UUID;
|
||||
// @ts-ignore
|
||||
public getAutoSave(): boolean;
|
||||
// @ts-ignore
|
||||
public setAutoSave(autoSave: boolean): void;
|
||||
// @ts-ignore
|
||||
public getLevelType(): string;
|
||||
// @ts-ignore
|
||||
public getGenerateStructures(): boolean;
|
||||
// @ts-ignore
|
||||
public getGamemode(): number;
|
||||
// @ts-ignore
|
||||
public getForceGamemode(): boolean;
|
||||
// @ts-ignore
|
||||
public static getGamemodeString(mode: number): string;
|
||||
// @ts-ignore
|
||||
public static getGamemodeString(mode: number, direct: boolean): string;
|
||||
// @ts-ignore
|
||||
public static getGamemodeFromString(str: string): number;
|
||||
// @ts-ignore
|
||||
public static getDifficultyFromString(str: string): number;
|
||||
// @ts-ignore
|
||||
public getDifficulty(): number;
|
||||
// @ts-ignore
|
||||
public hasWhitelist(): boolean;
|
||||
// @ts-ignore
|
||||
public getSpawnRadius(): number;
|
||||
// @ts-ignore
|
||||
public getAllowFlight(): boolean;
|
||||
// @ts-ignore
|
||||
public isHardcore(): boolean;
|
||||
// @ts-ignore
|
||||
public getDefaultGamemode(): number;
|
||||
// @ts-ignore
|
||||
public getMotd(): string;
|
||||
// @ts-ignore
|
||||
public getSubMotd(): string;
|
||||
// @ts-ignore
|
||||
public getForceResources(): boolean;
|
||||
// @ts-ignore
|
||||
public getLogger(): cn.nukkit.utils.MainLogger;
|
||||
// @ts-ignore
|
||||
public getEntityMetadata(): cn.nukkit.metadata.EntityMetadataStore;
|
||||
// @ts-ignore
|
||||
public getPlayerMetadata(): cn.nukkit.metadata.PlayerMetadataStore;
|
||||
// @ts-ignore
|
||||
public getLevelMetadata(): cn.nukkit.metadata.LevelMetadataStore;
|
||||
// @ts-ignore
|
||||
public getPluginManager(): cn.nukkit.plugin.PluginManager;
|
||||
// @ts-ignore
|
||||
public getCraftingManager(): cn.nukkit.inventory.CraftingManager;
|
||||
// @ts-ignore
|
||||
public getResourcePackManager(): cn.nukkit.resourcepacks.ResourcePackManager;
|
||||
// @ts-ignore
|
||||
public getScheduler(): cn.nukkit.scheduler.ServerScheduler;
|
||||
// @ts-ignore
|
||||
public getTick(): number;
|
||||
// @ts-ignore
|
||||
public getTicksPerSecond(): number;
|
||||
// @ts-ignore
|
||||
public getTicksPerSecondAverage(): number;
|
||||
// @ts-ignore
|
||||
public getTickUsage(): number;
|
||||
// @ts-ignore
|
||||
public getTickUsageAverage(): number;
|
||||
// @ts-ignore
|
||||
public getCommandMap(): cn.nukkit.command.SimpleCommandMap;
|
||||
// @ts-ignore
|
||||
public getOnlinePlayers(): java.util.Map;
|
||||
// @ts-ignore
|
||||
public addRecipe(recipe: cn.nukkit.inventory.Recipe): void;
|
||||
// @ts-ignore
|
||||
public getPlayer(uuid: java.util.UUID): java.util.Optional;
|
||||
// @ts-ignore
|
||||
public lookupName(name: string): java.util.Optional;
|
||||
// @ts-ignore
|
||||
public getOfflinePlayer(name: string): cn.nukkit.IPlayer;
|
||||
// @ts-ignore
|
||||
public getOfflinePlayer(uuid: java.util.UUID): cn.nukkit.IPlayer;
|
||||
// @ts-ignore
|
||||
public getOfflinePlayerData(uuid: java.util.UUID): cn.nukkit.nbt.tag.CompoundTag;
|
||||
// @ts-ignore
|
||||
public getOfflinePlayerData(uuid: java.util.UUID, create: boolean): cn.nukkit.nbt.tag.CompoundTag;
|
||||
// @ts-ignore
|
||||
public getOfflinePlayerData(name: string): cn.nukkit.nbt.tag.CompoundTag;
|
||||
// @ts-ignore
|
||||
public getOfflinePlayerData(name: string, create: boolean): cn.nukkit.nbt.tag.CompoundTag;
|
||||
// @ts-ignore
|
||||
public saveOfflinePlayerData(uuid: java.util.UUID, tag: cn.nukkit.nbt.tag.CompoundTag): void;
|
||||
// @ts-ignore
|
||||
public saveOfflinePlayerData(name: string, tag: cn.nukkit.nbt.tag.CompoundTag): void;
|
||||
// @ts-ignore
|
||||
public saveOfflinePlayerData(uuid: java.util.UUID, tag: cn.nukkit.nbt.tag.CompoundTag, async: boolean): void;
|
||||
// @ts-ignore
|
||||
public saveOfflinePlayerData(name: string, tag: cn.nukkit.nbt.tag.CompoundTag, async: boolean): void;
|
||||
// @ts-ignore
|
||||
public getPlayer(name: string): cn.nukkit.Player;
|
||||
// @ts-ignore
|
||||
public getPlayerExact(name: string): cn.nukkit.Player;
|
||||
// @ts-ignore
|
||||
public matchPlayer(partialName: string): cn.nukkit.Player[];
|
||||
// @ts-ignore
|
||||
public removePlayer(player: cn.nukkit.Player): void;
|
||||
// @ts-ignore
|
||||
public getLevels(): java.util.Map;
|
||||
// @ts-ignore
|
||||
public getDefaultLevel(): cn.nukkit.level.Level;
|
||||
// @ts-ignore
|
||||
public setDefaultLevel(defaultLevel: cn.nukkit.level.Level): void;
|
||||
// @ts-ignore
|
||||
public isLevelLoaded(name: string): boolean;
|
||||
// @ts-ignore
|
||||
public getLevel(levelId: number): cn.nukkit.level.Level;
|
||||
// @ts-ignore
|
||||
public getLevelByName(name: string): cn.nukkit.level.Level;
|
||||
// @ts-ignore
|
||||
public unloadLevel(level: cn.nukkit.level.Level): boolean;
|
||||
// @ts-ignore
|
||||
public unloadLevel(level: cn.nukkit.level.Level, forceUnload: boolean): boolean;
|
||||
// @ts-ignore
|
||||
public loadLevel(name: string): boolean;
|
||||
// @ts-ignore
|
||||
public generateLevel(name: string): boolean;
|
||||
// @ts-ignore
|
||||
public generateLevel(name: string, seed: number): boolean;
|
||||
// @ts-ignore
|
||||
public generateLevel(name: string, seed: number, generator: java.lang.Class): boolean;
|
||||
// @ts-ignore
|
||||
public generateLevel(name: string, seed: number, generator: java.lang.Class, options: java.util.Map): boolean;
|
||||
// @ts-ignore
|
||||
public generateLevel(name: string, seed: number, generator: java.lang.Class, options: java.util.Map, provider: java.lang.Class): boolean;
|
||||
// @ts-ignore
|
||||
public isLevelGenerated(name: string): boolean;
|
||||
// @ts-ignore
|
||||
public getLanguage(): cn.nukkit.lang.BaseLang;
|
||||
// @ts-ignore
|
||||
public isLanguageForced(): boolean;
|
||||
// @ts-ignore
|
||||
public getNetwork(): cn.nukkit.network.Network;
|
||||
// @ts-ignore
|
||||
public getConfig(): cn.nukkit.utils.Config;
|
||||
// @ts-ignore
|
||||
public getConfig(variable: string): java.lang.Object;
|
||||
// @ts-ignore
|
||||
public getConfig(variable: string, defaultValue: java.lang.Object): java.lang.Object;
|
||||
// @ts-ignore
|
||||
public getProperties(): cn.nukkit.utils.Config;
|
||||
// @ts-ignore
|
||||
public getProperty(variable: string): java.lang.Object;
|
||||
// @ts-ignore
|
||||
public getProperty(variable: string, defaultValue: java.lang.Object): java.lang.Object;
|
||||
// @ts-ignore
|
||||
public setPropertyString(variable: string, value: string): void;
|
||||
// @ts-ignore
|
||||
public getPropertyString(variable: string): string;
|
||||
// @ts-ignore
|
||||
public getPropertyString(variable: string, defaultValue: string): string;
|
||||
// @ts-ignore
|
||||
public getPropertyInt(variable: string): number;
|
||||
// @ts-ignore
|
||||
public getPropertyInt(variable: string, defaultValue: java.lang.Integer): number;
|
||||
// @ts-ignore
|
||||
public setPropertyInt(variable: string, value: number): void;
|
||||
// @ts-ignore
|
||||
public getPropertyBoolean(variable: string): boolean;
|
||||
// @ts-ignore
|
||||
public getPropertyBoolean(variable: string, defaultValue: java.lang.Object): boolean;
|
||||
// @ts-ignore
|
||||
public setPropertyBoolean(variable: string, value: boolean): void;
|
||||
// @ts-ignore
|
||||
public getPluginCommand(name: string): cn.nukkit.command.PluginIdentifiableCommand;
|
||||
// @ts-ignore
|
||||
public getNameBans(): cn.nukkit.permission.BanList;
|
||||
// @ts-ignore
|
||||
public getIPBans(): cn.nukkit.permission.BanList;
|
||||
// @ts-ignore
|
||||
public addOp(name: string): void;
|
||||
// @ts-ignore
|
||||
public removeOp(name: string): void;
|
||||
// @ts-ignore
|
||||
public addWhitelist(name: string): void;
|
||||
// @ts-ignore
|
||||
public removeWhitelist(name: string): void;
|
||||
// @ts-ignore
|
||||
public isWhitelisted(name: string): boolean;
|
||||
// @ts-ignore
|
||||
public isOp(name: string): boolean;
|
||||
// @ts-ignore
|
||||
public getWhitelist(): cn.nukkit.utils.Config;
|
||||
// @ts-ignore
|
||||
public getOps(): cn.nukkit.utils.Config;
|
||||
// @ts-ignore
|
||||
public reloadWhitelist(): void;
|
||||
// @ts-ignore
|
||||
public getServiceManager(): cn.nukkit.plugin.service.ServiceManager;
|
||||
// @ts-ignore
|
||||
public getCommandAliases(): java.util.Map;
|
||||
// @ts-ignore
|
||||
public shouldSavePlayerData(): boolean;
|
||||
// @ts-ignore
|
||||
public getPlayerSkinChangeCooldown(): number;
|
||||
/**
|
||||
* Checks the current thread against the expected primary thread for the
|
||||
* server.
|
||||
* <p>
|
||||
* <b>Note:</b> this method should not be used to indicate the current
|
||||
* synchronized state of the runtime. A current thread matching the main
|
||||
* thread indicates that it is synchronized, but a mismatch does not
|
||||
* preclude the same assumption.
|
||||
*/
|
||||
// @ts-ignore
|
||||
public isPrimaryThread(): boolean;
|
||||
// @ts-ignore
|
||||
public getPrimaryThread(): java.lang.Thread;
|
||||
// @ts-ignore
|
||||
public isNetherAllowed(): boolean;
|
||||
// @ts-ignore
|
||||
public getPlayerDataSerializer(): cn.nukkit.utils.PlayerDataSerializer;
|
||||
// @ts-ignore
|
||||
public setPlayerDataSerializer(playerDataSerializer: cn.nukkit.utils.PlayerDataSerializer): void;
|
||||
// @ts-ignore
|
||||
public static getInstance(): cn.nukkit.Server;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
packages/types/dist/typings/nukkit/cn.nukkit.api.API.Definition.d.ts
vendored
Normal file
21
packages/types/dist/typings/nukkit/cn.nukkit.api.API.Definition.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace api {
|
||||
namespace API {
|
||||
// @ts-ignore
|
||||
class Definition extends java.lang.Enum {
|
||||
// @ts-ignore
|
||||
public static INTERNAL: cn.nukkit.api.API.Definition;
|
||||
// @ts-ignore
|
||||
public static PLATFORM_NATIVE: cn.nukkit.api.API.Definition;
|
||||
// @ts-ignore
|
||||
public static UNIVERSAL: cn.nukkit.api.API.Definition;
|
||||
// @ts-ignore
|
||||
public static values(): cn.nukkit.api.API.Definition[];
|
||||
// @ts-ignore
|
||||
public static valueOf(name: string): cn.nukkit.api.API.Definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
packages/types/dist/typings/nukkit/cn.nukkit.api.API.Usage.d.ts
vendored
Normal file
27
packages/types/dist/typings/nukkit/cn.nukkit.api.API.Usage.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace api {
|
||||
namespace API {
|
||||
// @ts-ignore
|
||||
class Usage extends java.lang.Enum {
|
||||
// @ts-ignore
|
||||
public static DEPRECATED: cn.nukkit.api.API.Usage;
|
||||
// @ts-ignore
|
||||
public static INCUBATING: cn.nukkit.api.API.Usage;
|
||||
// @ts-ignore
|
||||
public static BLEEDING: cn.nukkit.api.API.Usage;
|
||||
// @ts-ignore
|
||||
public static EXPERIMENTAL: cn.nukkit.api.API.Usage;
|
||||
// @ts-ignore
|
||||
public static MAINTAINED: cn.nukkit.api.API.Usage;
|
||||
// @ts-ignore
|
||||
public static STABLE: cn.nukkit.api.API.Usage;
|
||||
// @ts-ignore
|
||||
public static values(): cn.nukkit.api.API.Usage[];
|
||||
// @ts-ignore
|
||||
public static valueOf(name: string): cn.nukkit.api.API.Usage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
packages/types/dist/typings/nukkit/cn.nukkit.api.API.d.ts
vendored
Normal file
20
packages/types/dist/typings/nukkit/cn.nukkit.api.API.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace api {
|
||||
// @ts-ignore
|
||||
interface API {
|
||||
/**
|
||||
* Indicates the level of stability of an API element.
|
||||
* The stability also describes when to use this API element.
|
||||
*/
|
||||
// @ts-ignore
|
||||
usage(): cn.nukkit.api.API.Usage;
|
||||
/**
|
||||
* Indicates definition or the platforms this API element supports.
|
||||
*/
|
||||
// @ts-ignore
|
||||
definition(): cn.nukkit.api.API.Definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
212
packages/types/dist/typings/nukkit/cn.nukkit.block.Block.d.ts
vendored
Normal file
212
packages/types/dist/typings/nukkit/cn.nukkit.block.Block.d.ts
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
abstract class Block extends cn.nukkit.level.Position implements cn.nukkit.metadata.Metadatable, cn.nukkit.math.AxisAlignedBB, cn.nukkit.block.BlockID {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public static list: java.lang.Class[];
|
||||
// @ts-ignore
|
||||
public static fullList: cn.nukkit.block.Block[];
|
||||
// @ts-ignore
|
||||
public static light: number[];
|
||||
// @ts-ignore
|
||||
public static lightFilter: number[];
|
||||
// @ts-ignore
|
||||
public static solid: boolean[];
|
||||
// @ts-ignore
|
||||
public static hardness: number[];
|
||||
// @ts-ignore
|
||||
public static transparent: boolean[];
|
||||
// @ts-ignore
|
||||
public static hasMeta: boolean[];
|
||||
// @ts-ignore
|
||||
public static init(): void;
|
||||
// @ts-ignore
|
||||
public static get(id: number): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public static get(id: number, meta: java.lang.Integer): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public static get(id: number, meta: java.lang.Integer, pos: cn.nukkit.level.Position): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public static get(id: number, data: number): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public static get(fullId: number, level: cn.nukkit.level.Level, x: number, y: number, z: number): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public place(item: cn.nukkit.item.Item, block: cn.nukkit.block.Block, target: cn.nukkit.block.Block, face: cn.nukkit.math.BlockFace, fx: number, fy: number, fz: number, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public canHarvestWithHand(): boolean;
|
||||
// @ts-ignore
|
||||
public isBreakable(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public tickRate(): number;
|
||||
// @ts-ignore
|
||||
public onBreak(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public onUpdate(type: number): number;
|
||||
// @ts-ignore
|
||||
public onActivate(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public onActivate(item: cn.nukkit.item.Item, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getBurnChance(): number;
|
||||
// @ts-ignore
|
||||
public getBurnAbility(): number;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public getFrictionFactor(): number;
|
||||
// @ts-ignore
|
||||
public getLightLevel(): number;
|
||||
// @ts-ignore
|
||||
public canBePlaced(): boolean;
|
||||
// @ts-ignore
|
||||
public canBeReplaced(): boolean;
|
||||
// @ts-ignore
|
||||
public isTransparent(): boolean;
|
||||
// @ts-ignore
|
||||
public isSolid(): boolean;
|
||||
// @ts-ignore
|
||||
public canBeFlowedInto(): boolean;
|
||||
// @ts-ignore
|
||||
public canBeActivated(): boolean;
|
||||
// @ts-ignore
|
||||
public hasEntityCollision(): boolean;
|
||||
// @ts-ignore
|
||||
public canPassThrough(): boolean;
|
||||
// @ts-ignore
|
||||
public canBePushed(): boolean;
|
||||
// @ts-ignore
|
||||
public hasComparatorInputOverride(): boolean;
|
||||
// @ts-ignore
|
||||
public getComparatorInputOverride(): number;
|
||||
// @ts-ignore
|
||||
public canBeClimbed(): boolean;
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
// @ts-ignore
|
||||
public abstract getName(): string;
|
||||
// @ts-ignore
|
||||
public abstract getId(): number;
|
||||
/**
|
||||
* The full id is a combination of the id and data.
|
||||
*/
|
||||
// @ts-ignore
|
||||
public getFullId(): number;
|
||||
// @ts-ignore
|
||||
public addVelocityToEntity(entity: cn.nukkit.entity.Entity, vector: cn.nukkit.math.Vector3): void;
|
||||
// @ts-ignore
|
||||
public getDamage(): number;
|
||||
// @ts-ignore
|
||||
public setDamage(meta: number): void;
|
||||
// @ts-ignore
|
||||
public setDamage(meta: java.lang.Integer): void;
|
||||
// @ts-ignore
|
||||
public position(v: cn.nukkit.level.Position): void;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public getBreakTime(item: cn.nukkit.item.Item, player: cn.nukkit.Player): number;
|
||||
// @ts-ignore
|
||||
public getBreakTime(item: cn.nukkit.item.Item): number;
|
||||
// @ts-ignore
|
||||
public canBeBrokenWith(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public getSide(face: cn.nukkit.math.BlockFace): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public getSide(face: cn.nukkit.math.BlockFace, step: number): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public up(): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public up(step: number): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public down(): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public down(step: number): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public north(): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public north(step: number): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public south(): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public south(step: number): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public east(): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public east(step: number): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public west(): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public west(step: number): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public toString(): string;
|
||||
// @ts-ignore
|
||||
public collidesWithBB(bb: cn.nukkit.math.AxisAlignedBB): boolean;
|
||||
// @ts-ignore
|
||||
public collidesWithBB(bb: cn.nukkit.math.AxisAlignedBB, collisionBB: boolean): boolean;
|
||||
// @ts-ignore
|
||||
public onEntityCollide(entity: cn.nukkit.entity.Entity): void;
|
||||
// @ts-ignore
|
||||
public getBoundingBox(): cn.nukkit.math.AxisAlignedBB;
|
||||
// @ts-ignore
|
||||
public getCollisionBoundingBox(): cn.nukkit.math.AxisAlignedBB;
|
||||
// @ts-ignore
|
||||
protected recalculateBoundingBox(): cn.nukkit.math.AxisAlignedBB;
|
||||
// @ts-ignore
|
||||
public getMinX(): number;
|
||||
// @ts-ignore
|
||||
public getMinY(): number;
|
||||
// @ts-ignore
|
||||
public getMinZ(): number;
|
||||
// @ts-ignore
|
||||
public getMaxX(): number;
|
||||
// @ts-ignore
|
||||
public getMaxY(): number;
|
||||
// @ts-ignore
|
||||
public getMaxZ(): number;
|
||||
// @ts-ignore
|
||||
protected recalculateCollisionBoundingBox(): cn.nukkit.math.AxisAlignedBB;
|
||||
// @ts-ignore
|
||||
public calculateIntercept(pos1: cn.nukkit.math.Vector3, pos2: cn.nukkit.math.Vector3): cn.nukkit.level.MovingObjectPosition;
|
||||
// @ts-ignore
|
||||
public getSaveId(): string;
|
||||
// @ts-ignore
|
||||
public setMetadata(metadataKey: string, newMetadataValue: cn.nukkit.metadata.MetadataValue): void;
|
||||
// @ts-ignore
|
||||
public getMetadata(metadataKey: string): java.util.List;
|
||||
// @ts-ignore
|
||||
public hasMetadata(metadataKey: string): boolean;
|
||||
// @ts-ignore
|
||||
public removeMetadata(metadataKey: string, owningPlugin: cn.nukkit.plugin.Plugin): void;
|
||||
// @ts-ignore
|
||||
public clone(): cn.nukkit.block.Block;
|
||||
// @ts-ignore
|
||||
public getWeakPower(face: cn.nukkit.math.BlockFace): number;
|
||||
// @ts-ignore
|
||||
public getStrongPower(side: cn.nukkit.math.BlockFace): number;
|
||||
// @ts-ignore
|
||||
public isPowerSource(): boolean;
|
||||
// @ts-ignore
|
||||
public getLocationHash(): string;
|
||||
// @ts-ignore
|
||||
public getDropExp(): number;
|
||||
// @ts-ignore
|
||||
public isNormalBlock(): boolean;
|
||||
// @ts-ignore
|
||||
public static equals(b1: cn.nukkit.block.Block, b2: cn.nukkit.block.Block): boolean;
|
||||
// @ts-ignore
|
||||
public static equals(b1: cn.nukkit.block.Block, b2: cn.nukkit.block.Block, checkDamage: boolean): boolean;
|
||||
// @ts-ignore
|
||||
public toItem(): cn.nukkit.item.Item;
|
||||
// @ts-ignore
|
||||
public canSilkTouch(): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockAir.d.ts
vendored
Normal file
37
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockAir.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockAir extends cn.nukkit.block.BlockTransparent {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public canPassThrough(): boolean;
|
||||
// @ts-ignore
|
||||
public isBreakable(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public canBeFlowedInto(): boolean;
|
||||
// @ts-ignore
|
||||
public canBePlaced(): boolean;
|
||||
// @ts-ignore
|
||||
public canBeReplaced(): boolean;
|
||||
// @ts-ignore
|
||||
public isSolid(): boolean;
|
||||
// @ts-ignore
|
||||
public getBoundingBox(): cn.nukkit.math.AxisAlignedBB;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public canHarvestWithHand(): boolean;
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockAnvil.d.ts
vendored
Normal file
47
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockAnvil.d.ts
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockAnvil extends cn.nukkit.block.BlockFallable implements cn.nukkit.utils.Faceable {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
public getFullId(): number;
|
||||
// @ts-ignore
|
||||
public getDamage(): number;
|
||||
// @ts-ignore
|
||||
public setDamage(meta: number): void;
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public canBeActivated(): boolean;
|
||||
// @ts-ignore
|
||||
public isTransparent(): boolean;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public place(item: cn.nukkit.item.Item, block: cn.nukkit.block.Block, target: cn.nukkit.block.Block, face: cn.nukkit.math.BlockFace, fx: number, fy: number, fz: number, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public onActivate(item: cn.nukkit.item.Item, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public toItem(): cn.nukkit.item.Item;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
// @ts-ignore
|
||||
public canHarvestWithHand(): boolean;
|
||||
// @ts-ignore
|
||||
public getBlockFace(): cn.nukkit.math.BlockFace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBanner.d.ts
vendored
Normal file
39
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBanner.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBanner extends cn.nukkit.block.BlockTransparentMeta implements cn.nukkit.utils.Faceable {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
protected recalculateBoundingBox(): cn.nukkit.math.AxisAlignedBB;
|
||||
// @ts-ignore
|
||||
public canPassThrough(): boolean;
|
||||
// @ts-ignore
|
||||
public place(item: cn.nukkit.item.Item, block: cn.nukkit.block.Block, target: cn.nukkit.block.Block, face: cn.nukkit.math.BlockFace, fx: number, fy: number, fz: number, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public onUpdate(type: number): number;
|
||||
// @ts-ignore
|
||||
public toItem(): cn.nukkit.item.Item;
|
||||
// @ts-ignore
|
||||
public getBlockFace(): cn.nukkit.math.BlockFace;
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
// @ts-ignore
|
||||
public getDyeColor(): cn.nukkit.utils.DyeColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBeacon.d.ts
vendored
Normal file
33
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBeacon.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBeacon extends cn.nukkit.block.BlockTransparent {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getLightLevel(): number;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public canBeActivated(): boolean;
|
||||
// @ts-ignore
|
||||
public onActivate(item: cn.nukkit.item.Item, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public place(item: cn.nukkit.item.Item, block: cn.nukkit.block.Block, target: cn.nukkit.block.Block, face: cn.nukkit.math.BlockFace, fx: number, fy: number, fz: number, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public canBePushed(): boolean;
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBed.d.ts
vendored
Normal file
41
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBed.d.ts
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBed extends cn.nukkit.block.BlockTransparentMeta implements cn.nukkit.utils.Faceable {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public canBeActivated(): boolean;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getMaxY(): number;
|
||||
// @ts-ignore
|
||||
public onActivate(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public onActivate(item: cn.nukkit.item.Item, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public place(item: cn.nukkit.item.Item, block: cn.nukkit.block.Block, target: cn.nukkit.block.Block, face: cn.nukkit.math.BlockFace, fx: number, fy: number, fz: number, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public onBreak(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public toItem(): cn.nukkit.item.Item;
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
// @ts-ignore
|
||||
public getDyeColor(): cn.nukkit.utils.DyeColor;
|
||||
// @ts-ignore
|
||||
public getBlockFace(): cn.nukkit.math.BlockFace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBedrock.d.ts
vendored
Normal file
25
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBedrock.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBedrock extends cn.nukkit.block.BlockSolid {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public isBreakable(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public canBePushed(): boolean;
|
||||
// @ts-ignore
|
||||
public canHarvestWithHand(): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBedrockInvisible.d.ts
vendored
Normal file
27
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBedrockInvisible.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBedrockInvisible extends cn.nukkit.block.BlockSolid {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public isBreakable(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
// @ts-ignore
|
||||
public canBePushed(): boolean;
|
||||
// @ts-ignore
|
||||
public toItem(): cn.nukkit.item.Item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBeetroot.d.ts
vendored
Normal file
21
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBeetroot.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBeetroot extends cn.nukkit.block.BlockCrops {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public toItem(): cn.nukkit.item.Item;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBone.d.ts
vendored
Normal file
31
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBone.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBone extends cn.nukkit.block.BlockSolidMeta implements cn.nukkit.utils.Faceable {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public getBlockFace(): cn.nukkit.math.BlockFace;
|
||||
// @ts-ignore
|
||||
public place(item: cn.nukkit.item.Item, block: cn.nukkit.block.Block, target: cn.nukkit.block.Block, face: cn.nukkit.math.BlockFace, fx: number, fy: number, fz: number, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBookshelf.d.ts
vendored
Normal file
33
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBookshelf.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBookshelf extends cn.nukkit.block.BlockSolidMeta {
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public getBurnChance(): number;
|
||||
// @ts-ignore
|
||||
public getBurnAbility(): number;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
// @ts-ignore
|
||||
public canSilkTouch(): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
43
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBrewingStand.d.ts
vendored
Normal file
43
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBrewingStand.d.ts
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBrewingStand extends cn.nukkit.block.BlockSolidMeta {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public canBeActivated(): boolean;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getLightLevel(): number;
|
||||
// @ts-ignore
|
||||
public place(item: cn.nukkit.item.Item, block: cn.nukkit.block.Block, target: cn.nukkit.block.Block, face: cn.nukkit.math.BlockFace, fx: number, fy: number, fz: number, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public onActivate(item: cn.nukkit.item.Item, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public toItem(): cn.nukkit.item.Item;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
// @ts-ignore
|
||||
public hasComparatorInputOverride(): boolean;
|
||||
// @ts-ignore
|
||||
public getComparatorInputOverride(): number;
|
||||
// @ts-ignore
|
||||
public canHarvestWithHand(): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBricks.d.ts
vendored
Normal file
27
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBricks.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBricks extends cn.nukkit.block.BlockSolid {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
// @ts-ignore
|
||||
public canHarvestWithHand(): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBricksEndStone.d.ts
vendored
Normal file
25
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBricksEndStone.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBricksEndStone extends cn.nukkit.block.BlockSolid {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBricksNether.d.ts
vendored
Normal file
25
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBricksNether.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBricksNether extends cn.nukkit.block.BlockSolid {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBricksRedNether.d.ts
vendored
Normal file
19
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBricksRedNether.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBricksRedNether extends cn.nukkit.block.BlockNetherBrick {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBricksStone.d.ts
vendored
Normal file
35
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockBricksStone.d.ts
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockBricksStone extends cn.nukkit.block.BlockSolidMeta {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
public static NORMAL: number;
|
||||
// @ts-ignore
|
||||
public static MOSSY: number;
|
||||
// @ts-ignore
|
||||
public static CRACKED: number;
|
||||
// @ts-ignore
|
||||
public static CHISELED: number;
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
// @ts-ignore
|
||||
public canHarvestWithHand(): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockButton.d.ts
vendored
Normal file
41
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockButton.d.ts
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
abstract class BlockButton extends cn.nukkit.block.BlockFlowable implements cn.nukkit.utils.Faceable {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public place(item: cn.nukkit.item.Item, block: cn.nukkit.block.Block, target: cn.nukkit.block.Block, face: cn.nukkit.math.BlockFace, fx: number, fy: number, fz: number, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public canBeActivated(): boolean;
|
||||
// @ts-ignore
|
||||
public onActivate(item: cn.nukkit.item.Item, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public onUpdate(type: number): number;
|
||||
// @ts-ignore
|
||||
public isActivated(): boolean;
|
||||
// @ts-ignore
|
||||
public isPowerSource(): boolean;
|
||||
// @ts-ignore
|
||||
public getWeakPower(side: cn.nukkit.math.BlockFace): number;
|
||||
// @ts-ignore
|
||||
public getStrongPower(side: cn.nukkit.math.BlockFace): number;
|
||||
// @ts-ignore
|
||||
public getFacing(): cn.nukkit.math.BlockFace;
|
||||
// @ts-ignore
|
||||
public onBreak(item: cn.nukkit.item.Item): boolean;
|
||||
// @ts-ignore
|
||||
public toItem(): cn.nukkit.item.Item;
|
||||
// @ts-ignore
|
||||
public getBlockFace(): cn.nukkit.math.BlockFace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockButtonStone.d.ts
vendored
Normal file
19
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockButtonStone.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockButtonStone extends cn.nukkit.block.BlockButton {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockButtonWooden.d.ts
vendored
Normal file
19
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockButtonWooden.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockButtonWooden extends cn.nukkit.block.BlockButton {
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getToolType(): number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockCactus.d.ts
vendored
Normal file
47
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockCactus.d.ts
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockCactus extends cn.nukkit.block.BlockTransparentMeta {
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public hasEntityCollision(): boolean;
|
||||
// @ts-ignore
|
||||
public getMinX(): number;
|
||||
// @ts-ignore
|
||||
public getMinY(): number;
|
||||
// @ts-ignore
|
||||
public getMinZ(): number;
|
||||
// @ts-ignore
|
||||
public getMaxX(): number;
|
||||
// @ts-ignore
|
||||
public getMaxY(): number;
|
||||
// @ts-ignore
|
||||
public getMaxZ(): number;
|
||||
// @ts-ignore
|
||||
protected recalculateCollisionBoundingBox(): cn.nukkit.math.AxisAlignedBB;
|
||||
// @ts-ignore
|
||||
public onEntityCollide(entity: cn.nukkit.entity.Entity): void;
|
||||
// @ts-ignore
|
||||
public onUpdate(type: number): number;
|
||||
// @ts-ignore
|
||||
public place(item: cn.nukkit.item.Item, block: cn.nukkit.block.Block, target: cn.nukkit.block.Block, face: cn.nukkit.math.BlockFace, fx: number, fy: number, fz: number, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockCake.d.ts
vendored
Normal file
51
packages/types/dist/typings/nukkit/cn.nukkit.block.BlockCake.d.ts
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
declare namespace cn {
|
||||
namespace nukkit {
|
||||
namespace block {
|
||||
// @ts-ignore
|
||||
class BlockCake extends cn.nukkit.block.BlockTransparentMeta {
|
||||
// @ts-ignore
|
||||
constructor(meta: number)
|
||||
// @ts-ignore
|
||||
constructor()
|
||||
// @ts-ignore
|
||||
public getName(): string;
|
||||
// @ts-ignore
|
||||
public getId(): number;
|
||||
// @ts-ignore
|
||||
public canBeActivated(): boolean;
|
||||
// @ts-ignore
|
||||
public getHardness(): number;
|
||||
// @ts-ignore
|
||||
public getResistance(): number;
|
||||
// @ts-ignore
|
||||
public getMinX(): number;
|
||||
// @ts-ignore
|
||||
public getMinY(): number;
|
||||
// @ts-ignore
|
||||
public getMinZ(): number;
|
||||
// @ts-ignore
|
||||
public getMaxX(): number;
|
||||
// @ts-ignore
|
||||
public getMaxY(): number;
|
||||
// @ts-ignore
|
||||
public getMaxZ(): number;
|
||||
// @ts-ignore
|
||||
public place(item: cn.nukkit.item.Item, block: cn.nukkit.block.Block, target: cn.nukkit.block.Block, face: cn.nukkit.math.BlockFace, fx: number, fy: number, fz: number, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public onUpdate(type: number): number;
|
||||
// @ts-ignore
|
||||
public getDrops(item: cn.nukkit.item.Item): cn.nukkit.item.Item[];
|
||||
// @ts-ignore
|
||||
public toItem(): cn.nukkit.item.Item;
|
||||
// @ts-ignore
|
||||
public onActivate(item: cn.nukkit.item.Item, player: cn.nukkit.Player): boolean;
|
||||
// @ts-ignore
|
||||
public getColor(): cn.nukkit.utils.BlockColor;
|
||||
// @ts-ignore
|
||||
public getComparatorInputOverride(): number;
|
||||
// @ts-ignore
|
||||
public hasComparatorInputOverride(): boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user