Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Merge pull request #23 from McMoonLakeDev/v1.8-a4
Browse files Browse the repository at this point in the history
V1.8 a4
  • Loading branch information
MoonLake authored Dec 27, 2016
2 parents d0947ab + 53c806d commit cf1d61b
Show file tree
Hide file tree
Showing 9 changed files with 343 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# MoonLake [![GitHub version](https://d25lcipzij17d.cloudfront.net/badge.svg?id=gh&type=6&v=1.8-r3&x2=0)](https://github.com/u2g/MoonLake) [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=102)](https://github.com/u2g/MoonLake) [![Open Source Love](https://badges.frapsoft.com/os/gpl/gpl.svg?v=102)](https://github.com/u2g/MoonLake)
# MoonLake [![GitHub version](https://d25lcipzij17d.cloudfront.net/badge.svg?id=gh&type=6&v=1.8-a4&x2=0)](https://github.com/u2g/MoonLake) [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=102)](https://github.com/u2g/MoonLake) [![Open Source Love](https://badges.frapsoft.com/os/gpl/gpl.svg?v=102)](https://github.com/u2g/MoonLake)

Minecraft MoonLake Core API Plugin
By Month_Light Ver: 1.8-r3
By Month_Light Ver: 1.8-a4

## 简介
这个插件提供了大量的 API 功能,实现了一些 Bukkit 无法做到的 NMS 功能<br />
Expand Down
6 changes: 3 additions & 3 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
################################
# MoonLake Core API Plugin #
# By Month_Light Ver: 1.8-r3 #
# By Month_Light Ver: 1.8-a4 #
################################

# 插件版本号: 此项请勿修改!
version: '1.8-r3'
version: '1.8-a4'

