init: 项目初始化

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-09-22 16:35:40 +08:00
commit 270291ff91
10 changed files with 1036 additions and 0 deletions

8
.classpath Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

41
.gitignore vendored Normal file
View File

@ -0,0 +1,41 @@
#WorkSpace
WorkSpace
# Eclipse stuff
/.settings
# netbeans
/nbproject
# we use maven!
/build.xml
# maven
/target
/repo
# vim
.*.sw[a-p]
# various other potential build files
/build
/bin
/dist
/manifest.mf
/world
# Mac filesystem dust
*.DS_Store
# intellij
*.iml
*.ipr
*.iws
.idea/
# Project Stuff
/src/main/resources/Soulbound
# Atlassian Stuff
/atlassian-ide-plugin.xml

23
.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MiaoLobby</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

650
obf.dict Normal file
View File

@ -0,0 +1,650 @@
ʻ
ʼ
ʽ
ʾ
ʿ
ˆ
ˈ
ˉ
ˊ
ˋ
ˎ
ˏ
ˑ
י
ـ
ٴ
゙゙
ᐧᐧ
ᴵᴵ
ʻʻ
ʽʽ
ʼʼ
ʿʿ
ʾʾ
ــ
ˆˆ
ˉˉ
ˈˈ
ˋˋ
ˊˊ
ˏˏ
ˎˎ
ˑˑ
ᵔᵔ
יי
ᵎᵎ
ᵢᵢ
ⁱⁱ
ﹳﹳ
ٴٴ
ﹶﹶ
ʻʼ
ʻʽ
ʻʾ
ʻʿ
ʻˆ
ʻˈ
ʻˉ
ʻˊ
ʻˋ
ʻˎ
ʻˏ
ʻˑ
ʻי
ʻـ
ʻٴ
ʻᐧ
ʻᴵ
ʻᵎ
ʻᵔ
ʻᵢ
ʻⁱ
ʻﹳ
ʻﹶ
ʻ゙
ʼʻ
ʼʽ
ʼʾ
ʼʿ
ʼˆ
ʼˈ
ʼˉ
ʼˊ
ʼˋ
ʼˎ
ʼˏ
ʼˑ
ʼי
ʼـ
ʼٴ
ʼᐧ
ʼᴵ
ʼᵎ
ʼᵔ
ʼᵢ
ʼⁱ
ʼﹳ
ʼﹶ
ʼ゙
ʽʻ
ʽʼ
ʽʾ
ʽʿ
ʽˆ
ʽˈ
ʽˉ
ʽˊ
ʽˋ
ʽˎ
ʽˏ
ʽˑ
ʽי
ʽـ
ʽٴ
ʽᐧ
ʽᴵ
ʽᵎ
ʽᵔ
ʽᵢ
ʽⁱ
ʽﹳ
ʽﹶ
ʽ゙
ʾʻ
ʾʼ
ʾʽ
ʾʿ
ʾˆ
ʾˈ
ʾˉ
ʾˊ
ʾˋ
ʾˎ
ʾˏ
ʾˑ
ʾי
ʾـ
ʾٴ
ʾᐧ
ʾᴵ
ʾᵎ
ʾᵔ
ʾᵢ
ʾⁱ
ʾﹳ
ʾﹶ
ʾ゙
ʿʻ
ʿʼ
ʿʽ
ʿʾ
ʿˆ
ʿˈ
ʿˉ
ʿˊ
ʿˋ
ʿˎ
ʿˏ
ʿˑ
ʿי
ʿـ
ʿٴ
ʿᐧ
ʿᴵ
ʿᵎ
ʿᵔ
ʿᵢ
ʿⁱ
ʿﹳ
ʿﹶ
ʿ゙
ˆʻ
ˆʼ
ˆʽ
ˆʾ
ˆʿ
ˆˈ
ˆˉ
ˆˊ
ˆˋ
ˆˎ
ˆˏ
ˆˑ
ˆי
ˆـ
ˆٴ
ˆᐧ
ˆᴵ
ˆᵎ
ˆᵔ
ˆᵢ
ˆⁱ
ˆﹳ
ˆﹶ
ˆ゙
ˈʻ
ˈʼ
ˈʽ
ˈʾ
ˈʿ
ˈˆ
ˈˉ
ˈˊ
ˈˋ
ˈˎ
ˈˏ
ˈˑ
ˈי
ˈـ
ˈٴ
ˈᐧ
ˈᴵ
ˈᵎ
ˈᵔ
ˈᵢ
ˈⁱ
ˈﹳ
ˈﹶ
ˈ゙
ˉʻ
ˉʼ
ˉʽ
ˉʾ
ˉʿ
ˉˆ
ˉˈ
ˉˊ
ˉˋ
ˉˎ
ˉˏ
ˉˑ
ˉי
ˉـ
ˉٴ
ˉᐧ
ˉᴵ
ˉᵎ
ˉᵔ
ˉᵢ
ˉⁱ
ˉﹳ
ˉﹶ
ˉ゙
ˊʻ
ˊʼ
ˊʽ
ˊʾ
ˊʿ
ˊˆ
ˊˈ
ˊˉ
ˊˋ
ˊˎ
ˊˏ
ˊˑ
ˊי
ˊـ
ˊٴ
ˊᐧ
ˊᴵ
ˊᵎ
ˊᵔ
ˊᵢ
ˊⁱ
ˊﹳ
ˊﹶ
ˊ゙
ˋʻ
ˋʼ
ˋʽ
ˋʾ
ˋʿ
ˋˆ
ˋˈ
ˋˉ
ˋˊ
ˋˎ
ˋˏ
ˋˑ
ˋי
ˋـ
ˋٴ
ˋᐧ
ˋᴵ
ˋᵎ
ˋᵔ
ˋᵢ
ˋⁱ
ˋﹳ
ˋﹶ
ˋ゙
ˎʻ
ˎʼ
ˎʽ
ˎʾ
ˎʿ
ˎˆ
ˎˈ
ˎˉ
ˎˊ
ˎˋ
ˎˏ
ˎˑ
ˎי
ˎـ
ˎٴ
ˎᐧ
ˎᴵ
ˎᵎ
ˎᵔ
ˎᵢ
ˎⁱ
ˎﹳ
ˎﹶ
ˎ゙
ˏʻ
ˏʼ
ˏʽ
ˏʾ
ˏʿ
ˏˆ
ˏˈ
ˏˉ
ˏˊ
ˏˋ
ˏˎ
ˏˑ
ˏי
ˏـ
ˏٴ
ˏᐧ
ˏᴵ
ˏᵎ
ˏᵔ
ˏᵢ
ˏⁱ
ˏﹳ
ˏﹶ
ˏ゙
ˑʻ
ˑʼ
ˑʽ
ˑʾ
ˑʿ
ˑˆ
ˑˈ
ˑˉ
ˑˊ
ˑˋ
ˑˎ
ˑˏ
ˑי
ˑـ
ˑٴ
ˑᐧ
ˑᴵ
ˑᵎ
ˑᵔ
ˑᵢ
ˑⁱ
ˑﹳ
ˑﹶ
ˑ゙
יʻ
יʼ
יʽ
יʾ
יʿ
יˆ
יˈ
יˉ
יˊ
יˋ
יˎ
יˏ
יˑ
יـ
יٴ
יᐧ
יᴵ
יᵎ
יᵔ
יᵢ
יⁱ
יﹳ
יﹶ
י゙
ـʻ
ـʼ
ـʽ
ـʾ
ـʿ
ـˆ
ـˈ
ـˉ
ـˊ
ـˋ
ـˎ
ـˏ
ـˑ
ـי
ـٴ
ـᐧ
ـᴵ
ـᵎ
ـᵔ
ـᵢ
ـⁱ
ـﹳ
ـﹶ
ـ゙
ٴʻ
ٴʼ
ٴʽ
ٴʾ
ٴʿ
ٴˆ
ٴˈ
ٴˉ
ٴˊ
ٴˋ
ٴˎ
ٴˏ
ٴˑ
ٴי
ٴـ
ٴᐧ
ٴᴵ
ٴᵎ
ٴᵔ
ٴᵢ
ٴⁱ
ٴﹳ
ٴﹶ
ٴ゙
ᐧʻ
ᐧʼ
ᐧʽ
ᐧʾ
ᐧʿ
ᐧˆ
ᐧˈ
ᐧˉ
ᐧˊ
ᐧˋ
ᐧˎ
ᐧˏ
ᐧˑ
ᐧי
ᐧـ
ᐧٴ
ᐧᴵ
ᐧᵎ
ᐧᵔ
ᐧᵢ
ᐧⁱ
ᐧﹳ
ᐧﹶ
ᐧ゙
ᴵʻ
ᴵʼ
ᴵʽ
ᴵʾ
ᴵʿ
ᴵˆ
ᴵˈ
ᴵˉ
ᴵˊ
ᴵˋ
ᴵˎ
ᴵˏ
ᴵˑ
ᴵי
ᴵـ
ᴵٴ
ᴵᐧ
ᴵᵎ
ᴵᵔ
ᴵᵢ
ᴵⁱ
ᴵﹳ
ᴵﹶ
ᴵ゙
ᵎʻ
ᵎʼ
ᵎʽ
ᵎʾ
ᵎʿ
ᵎˆ
ᵎˈ
ᵎˉ
ᵎˊ
ᵎˋ
ᵎˎ
ᵎˏ
ᵎˑ
ᵎי
ᵎـ
ᵎٴ
ᵎᐧ
ᵎᴵ
ᵎᵔ
ᵎᵢ
ᵎⁱ
ᵎﹳ
ᵎﹶ
ᵎ゙
ᵔʻ
ᵔʼ
ᵔʽ
ᵔʾ
ᵔʿ
ᵔˆ
ᵔˈ
ᵔˉ
ᵔˊ
ᵔˋ
ᵔˎ
ᵔˏ
ᵔˑ
ᵔי
ᵔـ
ᵔٴ
ᵔᐧ
ᵔᴵ
ᵔᵎ
ᵔᵢ
ᵔⁱ
ᵔﹳ
ᵔﹶ
ᵔ゙
ᵢʻ
ᵢʼ
ᵢʽ
ᵢʾ
ᵢʿ
ᵢˆ
ᵢˈ
ᵢˉ
ᵢˊ
ᵢˋ
ᵢˎ
ᵢˏ
ᵢˑ
ᵢי
ᵢـ
ᵢٴ
ᵢᐧ
ᵢᴵ
ᵢᵎ
ᵢᵔ
ᵢⁱ
ᵢﹳ
ᵢﹶ
ᵢ゙
ⁱʻ
ⁱʼ
ⁱʽ
ⁱʾ
ⁱʿ
ⁱˆ
ⁱˈ
ⁱˉ
ⁱˊ
ⁱˋ
ⁱˎ
ⁱˏ
ⁱˑ
ⁱי
ⁱـ
ⁱٴ
ⁱᐧ
ⁱᴵ
ⁱᵎ
ⁱᵔ
ⁱᵢ
ⁱﹳ
ⁱﹶ
ⁱ゙
ﹳʻ
ﹳʼ
ﹳʽ
ﹳʾ
ﹳʿ
ﹳˆ
ﹳˈ
ﹳˉ
ﹳˊ
ﹳˋ
ﹳˎ
ﹳˏ
ﹳˑ
ﹳי
ﹳـ
ﹳٴ
ﹳᐧ
ﹳᴵ
ﹳᵎ
ﹳᵔ
ﹳᵢ
ﹳⁱ
ﹳﹶ
ﹳ゙
ﹶʻ
ﹶʼ
ﹶʽ
ﹶʾ
ﹶʿ
ﹶˆ
ﹶˈ
ﹶˉ
ﹶˊ
ﹶˋ
ﹶˎ
ﹶˏ
ﹶˑ
ﹶי
ﹶـ
ﹶٴ
ﹶᐧ
ﹶᴵ
ﹶᵎ
ﹶᵔ
ﹶᵢ
ﹶⁱ
ﹶﹳ
ﹶ゙
゙ʻ
゙ʼ
゙ʽ
゙ʾ
゙ʿ
゙ˆ
゙ˈ
゙ˉ
゙ˊ
゙ˋ
゙ˎ
゙ˏ
゙ˑ
゙י
゙ـ
゙ٴ
゙ᐧ
゙ᴵ
゙ᵎ
゙ᵔ
゙ᵢ
゙ⁱ
゙ﹳ
゙ﹶ

