Fixes for new Eclipse warnings.

This commit is contained in:
MobiusDev
2017-09-27 01:59:41 +00:00
parent 3cb7b3f70e
commit bb9e1f2827
34 changed files with 68 additions and 56 deletions

View File

@ -421,7 +421,7 @@ public final class SkillTreesData implements IGameXmlReader
}
else if (type.equals("revelationSkillTree") && (subType != null))
{
final Map<Long, L2SkillLearn> revelationSkillTrees = _revelationSkillTree.get(race);
final Map<Long, L2SkillLearn> revelationSkillTrees = _revelationSkillTree.get(subType);
if (revelationSkillTrees == null)
{
_revelationSkillTree.put(subType, revelationSkillTree);

View File

@ -622,7 +622,7 @@ public class L2Attackable extends L2Npc
@Override
public void addAttackerToAttackByList(L2Character player)
{
if ((player == null) || (player == this) || getAttackByList().contains(player))
if ((player == null) || (player == this) || getAttackByList().stream().anyMatch(o -> o.get() == player))
{
return;
}
@ -860,7 +860,8 @@ public class L2Attackable extends L2Npc
result.add(mostHated);
if (getAttackByList().contains(secondMostHated))
final L2Character secondMostHatedFinal = secondMostHated;
if (getAttackByList().stream().anyMatch(o -> o.get() == secondMostHatedFinal))
{
result.add(secondMostHated);
}

View File

@ -615,7 +615,7 @@ public final class GameServerTable implements IGameXmlReader
{
for (GameServerAddress a : _addrs)
{
if (a.equals(addr))
if (a.getAddress().equals(addr.getAddress()))
{
return a.getServerAddress();
}

View File

@ -323,21 +323,21 @@ public class LoginController
_bannedIps.putIfAbsent(address, System.currentTimeMillis() + duration);
}
public boolean isBannedAddress(InetAddress address)
public boolean isBannedAddress(InetAddress address) throws UnknownHostException
{
final String[] parts = address.getHostAddress().split("\\.");
Long bi = _bannedIps.get(address);
if (bi == null)
{
bi = _bannedIps.get(parts[0] + "." + parts[1] + "." + parts[2] + ".0");
bi = _bannedIps.get(InetAddress.getByName(parts[0] + "." + parts[1] + "." + parts[2] + ".0"));
}
if (bi == null)
{
bi = _bannedIps.get(parts[0] + "." + parts[1] + ".0.0");
bi = _bannedIps.get(InetAddress.getByName(parts[0] + "." + parts[1] + ".0.0"));
}
if (bi == null)
{
bi = _bannedIps.get(parts[0] + ".0.0.0");
bi = _bannedIps.get(InetAddress.getByName(parts[0] + ".0.0.0"));
}
if (bi != null)
{
@ -364,7 +364,7 @@ public class LoginController
*/
public boolean removeBanForAddress(InetAddress address)
{
return _bannedIps.remove(address.getHostAddress()) != null;
return _bannedIps.remove(address) != null;
}
/**

View File

@ -16,6 +16,7 @@
*/
package com.l2jmobius.loginserver;
import java.net.UnknownHostException;
import java.nio.channels.SocketChannel;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@ -59,7 +60,7 @@ public class SelectorHelper implements IMMOExecutor<L2LoginClient>, IClientFacto
}
@Override
public boolean accept(SocketChannel sc)
public boolean accept(SocketChannel sc) throws UnknownHostException
{
return _ipv4filter.accept(sc) && !LoginController.getInstance().isBannedAddress(sc.socket().getInetAddress());
}

View File

@ -16,6 +16,7 @@
*/
package com.l2jmobius.loginserver.network.mmocore;
import java.net.UnknownHostException;
import java.nio.channels.SocketChannel;
/**
@ -23,5 +24,5 @@ import java.nio.channels.SocketChannel;
*/
public interface IAcceptFilter
{
boolean accept(SocketChannel sc);
boolean accept(SocketChannel sc) throws UnknownHostException;
}