fix: 修复未登录状态传送的问题

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
2017-01-08 21:37:05 +08:00
parent 5264245c62
commit 9dfd2a8c00
4 changed files with 14 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId> <groupId>pw.yumc</groupId>
<artifactId>MiaoLobby</artifactId> <artifactId>MiaoLobby</artifactId>
<version>1.6</version> <version>1.7</version>
<build> <build>
<finalName>${project.name}</finalName> <finalName>${project.name}</finalName>
<resources> <resources>
@@ -60,6 +60,7 @@
</goals> </goals>
<configuration> <configuration>
<options> <options>
<option>-repackageclasses \ʼ.ʽ.ʾ.${project.artifactId}</option>
<option>-keep class ${project.groupId}.${project.artifactId}.${project.artifactId}</option> <option>-keep class ${project.groupId}.${project.artifactId}.${project.artifactId}</option>
</options> </options>
<libs> <libs>

View File

@@ -26,6 +26,7 @@ public class Util {
private static Map<String, BukkitTask> tasks; private static Map<String, BukkitTask> tasks;
public static void delayTp(final Player player) { public static void delayTp(final Player player) {
if (player == null) { return; }
tasks.put(player.getName(), new BukkitRunnable() { tasks.put(player.getName(), new BukkitRunnable() {
int delay = config.AutoTPDelay; int delay = config.AutoTPDelay;
@@ -45,11 +46,13 @@ public class Util {
} }
public static void cancel(Player player) { public static void cancel(Player player) {
if (player != null) {
BukkitTask task = tasks.get(player.getName()); BukkitTask task = tasks.get(player.getName());
if (task != null) { if (task != null) {
task.cancel(); task.cancel();
} }
} }
}
public static void connect(final Player p, final String server) { public static void connect(final Player p, final String server) {
final ByteArrayDataOutput out = ByteStreams.newDataOutput(); final ByteArrayDataOutput out = ByteStreams.newDataOutput();

View File

@@ -8,6 +8,8 @@ import pw.yumc.MiaoLobby.Util;
public class AuthMeHook extends Hook { public class AuthMeHook extends Hook {
@EventHandler @EventHandler
public void onLogin(final LoginEvent e) { public void onLogin(final LoginEvent e) {
if (e.isLogin()) {
Util.delayTp(e.getPlayer()); Util.delayTp(e.getPlayer());
} }
} }
}

View File

@@ -9,8 +9,10 @@ import pw.yumc.MiaoLobby.Util;
public class VBossAuthHook extends Hook { public class VBossAuthHook extends Hook {
@EventHandler @EventHandler
public void onLogin(LoginEvent e) { public void onLogin(LoginEvent e) {
if (e.isLogin()) {
Util.delayTp(e.getPlayer()); Util.delayTp(e.getPlayer());
} }
}
@EventHandler @EventHandler
public void onRegister(RegisterEvent e) { public void onRegister(RegisterEvent e) {