mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 18:26:06 +01:00
Use .setCancelServers() for fallbacks
This method (as far as I know) is exclusive to GalaxiBungee. The old method is still available as a fallback.
This commit is contained in:
parent
b808a62fcb
commit
8514ea5c26
@ -34,7 +34,7 @@ public class SmartReconnectHandler implements ReconnectHandler {
|
||||
if (fallbacks.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
if (player instanceof UserConnection) ((UserConnection) player).setServerJoinQueue(new LinkedBlockingQueue<>(fallbacks.keySet()));
|
||||
if (player instanceof UserConnection) ((UserConnection) player).setServerJoinQueue(new LinkedList<>(fallbacks.keySet()));
|
||||
return new LinkedList<Map.Entry<String, ServerInfo>>(fallbacks.entrySet()).getFirst().getValue();
|
||||
}
|
||||
}
|
||||
|
@ -856,11 +856,13 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
|
||||
ServerInfo next = new LinkedList<Map.Entry<String, ServerInfo>>(fallbacks.entrySet()).getFirst().getValue();
|
||||
e.setCancelServer(next);
|
||||
if (Util.isException(() -> Util.reflect(ServerKickEvent.class.getDeclaredMethod("setCancelServers", ServerInfo[].class), e, (Object) fallbacks.values().toArray(new ServerInfo[0])))) {
|
||||
((UserConnection) e.getPlayer()).setServerJoinQueue(new LinkedBlockingQueue<>(fallbacks.keySet()));
|
||||
((UserConnection) e.getPlayer()).connect(next, null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = Byte.MAX_VALUE)
|
||||
public void fallbackFound(ServerConnectedEvent e) {
|
||||
|
@ -34,7 +34,7 @@ public class SmartReconnectHandler implements ReconnectHandler {
|
||||
if (fallbacks.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
if (player instanceof UserConnection) ((UserConnection) player).setServerJoinQueue(new LinkedBlockingQueue<>(fallbacks.keySet()));
|
||||
if (player instanceof UserConnection) ((UserConnection) player).setServerJoinQueue(new LinkedList<>(fallbacks.keySet()));
|
||||
return new LinkedList<Map.Entry<String, ServerInfo>>(fallbacks.entrySet()).getFirst().getValue();
|
||||
}
|
||||
}
|
||||
|
@ -354,11 +354,13 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
|
||||
ServerInfo next = new LinkedList<Map.Entry<String, ServerInfo>>(fallbacks.entrySet()).getFirst().getValue();
|
||||
e.setCancelServer(next);
|
||||
((UserConnection) e.getPlayer()).setServerJoinQueue(new LinkedBlockingQueue<>(fallbacks.keySet()));
|
||||
if (Util.isException(() -> Util.reflect(ServerKickEvent.class.getDeclaredMethod("setCancelServers", ServerInfo[].class), e, (Object) fallbacks.values().toArray(new ServerInfo[0])))) {
|
||||
((UserConnection) e.getPlayer()).setServerJoinQueue(new LinkedList<>(fallbacks.keySet()));
|
||||
((UserConnection) e.getPlayer()).connect(next, null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = Byte.MAX_VALUE)
|
||||
public void fallbackFound(ServerConnectedEvent e) {
|
||||
|
Loading…
Reference in New Issue
Block a user