115
pom.xml Normal file
View File

@ -0,0 +1,115 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId>
<artifactId>MiaoLobby</artifactId>
<version>1.0</version>
<build>
<finalName>${project.name}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>true</minimizeJar>
<artifactSet>
<includes>
<include>pw.yumc:YumCore</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>pw.yumc.YumCore</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.wvengen</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>proguard</goal>
</goals>
<configuration>
<options>
<option>-keep class ${project.groupId}.${project.artifactId}.${project.artifactId}</option>
</options>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
</libs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<ciManagement>
<system>Jenkins</system>
<url>http://ci.yumc.pw/job/${project.artifactId}/</url>
</ciManagement>
<properties>
<update.description></update.description>
<update.changes></update.changes>
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>yumc-repo</id>
<url>http://repo.yumc.pw/content/groups/public/</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>jtb</id>
<name>YUMC</name>
<url>http://repo.yumc.pw/content/repositories/yumcenter/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<type>jar</type>
<version>1.10.2-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>pw.yumc</groupId>
<artifactId>YumCore</artifactId>
<type>jar</type>
<version>1.0</version>
</dependency>
</dependencies>
</project>

57
proguard.conf Normal file
View File

@ -0,0 +1,57 @@
# -----不优化-----
-dontoptimize
# -----忽略所有警告-----
-dontwarn
-dontnote
# -----混淆时应用侵入式重载-----
-overloadaggressively
# -----启用混淆字典-----
-obfuscationdictionary obf.dict
-classobfuscationdictionary obf.dict
-packageobfuscationdictionary obf.dict
# -----保留所有属性
-keepattributes **
# -----替换包名
-repackageclasses \ʼ.ʽ.ʾ
# -----公共数据不混淆-----
-keep class cn.citycraft.CommonData.** {*;}
# -----保护所有实体中的字段名称-----
-keepclassmembers class * implements java.io.Serializable { <fields>; }
# -----保护监听方法不被清理-----
-keepclassmembers class * implements org.bukkit.event.Listener {
@org.bukkit.event.EventHandler <methods>;
}
-keepclassmembers class * implements net.md_5.bungee.api.plugin.Listener {
@net.md_5.bungee.event.EventHandler <methods>;
}
# -----保护枚举方法的完整性-----
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# -----保护配置注入不被清理-----
-keepclassmembers class * extends **.config.Inject** {
<fields>;
}
# -----保护注解命令方法不被清理-----
-keepclassmembers class **.commands.annotation.** { <methods>; }
-keepclassmembers class * implements **.commands.CommandExecutor { <methods>; }
# -----保护注解NotProguard标记-----
-keep class **.NotProguard
-keep @**.NotProguard class * {*;}
-keepclassmembers class * {
@**.NotProguard <fields>;
@**.NotProguard <methods>;
}

