1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-12-25 07:08:52 +00:00

doc: 调整Javadoc文档

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-11-16 20:03:55 +08:00
parent 24846733e8
commit 05c1a2b4f1
14 changed files with 110 additions and 118 deletions

22
pom.xml
View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId>
<artifactId>YumCore</artifactId>
<version>1.2</version>
<version>1.3</version>
<build>
<finalName>${project.artifactId}</finalName>
<resources>
@ -17,13 +17,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<version>2.4</version>
<executions>
<execution>
<id>source</id><!--指定一个名字 -->
<phase>compile</phase><!--在编译阶段生成source包 -->
<phase>package</phase>
<goals>
<goal>jar</goal><!--指定生成的文件为jar包 -->
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
@ -32,16 +31,15 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<failOnError>false</failOnError>
</configuration>
<executions>
<execution>
<id>javadocs</id>
<phase>package</phase>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<failOnError>false</failOnError>
</configuration>
</execution>
</executions>
</plugin>
@ -85,6 +83,10 @@
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>

View File

@ -1,14 +1,12 @@
package pw.yumc.YumCore.bukkit;
import java.io.File;
import java.lang.reflect.Field;
import java.util.logging.Logger;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import pw.yumc.YumCore.config.FileConfig;
import java.io.File;
import java.lang.reflect.Field;
import java.util.logging.Logger;
/**
* 插件Instance获取类
@ -44,8 +42,6 @@ public class P {
}
/**
* @param FC
* {@link FileConfig}
* @return 获得插件配置文件
*/
@SuppressWarnings("unchecked")
@ -82,8 +78,6 @@ public class P {
}
/**
* @param PI
* 插件主类
* @return 获得插件
*/
@SuppressWarnings("unchecked")

View File

@ -2,7 +2,6 @@ package pw.yumc.YumCore.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
* 子命令参数类
@ -44,25 +43,10 @@ public class CommandArgument {
return command;
}
/**
* @return 命令发送者(转换为Player)
*/
public Player getPlayer() {
return (Player) sender;
}
/**
* @return 命令发送者
*/
public CommandSender getSender() {
return sender;
}
/**
* @return 命令发送者(自动转换)
*/
@SuppressWarnings("unchecked")
public <CS> CS getSenderEx() {
return (CS) sender;
}
}

View File

