mirror of
https://e.coding.net/circlecloud/MiaoLobby.git
synced 2025-11-03 01:16:02 +00:00
5
pom.xml
5
pom.xml
@@ -117,5 +117,10 @@
|
|||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<version>6.1</version>
|
<version>6.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.citycraft</groupId>
|
||||||
|
<artifactId>VBossAuth</artifactId>
|
||||||
|
<version>1.5.2</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
39
src/main/java/pw/yumc/MiaoLobby/AuthHook.java
Normal file
39
src/main/java/pw/yumc/MiaoLobby/AuthHook.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package pw.yumc.MiaoLobby;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import pw.yumc.YumCore.bukkit.P;
|
||||||
|
import pw.yumc.YumCore.bukkit.compatible.C;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by 蒋天蓓 on 2016/12/24 0024.
|
||||||
|
*/
|
||||||
|
public class AuthHook implements Listener {
|
||||||
|
MiaoLobby plugin = P.getPlugin();
|
||||||
|
|
||||||
|
public AuthHook() {
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, P.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void delayTp(final Player player) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
int delay = plugin.config.AutoTPDelay;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (player.isOnline()) {
|
||||||
|
if (delay > 0) {
|
||||||
|
C.ActionBar.send(player, String.format(plugin.config.TPDelay, delay));
|
||||||
|
delay--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
plugin.random(player);
|
||||||
|
}
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
}.runTaskTimerAsynchronously(plugin, 0, 20);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,40 +1,12 @@
|
|||||||
package pw.yumc.MiaoLobby;
|
package pw.yumc.MiaoLobby;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import fr.xephi.authme.events.LoginEvent;
|
import fr.xephi.authme.events.LoginEvent;
|
||||||
import pw.yumc.YumCore.bukkit.P;
|
|
||||||
import pw.yumc.YumCore.bukkit.compatible.C;
|
|
||||||
|
|
||||||
public class AuthMeHook implements Listener {
|
|
||||||
MiaoLobby plugin = P.getPlugin();
|
|
||||||
|
|
||||||
public AuthMeHook() {
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, P.instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public class AuthMeHook extends AuthHook {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLogin(final LoginEvent e) {
|
public void onLogin(final LoginEvent e) {
|
||||||
new BukkitRunnable() {
|
delayTp(e.getPlayer());
|
||||||
Player player = e.getPlayer();
|
|
||||||
int delay = plugin.config.AutoTPDelay;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (player.isOnline()) {
|
|
||||||
if (delay > 0) {
|
|
||||||
C.ActionBar.send(player, String.format(plugin.config.TPDelay, delay));
|
|
||||||
delay--;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
plugin.random(player);
|
|
||||||
}
|
|
||||||
cancel();
|
|
||||||
}
|
|
||||||
}.runTaskTimerAsynchronously(plugin, 0, 20);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class Config extends InjectConfig {
|
|||||||
public String TimeOut;
|
public String TimeOut;
|
||||||
public String TPDelay;
|
public String TPDelay;
|
||||||
public String Unavailable;
|
public String Unavailable;
|
||||||
public Boolean AuthMeAutoTP;
|
public Boolean LoginAutoTP;
|
||||||
public Integer AutoTPDelay;
|
public Integer AutoTPDelay;
|
||||||
public Boolean ReTry;
|
public Boolean ReTry;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ import pw.yumc.YumCore.commands.CommandManager;
|
|||||||
import pw.yumc.YumCore.commands.annotation.Cmd;
|
import pw.yumc.YumCore.commands.annotation.Cmd;
|
||||||
import pw.yumc.YumCore.commands.annotation.Cmd.Executor;
|
import pw.yumc.YumCore.commands.annotation.Cmd.Executor;
|
||||||
import pw.yumc.YumCore.commands.annotation.Help;
|
import pw.yumc.YumCore.commands.annotation.Help;
|
||||||
import pw.yumc.YumCore.update.SubscribeTask;
|
|
||||||
import pw.yumc.YumCore.statistic.Statistics;
|
import pw.yumc.YumCore.statistic.Statistics;
|
||||||
|
import pw.yumc.YumCore.update.SubscribeTask;
|
||||||
|
|
||||||
public class MiaoLobby extends JavaPlugin implements CommandExecutor {
|
public class MiaoLobby extends JavaPlugin implements CommandExecutor {
|
||||||
public Config config;
|
public Config config;
|
||||||
@@ -54,9 +54,14 @@ public class MiaoLobby extends JavaPlugin implements CommandExecutor {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
new CommandManager("MiaoLobby", this);
|
new CommandManager("MiaoLobby", this);
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||||
if (config.AuthMeAutoTP && Bukkit.getPluginManager().isPluginEnabled("AuthMe")) {
|
if (config.LoginAutoTP) {
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("AuthMe")) {
|
||||||
new AuthMeHook();
|
new AuthMeHook();
|
||||||
}
|
}
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("VBossAuth")) {
|
||||||
|
new VBossAuthHook();
|
||||||
|
}
|
||||||
|
}
|
||||||
new Statistics();
|
new Statistics();
|
||||||
new SubscribeTask();
|
new SubscribeTask();
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/main/java/pw/yumc/MiaoLobby/VBossAuthHook.java
Normal file
12
src/main/java/pw/yumc/MiaoLobby/VBossAuthHook.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package pw.yumc.MiaoLobby;
|
||||||
|
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
|
import cn.citycraft.VBossAuth.event.LoginEvent;
|
||||||
|
|
||||||
|
public class VBossAuthHook extends AuthHook {
|
||||||
|
@EventHandler
|
||||||
|
public void onLogin(final LoginEvent e) {
|
||||||
|
delayTp(e.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#配置文件版本 请勿修改
|
#配置文件版本 请勿修改
|
||||||
Version: 1.2
|
Version: 1.3
|
||||||
|
|
||||||
#数据库信息
|
#数据库信息
|
||||||
Servers:
|
Servers:
|
||||||
@@ -7,8 +7,8 @@ Servers:
|
|||||||
- lobby2
|
- lobby2
|
||||||
#传送超时时间(单位: Tick)
|
#传送超时时间(单位: Tick)
|
||||||
WaitTime: 35
|
WaitTime: 35
|
||||||
#AuthMe自动传送
|
#登录自动传送(暂时支持AuthMe和VBossAuth)
|
||||||
AuthMeAutoTP: true
|
LoginAutoTP: true
|
||||||
#自动登录延时(单位: 秒)
|
#自动登录延时(单位: 秒)
|
||||||
AutoTPDelay: 10
|
AutoTPDelay: 10
|
||||||
#尝试完毕后是否继续重试
|
#尝试完毕后是否继续重试
|
||||||
|
|||||||
Reference in New Issue
Block a user