feat: add nukkit support
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
ea28d20aa1
commit
05cbd85828
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@ms/bukkit",
|
"name": "@ms/bukkit",
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"description": "MiaoScript api package",
|
"description": "MiaoScript bukkit package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
"minecraft",
|
"minecraft",
|
||||||
|
@ -19,7 +19,6 @@ export class BukkitCommand extends command.Command {
|
|||||||
init() {
|
init() {
|
||||||
this.commandMap = reflect.on(Bukkit.getPluginManager()).get('commandMap').get();
|
this.commandMap = reflect.on(Bukkit.getPluginManager()).get('commandMap').get();
|
||||||
}
|
}
|
||||||
|
|
||||||
create(plugin: any, command: string) {
|
create(plugin: any, command: string) {
|
||||||
var cmd = this.commandMap.getCommand(command)
|
var cmd = this.commandMap.getCommand(command)
|
||||||
if (cmd && cmd instanceof PluginCommand) { return cmd };
|
if (cmd && cmd instanceof PluginCommand) { return cmd };
|
||||||
|
@ -61,6 +61,11 @@ function detectServer() {
|
|||||||
return 'sponge'
|
return 'sponge'
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
Java.type("cn.nukkit.Nukkit");
|
||||||
|
return 'nukkit'
|
||||||
|
} catch (ex) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Java.type("net.md_5.bungee.api.ProxyServer");
|
Java.type("net.md_5.bungee.api.ProxyServer");
|
||||||
return 'bungee'
|
return 'bungee'
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/// <reference types="@ms/types/dist/typings/bukkit" />
|
/// <reference types="@ms/types/dist/typings/bukkit" />
|
||||||
/// <reference types="@ms/types/dist/typings/sponge" />
|
/// <reference types="@ms/types/dist/typings/sponge" />
|
||||||
/// <reference types="@ms/types/dist/typings/bungee" />
|
/// <reference types="@ms/types/dist/typings/bungee" />
|
||||||
|
/// <reference types="@ms/types/dist/typings/nukkit" />
|
||||||
|
|
||||||
import { server } from '@ms/api';
|
import { server } from '@ms/api';
|
||||||
import { inject } from '@ms/container';
|
import { inject } from '@ms/container';
|
||||||
@ -62,7 +63,7 @@ export class HelloWorld extends interfaces.Plugin {
|
|||||||
return ['world']
|
return ['world']
|
||||||
}
|
}
|
||||||
|
|
||||||
@listener({ servers: ['bukkit'] })
|
@listener({ servers: ['bukkit', 'nukkit'] })
|
||||||
PlayerJoin(event: org.bukkit.event.player.PlayerJoinEvent) {
|
PlayerJoin(event: org.bukkit.event.player.PlayerJoinEvent) {
|
||||||
let plyaer = event.getPlayer();
|
let plyaer = event.getPlayer();
|
||||||
this.logger.console(`§cBukkit §aPlayerJoinEvent: §b${plyaer.getName()}`)
|
this.logger.console(`§cBukkit §aPlayerJoinEvent: §b${plyaer.getName()}`)
|
||||||
|
Loading…
Reference in New Issue
Block a user