mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-11-24 02:08:48 +00:00
doc: 调整Javadoc文档
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
24846733e8
commit
05c1a2b4f1
26
pom.xml
26
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>pw.yumc</groupId>
|
<groupId>pw.yumc</groupId>
|
||||||
<artifactId>YumCore</artifactId>
|
<artifactId>YumCore</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.3</version>
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
<resources>
|
<resources>
|
||||||
@ -17,13 +17,12 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<version>2.2.1</version>
|
<version>2.4</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>source</id><!--指定一个名字 -->
|
<phase>package</phase>
|
||||||
<phase>compile</phase><!--在编译阶段生成source包 -->
|
|
||||||
<goals>
|
<goals>
|
||||||
<goal>jar</goal><!--指定生成的文件为jar包 -->
|
<goal>jar-no-fork</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
@ -32,16 +31,15 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>2.10.3</version>
|
<version>2.10.3</version>
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>javadocs</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>jar</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<failOnError>false</failOnError>
|
<failOnError>false</failOnError>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
@ -85,6 +83,10 @@
|
|||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package pw.yumc.YumCore.bukkit;
|
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.command.PluginCommand;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
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获取类
|
* 插件Instance获取类
|
||||||
@ -44,8 +42,6 @@ public class P {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FC
|
|
||||||
* {@link FileConfig}
|
|
||||||
* @return 获得插件配置文件
|
* @return 获得插件配置文件
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -82,8 +78,6 @@ public class P {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param PI
|
|
||||||
* 插件主类
|
|
||||||
* @return 获得插件
|
* @return 获得插件
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -2,7 +2,6 @@ package pw.yumc.YumCore.commands;
|
|||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子命令参数类
|
* 子命令参数类
|
||||||
@ -44,25 +43,10 @@ public class CommandArgument {
|
|||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return 命令发送者(转换为Player)
|
|
||||||
*/
|
|
||||||
public Player getPlayer() {
|
|
||||||
return (Player) sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 命令发送者
|
* @return 命令发送者
|
||||||
*/
|
*/
|
||||||
public CommandSender getSender() {
|
public CommandSender getSender() {
|
||||||
return sender;
|
return sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return 命令发送者(自动转换)
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <CS> CS getSenderEx() {
|
|
||||||
return (CS) sender;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
package pw.yumc.YumCore.config;
|
package pw.yumc.YumCore.config;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.MemorySection;
|
import org.bukkit.configuration.MemorySection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import pw.yumc.YumCore.bukkit.Log;
|
import pw.yumc.YumCore.bukkit.Log;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一个继承于 {@link YamlConfiguration} 的配置文件类
|
* 一个继承于 {@link YamlConfiguration} 的配置文件类
|
||||||
* 强制UTF-8编码处理所有的文件信息
|
* 强制UTF-8编码处理所有的文件信息
|
||||||
@ -476,14 +475,15 @@ public class FileConfig extends AbstractConfig {
|
|||||||
/**
|
/**
|
||||||
* 获取现在时间
|
* 获取现在时间
|
||||||
*
|
*
|
||||||
|
* @param format
|
||||||
|
* 字符串格式
|
||||||
* @return yyyy-MM-dd HH:mm:ss
|
* @return yyyy-MM-dd HH:mm:ss
|
||||||
*/
|
*/
|
||||||
protected String getStringDate(String format) {
|
protected String getStringDate(String format) {
|
||||||
if (format == null) {
|
if (format == null) {
|
||||||
format = "yyyy-MM-dd HH:mm:ss";
|
format = "yyyy-MM-dd HH:mm:ss";
|
||||||
}
|
}
|
||||||
Date currentTime = new Date();
|
return new SimpleDateFormat(format).format(new Date());
|
||||||
return new SimpleDateFormat(format).format(currentTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,6 +178,8 @@ public abstract class AbstractInjectConfig {
|
|||||||
*
|
*
|
||||||
* @param config
|
* @param config
|
||||||
* 配置文件区
|
* 配置文件区
|
||||||
|
* @return
|
||||||
|
* 配置文件
|
||||||
*/
|
*/
|
||||||
public ConfigurationSection save(ConfigurationSection config) {
|
public ConfigurationSection save(ConfigurationSection config) {
|
||||||
inject(config, true);
|
inject(config, true);
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package pw.yumc.YumCore.kit;
|
package pw.yumc.YumCore.kit;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import com.comphenix.protocol.utility.MinecraftFields;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||||
import java.lang.reflect.Method;
|
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -13,13 +11,13 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
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 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 {
|
public class EntityKit {
|
||||||
|
|
||||||
private static Method _mGetNavigation;
|
private static Method _mGetNavigation;
|
||||||
@ -296,7 +294,9 @@ public class EntityKit {
|
|||||||
* 静默传送, 不触发事件
|
* 静默传送, 不触发事件
|
||||||
*
|
*
|
||||||
* @param entity
|
* @param entity
|
||||||
|
* 实体
|
||||||
* @param to
|
* @param to
|
||||||
|
* 地点
|
||||||
*/
|
*/
|
||||||
public static void teleportQuietly(Entity entity, Location to) {
|
public static void teleportQuietly(Entity entity, Location to) {
|
||||||
if (!(entity instanceof Player)) {
|
if (!(entity instanceof Player)) {
|
||||||
@ -337,6 +337,7 @@ public class EntityKit {
|
|||||||
* 让实体升高/降低
|
* 让实体升高/降低
|
||||||
*
|
*
|
||||||
* @param ent
|
* @param ent
|
||||||
|
* 实体
|
||||||
* @param speed
|
* @param speed
|
||||||
* 速度
|
* 速度
|
||||||
* @param yAdd
|
* @param yAdd
|
||||||
@ -354,6 +355,7 @@ public class EntityKit {
|
|||||||
* 让实体升高/降低
|
* 让实体升高/降低
|
||||||
*
|
*
|
||||||
* @param ent
|
* @param ent
|
||||||
|
* 实体
|
||||||
* @param vec
|
* @param vec
|
||||||
* 坐标
|
* 坐标
|
||||||
* @param speed
|
* @param speed
|
||||||
|
@ -1,22 +1,17 @@
|
|||||||
package pw.yumc.YumCore.kit;
|
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.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import pw.yumc.YumCore.bukkit.Log;
|
import pw.yumc.YumCore.bukkit.Log;
|
||||||
import pw.yumc.YumCore.bukkit.P;
|
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 {
|
public class LogKit implements Runnable {
|
||||||
private final static Plugin plugin = P.instance;
|
private final static Plugin plugin = P.instance;
|
||||||
private final static File dataFolder = plugin.getDataFolder();
|
private final static File dataFolder = plugin.getDataFolder();
|
||||||
@ -71,9 +66,8 @@ public class LogKit implements Runnable {
|
|||||||
* @param s
|
* @param s
|
||||||
* 日志
|
* 日志
|
||||||
*/
|
*/
|
||||||
public void logConsole(final String s) {
|
public void console(final String s) {
|
||||||
Log.info(s);
|
sender(Bukkit.getConsoleSender(), s);
|
||||||
log(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,21 +76,11 @@ public class LogKit implements Runnable {
|
|||||||
* @param s
|
* @param s
|
||||||
* 日志
|
* 日志
|
||||||
*/
|
*/
|
||||||
public void logSender(final CommandSender sender, final String s) {
|
public void sender(final CommandSender sender, final String s) {
|
||||||
sender.sendMessage(s);
|
Log.toSender(sender, s);
|
||||||
log(ChatColor.stripColor(s));
|
log(ChatColor.stripColor(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加日志
|
|
||||||
*
|
|
||||||
* @param s
|
|
||||||
* 日志
|
|
||||||
*/
|
|
||||||
public void logSender(final String s) {
|
|
||||||
logSender(Bukkit.getConsoleSender(), s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
synchronized (logs) {
|
synchronized (logs) {
|
||||||
|
@ -21,13 +21,15 @@ public class ZipKit {
|
|||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* 名称
|
* 名称
|
||||||
* @return
|
* @return 文件名称
|
||||||
*/
|
*/
|
||||||
public static String getRealName(String name) {
|
public static String getRealName(String name) {
|
||||||
return new File(name).getName();
|
return new File(name).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 解压ZIP文件
|
||||||
|
*
|
||||||
* @param zipFile
|
* @param zipFile
|
||||||
* zip文件
|
* zip文件
|
||||||
* @param destPath
|
* @param destPath
|
||||||
@ -42,6 +44,8 @@ public class ZipKit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 解压ZIP文件
|
||||||
|
*
|
||||||
* @param zipFile
|
* @param zipFile
|
||||||
* zip文件
|
* zip文件
|
||||||
* @param destPath
|
* @param destPath
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package pw.yumc.YumCore.mail;
|
package pw.yumc.YumCore.mail;
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
import javax.mail.Session;
|
import javax.mail.Session;
|
||||||
import javax.mail.Transport;
|
import javax.mail.Transport;
|
||||||
@ -9,6 +7,7 @@ import javax.mail.internet.AddressException;
|
|||||||
import javax.mail.internet.InternetAddress;
|
import javax.mail.internet.InternetAddress;
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import javax.mail.internet.MimeMessage.RecipientType;
|
import javax.mail.internet.MimeMessage.RecipientType;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 简单邮件发送器,可单发,群发。
|
* 简单邮件发送器,可单发,群发。
|
||||||
@ -68,7 +67,9 @@ public class SimpleMailSender {
|
|||||||
* @param recipients
|
* @param recipients
|
||||||
* 收件人们
|
* 收件人们
|
||||||
* @throws AddressException
|
* @throws AddressException
|
||||||
|
* 地址异常
|
||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
|
* 消息异常
|
||||||
*/
|
*/
|
||||||
public void send(SimpleMail mail, String... recipients) throws MessagingException {
|
public void send(SimpleMail mail, String... recipients) throws MessagingException {
|
||||||
// 创建mime类型邮件
|
// 创建mime类型邮件
|
||||||
@ -110,7 +111,9 @@ public class SimpleMailSender {
|
|||||||
* @param recipients
|
* @param recipients
|
||||||
* 收件人邮箱地址
|
* 收件人邮箱地址
|
||||||
* @throws AddressException
|
* @throws AddressException
|
||||||
|
* 地址异常
|
||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
|
* 消息异常
|
||||||
*/
|
*/
|
||||||
public void send(String subject, Object content, String... recipients) throws MessagingException {
|
public void send(String subject, Object content, String... recipients) throws MessagingException {
|
||||||
this.send(new SimpleMail(subject, content), recipients);
|
this.send(new SimpleMail(subject, content), recipients);
|
||||||
|
@ -20,7 +20,7 @@ public class PointAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 获取{@PlayerPointsAPI}
|
* @return 获取{@link PlayerPointsAPI}
|
||||||
*/
|
*/
|
||||||
public static PlayerPointsAPI getAPI() {
|
public static PlayerPointsAPI getAPI() {
|
||||||
return api;
|
return api;
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
package pw.yumc.YumCore.plugin.protocollib;
|
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.PacketType;
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
import com.comphenix.protocol.ProtocolManager;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import pw.yumc.YumCore.kit.PKit;
|
import pw.yumc.YumCore.kit.PKit;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProtocolLib发包工具
|
* ProtocolLib发包工具
|
||||||
*
|
*
|
||||||
@ -37,6 +35,7 @@ public class PacketKit {
|
|||||||
* @param player
|
* @param player
|
||||||
* 玩家
|
* 玩家
|
||||||
* @throws InvocationTargetException
|
* @throws InvocationTargetException
|
||||||
|
* 调用异常
|
||||||
*/
|
*/
|
||||||
public static void keep_live(final Player player) throws InvocationTargetException {
|
public static void keep_live(final Player player) throws InvocationTargetException {
|
||||||
if (ENABLE) {
|
if (ENABLE) {
|
||||||
@ -52,6 +51,7 @@ public class PacketKit {
|
|||||||
* @param packet
|
* @param packet
|
||||||
* 数据包
|
* 数据包
|
||||||
* @throws InvocationTargetException
|
* @throws InvocationTargetException
|
||||||
|
* 调用异常
|
||||||
*/
|
*/
|
||||||
public static void send(final Player player, final PacketContainer packet) throws InvocationTargetException {
|
public static void send(final Player player, final PacketContainer packet) throws InvocationTargetException {
|
||||||
if (ENABLE) {
|
if (ENABLE) {
|
||||||
|
@ -1,20 +1,5 @@
|
|||||||
package pw.yumc.YumCore.plugin.protocollib;
|
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.Client;
|
||||||
import com.comphenix.protocol.PacketType.Play.Server;
|
import com.comphenix.protocol.PacketType.Play.Server;
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
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.BlockPosition;
|
||||||
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
import com.comphenix.protocol.wrappers.WrappedBlockData;
|
||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
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 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
|
* @param lines
|
||||||
* 木牌内容
|
* 木牌内容
|
||||||
* @throws InvocationTargetException
|
* @throws InvocationTargetException
|
||||||
|
* 调用异常
|
||||||
*/
|
*/
|
||||||
public static void open(Player player, String[] lines) throws InvocationTargetException {
|
public static void open(Player player, String[] lines) throws InvocationTargetException {
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
@ -173,7 +171,7 @@ public class SignKit extends ProtocolLibBase {
|
|||||||
public static class SignUpdateListen extends PacketAdapter implements PacketListener {
|
public static class SignUpdateListen extends PacketAdapter implements PacketListener {
|
||||||
|
|
||||||
public SignUpdateListen() {
|
public SignUpdateListen() {
|
||||||
super(P.instance, new PacketType[] { Client.UPDATE_SIGN });
|
super(P.instance, Client.UPDATE_SIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -195,6 +193,13 @@ public class SignKit extends ProtocolLibBase {
|
|||||||
event.setCancelled(sue.isCancelled());
|
event.setCancelled(sue.isCancelled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 去除首尾
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* 字符串
|
||||||
|
* @return 处理后的字符串
|
||||||
|
*/
|
||||||
private String subString(String string) {
|
private String subString(String string) {
|
||||||
return string.substring(1, string.length() - 1);
|
return string.substring(1, string.length() - 1);
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ public class Reflect {
|
|||||||
* 字段名
|
* 字段名
|
||||||
* @return 字段{@link Field}
|
* @return 字段{@link Field}
|
||||||
* @throws NoSuchFieldException
|
* @throws NoSuchFieldException
|
||||||
|
* 没有这样的字段
|
||||||
*/
|
*/
|
||||||
public static Field getDeclaredField(Class<?> clazz, final String name) throws NoSuchFieldException {
|
public static Field getDeclaredField(Class<?> clazz, final String name) throws NoSuchFieldException {
|
||||||
Field field = null;
|
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.
|
* 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) {
|
public static Class<?> wrapper(final Class<?> type) {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
@ -177,14 +182,16 @@ public class Reflect {
|
|||||||
return Character.class;
|
return Character.class;
|
||||||
} else if (void.class == type) { return Void.class; }
|
} else if (void.class == type) { return Void.class; }
|
||||||
}
|
}
|
||||||
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a class
|
* @param name
|
||||||
*
|
* 类名
|
||||||
|
* @return 类
|
||||||
* @see Class#forName(String)
|
* @see Class#forName(String)
|
||||||
|
* @throws ReflectException
|
||||||
|
* 反射异常
|
||||||
*/
|
*/
|
||||||
private static Class<?> forName(final String name) throws ReflectException {
|
private static Class<?> forName(final String name) throws ReflectException {
|
||||||
try {
|
try {
|
||||||
|
@ -3,6 +3,16 @@
|
|||||||
*/
|
*/
|
||||||
package pw.yumc.YumCore.statistic;
|
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.io.*;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -15,16 +25,6 @@ import java.util.LinkedList;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
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数据中心 数据统计类
|
* Yum数据中心 数据统计类
|
||||||
*
|
*
|
||||||
@ -127,6 +127,7 @@ public class Statistics {
|
|||||||
* 请求参数
|
* 请求参数
|
||||||
* @return 所代表远程资源的响应结果
|
* @return 所代表远程资源的响应结果
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
* IO异常
|
||||||
*/
|
*/
|
||||||
public static String postData(String url, String param) throws IOException {
|
public static String postData(String url, String param) throws IOException {
|
||||||
PrintWriter out;
|
PrintWriter out;
|
||||||
@ -165,6 +166,7 @@ public class Statistics {
|
|||||||
* @param config
|
* @param config
|
||||||
* 配置文件
|
* 配置文件
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
* IO异常
|
||||||
*/
|
*/
|
||||||
private static void initFile(YamlConfiguration config) throws IOException {
|
private static void initFile(YamlConfiguration config) throws IOException {
|
||||||
if (config.getString("guid") == null) {
|
if (config.getString("guid") == null) {
|
||||||
@ -274,6 +276,9 @@ public class Statistics {
|
|||||||
private LinkedList<Double> history = new LinkedList<>();
|
private LinkedList<Double> history = new LinkedList<>();
|
||||||
private transient long lastPoll = System.nanoTime();
|
private transient long lastPoll = System.nanoTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 获得TPS
|
||||||
|
*/
|
||||||
public double getAverageTPS() {
|
public double getAverageTPS() {
|
||||||
double avg = 0.0D;
|
double avg = 0.0D;
|
||||||
for (Double f : history) {
|
for (Double f : history) {
|
||||||
|
Loading…
Reference in New Issue
Block a user