# 数据包通道监听器
# 此项可设置是否开启这个功能
# 如果关闭则插件中的一些API功能将无法使用
# 例如: MoonLakePlayerJoinEvent
# PS: 此项是实时监听客户端与服务端的数据包交流
PacketChannelListener: true
PacketChannelListener: false
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: MoonLake
main: com.minecraft.moonlake.MoonLakePlugin
version: 1.8-r3
version: 1.8-a4
prefix: MoonLake
description: Minecraft MoonLake Core API Plugin
website: http://www.mcyszh.com/
author: Month_Light
authors: [Month_Light, MoonLake]
softdepend: [MoonLakeEconomy, PermissionsEx, Vault]
softdepend: [MoonLakeEconomy, PermissionsEx, Vault]
6 changes: 3 additions & 3 deletions src/com/minecraft/moonlake/MoonLakePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* <hr />
* <div>
* <h1>Minecraft MoonLake Core API Plugin</h1>
* <p>By Month_Light Ver: 1.8-r3</p>
* <p>By Month_Light Ver: 1.8-a4</p>
* <p>Website: <a href="http://www.mcyszh.com" target="_blank" style="text-decoration: none;">MoonLake Website</a></p>
* <p>QQ Group: 377607025 -> <a href="http://jq.qq.com/?_wv=1027&k=2IfPFrH" target="_blank">Jump</a></p>
* <hr />
Expand All @@ -42,7 +42,7 @@
* <ul>
* <li>Bukkit [1.8.x - 1.11.x] <span style="color: red">✔</span> 不完全支持</li>
* <li>Spigot [1.8.x - 1.11.x] <span style="color: rgb(85, 255, 85)">✔</span> 完完全全支持</li>
* <li>PaperSpigot [1.8.x - 1.11.x] <span style="color: rgb(85, 255, 85)"><s>✔</s></span> 完完全全支持</li>
* <li>PaperSpigot [1.8.x - 1.11.x] <span style="color: rgb(85, 255, 85)"></span> 完完全全支持</li>
* <li>Cauldron | KCauldron [模组服务端] <span style="color: red">✘</span> 完全不支持</li>
* </ul>
* </div>
Expand All @@ -68,7 +68,7 @@
* <h1>修改操作请您遵守 <a href="https://github.com/u2g/MoonLake/blob/master/LICENSE" target="_blank">GPLv3</a> 协议,您必须公开修改过的所有代码!</h1>
* </div>
*
* @version 1.8-r3
* @version 1.8-a4
* @author Month_Light
*/
public class MoonLakePlugin extends JavaPlugin implements MoonLake {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;

/**
* <h1>CommandAnnotationExpression</h1>
Expand All @@ -49,12 +50,23 @@ public void load(Plugin plugin, Object obj) throws MoonLakeException {
registerCommand(plugin, obj);
}

@Override
public void load(Plugin plugin, MoonLakeCommand obj) throws MoonLakeException {

registerCommand(plugin, obj);
}

@Override
public Set<CommandAnnotated> registerCommand(Plugin plugin, Object obj) throws MoonLakeException {

Validate.notNull(plugin, "The plugin object is null.");
Validate.notNull(obj, "The obj object is null.");

if(!(obj instanceof MoonLakeCommand)) {
// warn new version need implements MoonLakeCommand
plugin.getLogger().log(Level.WARNING, "[MoonLake] 警告: 新版本核心插件命令类需要实现 MoonLakeCommand 接口. (请注意更新!)");
}

Class<?> clazz = obj.getClass();
Set<CommandAnnotated> commands = new HashSet<>();
Set<Method> commandCompletionMethods = new HashSet<>();
Expand Down Expand Up @@ -98,4 +110,10 @@ public Set<CommandAnnotated> registerCommand(Plugin plugin, Object obj) throws M
}
return commands;
}

@Override
public Set<CommandAnnotated> registerCommand(Plugin plugin, MoonLakeCommand obj) throws MoonLakeException {

return registerCommand(plugin, (Object) obj);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,32 @@
*/
public interface CommandAnnotation extends PluginAnnotation {

/**
* 将指定插件的指定对象加载数据
*
* @param plugin 插件
* @param obj 对象
* @throws IllegalArgumentException 如果插件对象为 {@code null} 则抛出异常
* @throws IllegalArgumentException 如果指定加载对象为 {@code null} 则抛出异常
* @throws MoonLakeException 如果加载错误则抛出异常
* @see #load(Plugin, MoonLakeCommand)
*/
@Override
@Deprecated
void load(Plugin plugin, Object obj) throws MoonLakeException;

/**
* 将指定插件的指定对象加载数据
*
* @param plugin 插件
* @param obj 对象命令
* @throws IllegalArgumentException 如果插件对象为 {@code null} 则抛出异常
* @throws IllegalArgumentException 如果指定加载对象为 {@code null} 则抛出异常
* @throws MoonLakeException 如果加载错误则抛出异常
* @see #registerCommand(Plugin, MoonLakeCommand)
*/
void load(Plugin plugin, MoonLakeCommand obj) throws MoonLakeException;

/**
* 将指定插件的指定对象注册命令
*
Expand All @@ -43,6 +69,21 @@ public interface CommandAnnotation extends PluginAnnotation {
* @throws IllegalArgumentException 如果插件对象为 {@code null} 则抛出异常
* @throws IllegalArgumentException 如果指定加载对象为 {@code null} 则抛出异常
* @throws MoonLakeException 如果注册错误则抛出异常
* @deprecated @deprecated 已过时, 将于 v2.0 删除. 请使用 {@link #registerCommand(Plugin, MoonLakeCommand)}
* @see #registerCommand(Plugin, MoonLakeCommand)
*/
@Deprecated
Set<CommandAnnotated> registerCommand(Plugin plugin, Object obj) throws MoonLakeException;

/**
* 将指定插件的指定对象注册命令
*
* @param plugin 插件
* @param obj 对象命令
* @return 命令
* @throws IllegalArgumentException 如果插件对象为 {@code null} 则抛出异常
* @throws IllegalArgumentException 如果指定加载对象为 {@code null} 则抛出异常
* @throws MoonLakeException 如果注册错误则抛出异常
*/
Set<CommandAnnotated> registerCommand(Plugin plugin, MoonLakeCommand obj) throws MoonLakeException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2016 The MoonLake Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


package com.minecraft.moonlake.api.annotation.plugin.command;

/**
* <h1>MoonLakeCommand</h1>
* 月色之湖命令接口类(详细doc待补充...)
*
* @version 1.0
* @author Month_Light
* @see CommandAnnotated
*/
public interface MoonLakeCommand {
}
Loading

0 comments on commit cf1d61b

Please sign in to comment.