Proper equals on servers
This commit is contained in:
@@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import io.netty.channel.Channel;
|
||||
import java.util.Objects;
|
||||
import java.util.Queue;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
@@ -165,7 +166,7 @@ public class ServerConnector extends PacketHandler
|
||||
public void handle(PacketFFKick kick) throws Exception
|
||||
{
|
||||
ServerInfo def = bungee.getServerInfo( user.getPendingConnection().getListener().getFallbackServer() );
|
||||
if ( target == def )
|
||||
if ( Objects.equals( target, def) )
|
||||
{
|
||||
def = null;
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
@@ -100,13 +101,7 @@ public final class UserConnection implements ProxiedPlayer
|
||||
@Override
|
||||
public void connect(ServerInfo target)
|
||||
{
|
||||
if ( getServer() != null && getServer().getInfo() == target )
|
||||
{
|
||||
sendMessage( ChatColor.RED + "Cannot connect to server you are already on!" );
|
||||
} else
|
||||
{
|
||||
connect( target, false );
|
||||
}
|
||||
connect( target, false );
|
||||
}
|
||||
|
||||
public void connectNow(ServerInfo target)
|
||||
@@ -121,10 +116,9 @@ public final class UserConnection implements ProxiedPlayer
|
||||
ServerConnectEvent event = new ServerConnectEvent( this, info );
|
||||
ProxyServer.getInstance().getPluginManager().callEvent( event );
|
||||
final ServerInfo target = event.getTarget(); // Update in case the event changed target
|
||||
if ( getServer() != null && getServer().getInfo() == target )
|
||||
if ( getServer() != null && Objects.equals( getServer().getInfo(), target ) )
|
||||
{
|
||||
sendMessage( ChatColor.RED + "Cannot connect to server you are already on!" );
|
||||
return;
|
||||
}
|
||||
new Bootstrap()
|
||||
.channel( NioSocketChannel.class )
|
||||
|
@@ -4,6 +4,7 @@ import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import io.netty.channel.Channel;
|
||||
import java.util.Objects;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.md_5.bungee.EntityMap;
|
||||
import net.md_5.bungee.ServerConnection;
|
||||
@@ -314,7 +315,7 @@ public class DownstreamBridge extends PacketHandler
|
||||
public void handle(PacketFFKick kick) throws Exception
|
||||
{
|
||||
ServerInfo def = bungee.getServerInfo( con.getPendingConnection().getListener().getFallbackServer() );
|
||||
if ( server.getInfo() == def )
|
||||
if ( Objects.equals( server.getInfo(), def ) )
|
||||
{
|
||||
def = null;
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ public class BungeeScheduler implements TaskScheduler
|
||||
Set<ScheduledTask> toRemove = new HashSet<>();
|
||||
for ( ScheduledTask task : tasks.valueCollection() )
|
||||
{
|
||||
// TODO: proper checking?
|
||||
if ( task.getOwner() == plugin )
|
||||
{
|
||||
toRemove.add( task );
|
||||
|
Reference in New Issue
Block a user