View File

@ -0,0 +1,19 @@
package pw.yumc.MiaoLobby;
import java.util.List;
import pw.yumc.YumCore.config.InjectConfig;
/**
* 配置文件
*
* @since 2016年9月22日 下午3:09:06
* @author
*/
public class Config extends InjectConfig {
public List<String> Servers;
public Integer WaitTime;
public String Message;
public String TimeOut;
public String Unavailable;
}

View File

@ -0,0 +1,86 @@
package pw.yumc.MiaoLobby;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.bukkit.compatible.C;
import pw.yumc.YumCore.commands.CommandArgument;
import pw.yumc.YumCore.commands.CommandExecutor;
import pw.yumc.YumCore.commands.CommandManager;
import pw.yumc.YumCore.commands.annotation.Cmd;
import pw.yumc.YumCore.commands.annotation.Help;
public class MiaoLobby extends JavaPlugin implements CommandExecutor {
private final SecureRandom random = new SecureRandom();
private Config config;
public void connect(final Player p, final String server) {
final ByteArrayDataOutput out = ByteStreams.newDataOutput();
try {
out.writeUTF("Connect");
out.writeUTF(server);
} catch (final Exception localException) {
}
p.sendPluginMessage(this, "BungeeCord", out.toByteArray());
}
@Cmd(permission = "MiaoLobby.default")
@Help("进行随机服务器传送")
public boolean def(final CommandArgument e) {
final Player player = (Player) e.getSender();
new BukkitRunnable() {
List<String> servers = new ArrayList<>(config.Servers);
int i = 0;
@Override
public void run() {
if (servers.isEmpty()) {
C.ActionBar.send(player, config.Unavailable);
player.sendMessage(config.Unavailable);
} else if (player.isOnline()) {
final String sname = servers.remove(random.nextInt(servers.size()));
C.ActionBar.send(player, String.format(i > 0 ? config.TimeOut : config.Message, sname));
connect(player, sname);
i++;
return;
}
cancel();
}
}.runTaskTimerAsynchronously(this, 0, config.WaitTime);
return true;
}
@Override
public FileConfiguration getConfig() {
return config.getConfig();
}
@Override
public void onEnable() {
new CommandManager("MiaoLobby", this);
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
}
@Override
public void onLoad() {
config = new Config();
}
@Cmd(permission = "MiaoLobby.reload")
@Help("重载配置文件")
public void reload(final CommandArgument e) {
config.reload();
Log.toSender(e.getSender(), "§a配置文件已重载!");
}
}

View File

@ -0,0 +1,13 @@
#配置文件版本 请勿修改
Version: 1.0
#数据库信息
Servers:
- lobby1
- lobby2
#传送超时时间(单位: Tick)
WaitTime: 20
#传送提示
Message: '&a请稍候 正在传送至服务器 %s ...'
TimeOut: '&c传送超时 正在切换到服务器 %s ...'
Unavailable: '&4已尝试所有可用服务器 传送失败!'

View File

@ -0,0 +1,24 @@
name: ${project.artifactId}
description: ${project.description}
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
version: ${project.version}-git-${env.GIT_COMMIT}
author: 喵♂呜
website: ${ciManagement.url}
commands:
${project.artifactId}:
description: ${project.artifactId} - ${project.description}
aliases:
- ml
usage: §b使用/${project.artifactId} help 查看帮助!
permission: ${project.artifactId}.reload
permission-message: §c你没有 <permission> 的权限来执行此命令!
permissions:
${project.artifactId}.default:
description: ${project.artifactId} 默认权限!
default: true
${project.artifactId}.admin:
description: ${project.artifactId} 管理员权限!
default: op
${project.artifactId}.reload:
description: 重新载入插件!
default: op