commit 270291ff916aa9892aed83feeb375210671319b1 Author: 502647092 Date: Thu Sep 22 16:35:40 2016 +0800 init: 项目初始化 Signed-off-by: 502647092 diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..db5b5e4 --- /dev/null +++ b/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a1e2a38 --- /dev/null +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 0000000..ea2423c --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + MiaoLobby + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.jdt.core.javanature + + diff --git a/obf.dict b/obf.dict new file mode 100644 index 0000000..cfd1dec --- /dev/null +++ b/obf.dict @@ -0,0 +1,650 @@ +ʻ +ʼ +ʽ +ʾ +ʿ +ˆ +ˈ +ˉ +ˊ +ˋ +ˎ +ˏ +ˑ +י +ـ +ٴ +ᐧ +ᴵ +ᵎ +ᵔ +ᵢ +ⁱ +ﹳ +ﹶ +゙ +゙゙ +ᐧᐧ +ᴵᴵ +ʻʻ +ʽʽ +ʼʼ +ʿʿ +ʾʾ +ــ +ˆˆ +ˉˉ +ˈˈ +ˋˋ +ˊˊ +ˏˏ +ˎˎ +ˑˑ +ᵔᵔ +יי +ᵎᵎ +ᵢᵢ +ⁱⁱ +ﹳﹳ +ٴٴ +ﹶﹶ +ʻʼ +ʻʽ +ʻʾ +ʻʿ +ʻˆ +ʻˈ +ʻˉ +ʻˊ +ʻˋ +ʻˎ +ʻˏ +ʻˑ +ʻי +ʻـ +ʻٴ +ʻᐧ +ʻᴵ +ʻᵎ +ʻᵔ +ʻᵢ +ʻⁱ +ʻﹳ +ʻﹶ +ʻ゙ +ʼʻ +ʼʽ +ʼʾ +ʼʿ +ʼˆ +ʼˈ +ʼˉ +ʼˊ +ʼˋ +ʼˎ +ʼˏ +ʼˑ +ʼי +ʼـ +ʼٴ +ʼᐧ +ʼᴵ +ʼᵎ +ʼᵔ +ʼᵢ +ʼⁱ +ʼﹳ +ʼﹶ +ʼ゙ +ʽʻ +ʽʼ +ʽʾ +ʽʿ +ʽˆ +ʽˈ +ʽˉ +ʽˊ +ʽˋ +ʽˎ +ʽˏ +ʽˑ +ʽי +ʽـ +ʽٴ +ʽᐧ +ʽᴵ +ʽᵎ +ʽᵔ +ʽᵢ +ʽⁱ +ʽﹳ +ʽﹶ +ʽ゙ +ʾʻ +ʾʼ +ʾʽ +ʾʿ +ʾˆ +ʾˈ +ʾˉ +ʾˊ +ʾˋ +ʾˎ +ʾˏ +ʾˑ +ʾי +ʾـ +ʾٴ +ʾᐧ +ʾᴵ +ʾᵎ +ʾᵔ +ʾᵢ +ʾⁱ +ʾﹳ +ʾﹶ +ʾ゙ +ʿʻ +ʿʼ +ʿʽ +ʿʾ +ʿˆ +ʿˈ +ʿˉ +ʿˊ +ʿˋ +ʿˎ +ʿˏ +ʿˑ +ʿי +ʿـ +ʿٴ +ʿᐧ +ʿᴵ +ʿᵎ +ʿᵔ +ʿᵢ +ʿⁱ +ʿﹳ +ʿﹶ +ʿ゙ +ˆʻ +ˆʼ +ˆʽ +ˆʾ +ˆʿ +ˆˈ +ˆˉ +ˆˊ +ˆˋ +ˆˎ +ˆˏ +ˆˑ +ˆי +ˆـ +ˆٴ +ˆᐧ +ˆᴵ +ˆᵎ +ˆᵔ +ˆᵢ +ˆⁱ +ˆﹳ +ˆﹶ +ˆ゙ +ˈʻ +ˈʼ +ˈʽ +ˈʾ +ˈʿ +ˈˆ +ˈˉ +ˈˊ +ˈˋ +ˈˎ +ˈˏ +ˈˑ +ˈי +ˈـ +ˈٴ +ˈᐧ +ˈᴵ +ˈᵎ +ˈᵔ +ˈᵢ +ˈⁱ +ˈﹳ +ˈﹶ +ˈ゙ +ˉʻ +ˉʼ +ˉʽ +ˉʾ +ˉʿ +ˉˆ +ˉˈ +ˉˊ +ˉˋ +ˉˎ +ˉˏ +ˉˑ +ˉי +ˉـ +ˉٴ +ˉᐧ +ˉᴵ +ˉᵎ +ˉᵔ +ˉᵢ +ˉⁱ +ˉﹳ +ˉﹶ +ˉ゙ +ˊʻ +ˊʼ +ˊʽ +ˊʾ +ˊʿ +ˊˆ +ˊˈ +ˊˉ +ˊˋ +ˊˎ +ˊˏ +ˊˑ +ˊי +ˊـ +ˊٴ +ˊᐧ +ˊᴵ +ˊᵎ +ˊᵔ +ˊᵢ +ˊⁱ +ˊﹳ +ˊﹶ +ˊ゙ +ˋʻ +ˋʼ +ˋʽ +ˋʾ +ˋʿ +ˋˆ +ˋˈ +ˋˉ +ˋˊ +ˋˎ +ˋˏ +ˋˑ +ˋי +ˋـ +ˋٴ +ˋᐧ +ˋᴵ +ˋᵎ +ˋᵔ +ˋᵢ +ˋⁱ +ˋﹳ +ˋﹶ +ˋ゙ +ˎʻ +ˎʼ +ˎʽ +ˎʾ +ˎʿ +ˎˆ +ˎˈ +ˎˉ +ˎˊ +ˎˋ +ˎˏ +ˎˑ +ˎי +ˎـ +ˎٴ +ˎᐧ +ˎᴵ +ˎᵎ +ˎᵔ +ˎᵢ +ˎⁱ +ˎﹳ +ˎﹶ +ˎ゙ +ˏʻ +ˏʼ +ˏʽ +ˏʾ +ˏʿ +ˏˆ +ˏˈ +ˏˉ +ˏˊ +ˏˋ +ˏˎ +ˏˑ +ˏי +ˏـ +ˏٴ +ˏᐧ +ˏᴵ +ˏᵎ +ˏᵔ +ˏᵢ +ˏⁱ +ˏﹳ +ˏﹶ +ˏ゙ +ˑʻ +ˑʼ +ˑʽ +ˑʾ +ˑʿ +ˑˆ +ˑˈ +ˑˉ +ˑˊ +ˑˋ +ˑˎ +ˑˏ +ˑי +ˑـ +ˑٴ +ˑᐧ +ˑᴵ +ˑᵎ +ˑᵔ +ˑᵢ +ˑⁱ +ˑﹳ +ˑﹶ +ˑ゙ +יʻ +יʼ +יʽ +יʾ +יʿ +יˆ +יˈ +יˉ +יˊ +יˋ +יˎ +יˏ +יˑ +יـ +יٴ +יᐧ +יᴵ +יᵎ +יᵔ +יᵢ +יⁱ +יﹳ +יﹶ +י゙ +ـʻ +ـʼ +ـʽ +ـʾ +ـʿ +ـˆ +ـˈ +ـˉ +ـˊ +ـˋ +ـˎ +ـˏ +ـˑ +ـי +ـٴ +ـᐧ +ـᴵ +ـᵎ +ـᵔ +ـᵢ +ـⁱ +ـﹳ +ـﹶ +ـ゙ +ٴʻ +ٴʼ +ٴʽ +ٴʾ +ٴʿ +ٴˆ +ٴˈ +ٴˉ +ٴˊ +ٴˋ +ٴˎ +ٴˏ +ٴˑ +ٴי +ٴـ +ٴᐧ +ٴᴵ +ٴᵎ +ٴᵔ +ٴᵢ +ٴⁱ +ٴﹳ +ٴﹶ +ٴ゙ +ᐧʻ +ᐧʼ +ᐧʽ +ᐧʾ +ᐧʿ +ᐧˆ +ᐧˈ +ᐧˉ +ᐧˊ +ᐧˋ +ᐧˎ +ᐧˏ +ᐧˑ +ᐧי +ᐧـ +ᐧٴ +ᐧᴵ +ᐧᵎ +ᐧᵔ +ᐧᵢ +ᐧⁱ +ᐧﹳ +ᐧﹶ +ᐧ゙ +ᴵʻ +ᴵʼ +ᴵʽ +ᴵʾ +ᴵʿ +ᴵˆ +ᴵˈ +ᴵˉ +ᴵˊ +ᴵˋ +ᴵˎ +ᴵˏ +ᴵˑ +ᴵי +ᴵـ +ᴵٴ +ᴵᐧ +ᴵᵎ +ᴵᵔ +ᴵᵢ +ᴵⁱ +ᴵﹳ +ᴵﹶ +ᴵ゙ +ᵎʻ +ᵎʼ +ᵎʽ +ᵎʾ +ᵎʿ +ᵎˆ +ᵎˈ +ᵎˉ +ᵎˊ +ᵎˋ +ᵎˎ +ᵎˏ +ᵎˑ +ᵎי +ᵎـ +ᵎٴ +ᵎᐧ +ᵎᴵ +ᵎᵔ +ᵎᵢ +ᵎⁱ +ᵎﹳ +ᵎﹶ +ᵎ゙ +ᵔʻ +ᵔʼ +ᵔʽ +ᵔʾ +ᵔʿ +ᵔˆ +ᵔˈ +ᵔˉ +ᵔˊ +ᵔˋ +ᵔˎ +ᵔˏ +ᵔˑ +ᵔי +ᵔـ +ᵔٴ +ᵔᐧ +ᵔᴵ +ᵔᵎ +ᵔᵢ +ᵔⁱ +ᵔﹳ +ᵔﹶ +ᵔ゙ +ᵢʻ +ᵢʼ +ᵢʽ +ᵢʾ +ᵢʿ +ᵢˆ +ᵢˈ +ᵢˉ +ᵢˊ +ᵢˋ +ᵢˎ +ᵢˏ +ᵢˑ +ᵢי +ᵢـ +ᵢٴ +ᵢᐧ +ᵢᴵ +ᵢᵎ +ᵢᵔ +ᵢⁱ +ᵢﹳ +ᵢﹶ +ᵢ゙ +ⁱʻ +ⁱʼ +ⁱʽ +ⁱʾ +ⁱʿ +ⁱˆ +ⁱˈ +ⁱˉ +ⁱˊ +ⁱˋ +ⁱˎ +ⁱˏ +ⁱˑ +ⁱי +ⁱـ +ⁱٴ +ⁱᐧ +ⁱᴵ +ⁱᵎ +ⁱᵔ +ⁱᵢ +ⁱﹳ +ⁱﹶ +ⁱ゙ +ﹳʻ +ﹳʼ +ﹳʽ +ﹳʾ +ﹳʿ +ﹳˆ +ﹳˈ +ﹳˉ +ﹳˊ +ﹳˋ +ﹳˎ +ﹳˏ +ﹳˑ +ﹳי +ﹳـ +ﹳٴ +ﹳᐧ +ﹳᴵ +ﹳᵎ +ﹳᵔ +ﹳᵢ +ﹳⁱ +ﹳﹶ +ﹳ゙ +ﹶʻ +ﹶʼ +ﹶʽ +ﹶʾ +ﹶʿ +ﹶˆ +ﹶˈ +ﹶˉ +ﹶˊ +ﹶˋ +ﹶˎ +ﹶˏ +ﹶˑ +ﹶי +ﹶـ +ﹶٴ +ﹶᐧ +ﹶᴵ +ﹶᵎ +ﹶᵔ +ﹶᵢ +ﹶⁱ +ﹶﹳ +ﹶ゙ +゙ʻ +゙ʼ +゙ʽ +゙ʾ +゙ʿ +゙ˆ +゙ˈ +゙ˉ +゙ˊ +゙ˋ +゙ˎ +゙ˏ +゙ˑ +゙י +゙ـ +゙ٴ +゙ᐧ +゙ᴵ +゙ᵎ +゙ᵔ +゙ᵢ +゙ⁱ +゙ﹳ +゙ﹶ \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..8460e24 --- /dev/null +++ b/pom.xml @@ -0,0 +1,115 @@ + + 4.0.0 + pw.yumc + MiaoLobby + 1.0 + + ${project.name} + + + src/main/resources + true + + + + + maven-compiler-plugin + 3.3 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-shade-plugin + 2.3 + + false + true + + + pw.yumc:YumCore + + + + + pw.yumc.YumCore + ${project.groupId}.${project.artifactId} + + + + + + package + + shade + + + + + + com.github.wvengen + proguard-maven-plugin + + + package + + proguard + + + + + + + ${java.home}/lib/rt.jar + + + + + + + + + Jenkins + http://ci.yumc.pw/job/${project.artifactId}/ + + + + + DEBUG + UTF-8 + + + + spigot-repo + https://hub.spigotmc.org/nexus/content/groups/public/ + + + yumc-repo + http://repo.yumc.pw/content/groups/public/ + + + + + jtb + YUMC + http://repo.yumc.pw/content/repositories/yumcenter/ + + + + + org.spigotmc + spigot-api + jar + 1.10.2-R0.1-SNAPSHOT + + + pw.yumc + YumCore + jar + 1.0 + + + \ No newline at end of file diff --git a/proguard.conf b/proguard.conf new file mode 100644 index 0000000..c2a3163 --- /dev/null +++ b/proguard.conf @@ -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 { ; } + +# -----保护监听方法不被清理----- +-keepclassmembers class * implements org.bukkit.event.Listener { + @org.bukkit.event.EventHandler ; +} +-keepclassmembers class * implements net.md_5.bungee.api.plugin.Listener { + @net.md_5.bungee.event.EventHandler ; +} + +# -----保护枚举方法的完整性----- +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +# -----保护配置注入不被清理----- +-keepclassmembers class * extends **.config.Inject** { + ; +} + +# -----保护注解命令方法不被清理----- +-keepclassmembers class **.commands.annotation.** { ; } +-keepclassmembers class * implements **.commands.CommandExecutor { ; } + +# -----保护注解NotProguard标记----- +-keep class **.NotProguard +-keep @**.NotProguard class * {*;} +-keepclassmembers class * { + @**.NotProguard ; + @**.NotProguard ; +} \ No newline at end of file diff --git a/src/main/java/pw/yumc/MiaoLobby/Config.java b/src/main/java/pw/yumc/MiaoLobby/Config.java new file mode 100644 index 0000000..39f2b68 --- /dev/null +++ b/src/main/java/pw/yumc/MiaoLobby/Config.java @@ -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 Servers; + public Integer WaitTime; + public String Message; + public String TimeOut; + public String Unavailable; +} diff --git a/src/main/java/pw/yumc/MiaoLobby/MiaoLobby.java b/src/main/java/pw/yumc/MiaoLobby/MiaoLobby.java new file mode 100644 index 0000000..8fd864e --- /dev/null +++ b/src/main/java/pw/yumc/MiaoLobby/MiaoLobby.java @@ -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 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配置文件已重载!"); + } +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml new file mode 100644 index 0000000..bf614d4 --- /dev/null +++ b/src/main/resources/config.yml @@ -0,0 +1,13 @@ +#配置文件版本 请勿修改 +Version: 1.0 + +#数据库信息 +Servers: +- lobby1 +- lobby2 +#传送超时时间(单位: Tick) +WaitTime: 20 +#传送提示 +Message: '&a请稍候 正在传送至服务器 %s ...' +TimeOut: '&c传送超时 正在切换到服务器 %s ...' +Unavailable: '&4已尝试所有可用服务器 传送失败!' \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml new file mode 100644 index 0000000..b48fa7e --- /dev/null +++ b/src/main/resources/plugin.yml @@ -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你没有 的权限来执行此命令! +permissions: + ${project.artifactId}.default: + description: ${project.artifactId} 默认权限! + default: true + ${project.artifactId}.admin: + description: ${project.artifactId} 管理员权限! + default: op + ${project.artifactId}.reload: + description: 重新载入插件! + default: op \ No newline at end of file