mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2025-04-20 01:27:07 +00:00
Fix compatibility with antibot plugins
This prevents RedisBungee from handling connections that are cancelled by antibots (The priority change is also to prevent the cancellation ignore of antibots)
This commit is contained in:
parent
a006c343a7
commit
4506ea75d6
@ -42,8 +42,12 @@ public class RedisBungeeListener implements Listener {
|
|||||||
private final RedisBungee plugin;
|
private final RedisBungee plugin;
|
||||||
private final List<InetAddress> exemptAddresses;
|
private final List<InetAddress> exemptAddresses;
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler
|
||||||
public void onLogin(final LoginEvent event) {
|
public void onLogin(final LoginEvent event) {
|
||||||
|
if (event.isCancelled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.registerIntent(plugin);
|
event.registerIntent(plugin);
|
||||||
plugin.getProxy().getScheduler().runAsync(plugin, new RedisCallable<Void>(plugin) {
|
plugin.getProxy().getScheduler().runAsync(plugin, new RedisCallable<Void>(plugin) {
|
||||||
@Override
|
@Override
|
||||||
@ -132,7 +136,7 @@ public class RedisBungeeListener implements Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler
|
||||||
public void onPing(final ProxyPingEvent event) {
|
public void onPing(final ProxyPingEvent event) {
|
||||||
if (exemptAddresses.contains(event.getConnection().getAddress().getAddress())) {
|
if (exemptAddresses.contains(event.getConnection().getAddress().getAddress())) {
|
||||||
return;
|
return;
|
||||||
@ -150,6 +154,10 @@ public class RedisBungeeListener implements Listener {
|
|||||||
@SuppressWarnings("UnstableApiUsage")
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPluginMessage(final PluginMessageEvent event) {
|
public void onPluginMessage(final PluginMessageEvent event) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((event.getTag().equals("legacy:redisbungee") || event.getTag().equals("RedisBungee")) && event.getSender() instanceof Server) {
|
if ((event.getTag().equals("legacy:redisbungee") || event.getTag().equals("RedisBungee")) && event.getSender() instanceof Server) {
|
||||||
final String currentChannel = event.getTag();
|
final String currentChannel = event.getTag();
|
||||||
final byte[] data = Arrays.copyOf(event.getData(), event.getData().length);
|
final byte[] data = Arrays.copyOf(event.getData(), event.getData().length);
|
||||||
|
Loading…
Reference in New Issue
Block a user