@ -1,18 +1,17 @@
package pw.yumc.YumCore.config;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.MemorySection;
import org.bukkit.configuration.file.YamlConfiguration;
import pw.yumc.YumCore.bukkit.Log;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 一个继承于 {@link YamlConfiguration} 的配置文件类
* 强制UTF-8编码处理所有的文件信息
@ -475,15 +474,16 @@ public class FileConfig extends AbstractConfig {
/**
* 获取现在时间
*
*
* @param format
* 字符串格式
* @return yyyy-MM-dd HH:mm:ss
*/
protected String getStringDate(String format) {
if (format == null) {
format = "yyyy-MM-dd HH:mm:ss";
}
Date currentTime = new Date();
return new SimpleDateFormat(format).format(currentTime);
return new SimpleDateFormat(format).format(new Date());
}
/**

View File

@ -178,6 +178,8 @@ public abstract class AbstractInjectConfig {
*
* @param config
* 配置文件区
* @return
* 配置文件
*/
public ConfigurationSection save(ConfigurationSection config) {
inject(config, true);

View File

@ -1,10 +1,8 @@
package pw.yumc.YumCore.kit;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import com.comphenix.protocol.utility.MinecraftFields;
import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -13,13 +11,13 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import com.comphenix.protocol.utility.MinecraftFields;
import com.comphenix.protocol.utility.MinecraftReflection;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import pw.yumc.YumCore.utils.ReflectUtil;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
public class EntityKit {
private static Method _mGetNavigation;
@ -296,7 +294,9 @@ public class EntityKit {
* 静默传送, 不触发事件
*
* @param entity
* 实体
* @param to
* 地点
*/
public static void teleportQuietly(Entity entity, Location to) {
if (!(entity instanceof Player)) {
@ -337,6 +337,7 @@ public class EntityKit {
* 让实体升高/降低
*
* @param ent
* 实体
* @param speed
* 速度
* @param yAdd
@ -354,6 +355,7 @@ public class EntityKit {
* 让实体升高/降低
*
* @param ent
* 实体
* @param vec
* 坐标
* @param speed

View File

@ -1,22 +1,17 @@
package pw.yumc.YumCore.kit;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.bukkit.P;
import java.io.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class LogKit implements Runnable {
private final static Plugin plugin = P.instance;
private final static File dataFolder = plugin.getDataFolder();
@ -71,9 +66,8 @@ public class LogKit implements Runnable {
* @param s
* 日志
*/
public void logConsole(final String s) {
Log.info(s);
log(s);
public void console(final String s) {
sender(Bukkit.getConsoleSender(), s);
}
/**
@ -82,21 +76,11 @@ public class LogKit implements Runnable {
* @param s
* 日志
*/
public void logSender(final CommandSender sender, final String s) {
sender.sendMessage(s);
public void sender(final CommandSender sender, final String s) {
Log.toSender(sender, s);
log(ChatColor.stripColor(s));
}
/**
* 添加日志
*
* @param s
* 日志
*/
public void logSender(final String s) {
logSender(Bukkit.getConsoleSender(), s);
}
@Override
public void run() {
synchronized (logs) {

View File

@ -21,13 +21,15 @@ public class ZipKit {
*
* @param name
* 名称
* @return
* @return 文件名称
*/
public static String getRealName(String name) {
return new File(name).getName();
}
/**
* 解压ZIP文件
*
* @param zipFile
* zip文件
* @param destPath
@ -42,6 +44,8 @@ public class ZipKit {
}
/**
* 解压ZIP文件
*
* @param zipFile
* zip文件
* @param destPath

View File

@ -1,7 +1,5 @@
package pw.yumc.YumCore.mail;
import java.util.Properties;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
@ -9,6 +7,7 @@ import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMessage.RecipientType;
import java.util.Properties;
/**
* 简单邮件发送器可单发群发
@ -68,7 +67,9 @@ public class SimpleMailSender {
* @param recipients
* 收件人们
* @throws AddressException
* 地址异常
* @throws MessagingException
* 消息异常
*/
public void send(SimpleMail mail, String... recipients) throws MessagingException {
// 创建mime类型邮件
@ -110,7 +111,9 @@ public class SimpleMailSender {
* @param recipients
* 收件人邮箱地址
* @throws AddressException
* 地址异常
* @throws MessagingException
* 消息异常
*/
public void send(String subject, Object content, String... recipients) throws MessagingException {
this.send(new SimpleMail(subject, content), recipients);

View File

@ -20,7 +20,7 @@ public class PointAPI {
}
/**
* @return 获取{@PlayerPointsAPI}
* @return 获取{@link PlayerPointsAPI}
*/
public static PlayerPointsAPI getAPI() {
return api;

View File

@ -1,17 +1,15 @@
package pw.yumc.YumCore.plugin.protocollib;
import java.lang.reflect.InvocationTargetException;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketContainer;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import pw.yumc.YumCore.kit.PKit;
import java.lang.reflect.InvocationTargetException;
/**
* ProtocolLib发包工具
*
@ -37,6 +35,7 @@ public class PacketKit {
* @param player
* 玩家
* @throws InvocationTargetException
* 调用异常
*/
public static void keep_live(final Player player) throws InvocationTargetException {
if (ENABLE) {
@ -52,6 +51,7 @@ public class PacketKit {
* @param packet
* 数据包
* @throws InvocationTargetException
* 调用异常
*/
public static void send(final Player player, final PacketContainer packet) throws InvocationTargetException {
if (ENABLE) {

View File

@ -1,20 +1,5 @@
package pw.yumc.YumCore.plugin.protocollib;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.PacketType.Play.Client;
import com.comphenix.protocol.PacketType.Play.Server;
import com.comphenix.protocol.events.PacketAdapter;
@ -24,9 +9,21 @@ import com.comphenix.protocol.events.PacketListener;
import com.comphenix.protocol.wrappers.BlockPosition;
import com.comphenix.protocol.wrappers.WrappedBlockData;
import com.comphenix.protocol.wrappers.WrappedChatComponent;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import pw.yumc.YumCore.bukkit.P;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 木牌工具类
*
@ -51,6 +48,7 @@ public class SignKit extends ProtocolLibBase {
* @param lines
* 木牌内容
* @throws InvocationTargetException
* 调用异常
*/
public static void open(Player player, String[] lines) throws InvocationTargetException {
Location loc = player.getLocation();
@ -173,7 +171,7 @@ public class SignKit extends ProtocolLibBase {
public static class SignUpdateListen extends PacketAdapter implements PacketListener {
public SignUpdateListen() {
super(P.instance, new PacketType[] { Client.UPDATE_SIGN });
super(P.instance, Client.UPDATE_SIGN);
}
@Override
@ -195,6 +193,13 @@ public class SignKit extends ProtocolLibBase {
event.setCancelled(sue.isCancelled());
}
/**
* 去除首尾
*
* @param string
* 字符串
* @return 处理后的字符串
*/
private String subString(String string) {
return string.substring(1, string.length() - 1);
}

View File

@ -84,6 +84,7 @@ public class Reflect {
* 字段名
* @return 字段{@link Field}
* @throws NoSuchFieldException
* 没有这样的字段
*/
public static Field getDeclaredField(Class<?> clazz, final String name) throws NoSuchFieldException {
Field field = null;
@ -154,6 +155,10 @@ public class Reflect {
/**
* Get a wrapper type for a primitive type, or the argument type itself, if it is not a primitive type.
*
* @param type
*
* @return 返回封装类
*/
public static Class<?> wrapper(final Class<?> type) {
if (type == null) {
@ -177,14 +182,16 @@ public class Reflect {
return Character.class;
} else if (void.class == type) { return Void.class; }
}
return type;
}
/**
* Load a class
*
* @param name
* 类名
* @return
* @see Class#forName(String)
* @throws ReflectException
* 反射异常
*/
private static Class<?> forName(final String name) throws ReflectException {
try {

View File

@ -3,6 +3,16 @@
*/
package pw.yumc.YumCore.statistic;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@ -15,16 +25,6 @@ import java.util.LinkedList;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
/**
* Yum数据中心 数据统计类
*
@ -127,6 +127,7 @@ public class Statistics {
* 请求参数
* @return 所代表远程资源的响应结果
* @throws IOException
* IO异常
*/
public static String postData(String url, String param) throws IOException {
PrintWriter out;
@ -165,6 +166,7 @@ public class Statistics {
* @param config
* 配置文件
* @throws IOException
* IO异常
*/
private static void initFile(YamlConfiguration config) throws IOException {
if (config.getString("guid") == null) {
@ -274,6 +276,9 @@ public class Statistics {
private LinkedList<Double> history = new LinkedList<>();
private transient long lastPoll = System.nanoTime();
/**
* @return 获得TPS
*/
public double getAverageTPS() {
double avg = 0.0D;
for (Double f : history) {