mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2025-04-20 17:47:06 +00:00
Guard against unexpected exceptions from AsyncEvent usage
This commit is contained in:
parent
5d3cb98521
commit
4707fb79be
@ -2,7 +2,6 @@ package com.imaginarycode.minecraft.redisbungee;
|
|||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Multiset;
|
import com.google.common.collect.Multiset;
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
@ -13,8 +12,6 @@ import com.imaginarycode.minecraft.redisbungee.util.RedisCallable;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.md_5.bungee.api.AbstractReconnectHandler;
|
import net.md_5.bungee.api.AbstractReconnectHandler;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.ServerPing;
|
|
||||||
import net.md_5.bungee.api.chat.BaseComponent;
|
import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
@ -52,8 +49,8 @@ public class RedisBungeeListener implements Listener {
|
|||||||
plugin.getProxy().getScheduler().runAsync(plugin, new RedisCallable<Void>(plugin) {
|
plugin.getProxy().getScheduler().runAsync(plugin, new RedisCallable<Void>(plugin) {
|
||||||
@Override
|
@Override
|
||||||
protected Void call(Jedis jedis) {
|
protected Void call(Jedis jedis) {
|
||||||
|
try {
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
event.completeIntent(plugin);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +63,6 @@ public class RedisBungeeListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
// TODO: Make it accept a BaseComponent[] like everything else.
|
// TODO: Make it accept a BaseComponent[] like everything else.
|
||||||
event.setCancelReason(TextComponent.toLegacyText(ONLINE_MODE_RECONNECT));
|
event.setCancelReason(TextComponent.toLegacyText(ONLINE_MODE_RECONNECT));
|
||||||
event.completeIntent(plugin);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +72,6 @@ public class RedisBungeeListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
// TODO: Make it accept a BaseComponent[] like everything else.
|
// TODO: Make it accept a BaseComponent[] like everything else.
|
||||||
event.setCancelReason(TextComponent.toLegacyText(ALREADY_LOGGED_IN));
|
event.setCancelReason(TextComponent.toLegacyText(ALREADY_LOGGED_IN));
|
||||||
event.completeIntent(plugin);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,8 +82,10 @@ public class RedisBungeeListener implements Listener {
|
|||||||
// We're not publishing, the API says we only publish at PostLoginEvent time.
|
// We're not publishing, the API says we only publish at PostLoginEvent time.
|
||||||
pipeline.sync();
|
pipeline.sync();
|
||||||
|
|
||||||
event.completeIntent(plugin);
|
|
||||||
return null;
|
return null;
|
||||||
|
} finally {
|
||||||
|
event.completeIntent(plugin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user