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

@ -665,7 +665,7 @@ public final class Raina extends AbstractNpcAI
if (subId.equalsOrChildOf(cid))
{
availSubs.remove(cid);
availSubs.remove(subList.getClassDefinition());
break;
}
}

View File

@ -48,6 +48,6 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
{
final L2Summon pet = caster.getPet();
final Collection<L2Summon> summons = caster.getServitors().values();
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(npcId -> _npcIds.contains(npcId));
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(summon -> _npcIds.contains(summon.getId()));
}
}

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

@ -626,7 +626,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;
}
@ -864,7 +864,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;
}

View File

@ -665,7 +665,7 @@ public final class Raina extends AbstractNpcAI
if (subId.equalsOrChildOf(cid))
{
availSubs.remove(cid);
availSubs.remove(subList.getClassDefinition());
break;
}
}

View File

@ -48,6 +48,6 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
{
final L2Summon pet = caster.getPet();
final Collection<L2Summon> summons = caster.getServitors().values();
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(npcId -> _npcIds.contains(npcId));
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(summon -> _npcIds.contains(summon.getId()));
}
}

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;
}

View File

@ -665,7 +665,7 @@ public final class Raina extends AbstractNpcAI
if (subId.equalsOrChildOf(cid))
{
availSubs.remove(cid);
availSubs.remove(subList.getClassDefinition());
break;
}
}

View File

@ -48,6 +48,6 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
{
final L2Summon pet = caster.getPet();
final Collection<L2Summon> summons = caster.getServitors().values();
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(npcId -> _npcIds.contains(npcId));
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(summon -> _npcIds.contains(summon.getId()));
}
}

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;
}

View File

@ -1587,7 +1587,7 @@ public class NpcBuffer extends Quest
for (L2CubicInstance cubic : player.getCubics().values())
{
cubic.stopAction();
player.getCubics().remove(cubic);
player.getCubics().remove(cubic.getId());
}
}
}
@ -1852,7 +1852,7 @@ public class NpcBuffer extends Quest
for (L2CubicInstance cubic : player.getCubics().values())
{
cubic.stopAction();
player.getCubics().remove(cubic);
player.getCubics().remove(cubic.getId());
}
}
npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1000, 0));
@ -1873,7 +1873,7 @@ public class NpcBuffer extends Quest
for (L2CubicInstance cubic : player.getCubics().values())
{
cubic.stopAction();
player.getCubics().remove(cubic);
player.getCubics().remove(cubic.getId());
}
}
npc.broadcastPacket(new MagicSkillUse(npc, player, Integer.parseInt(eventParam1), 1, 1000, 0));

View File

@ -1084,7 +1084,7 @@ public class Duel
if (cond != null)
{
cond.teleportBack();
_playerConditions.remove(cond);
_playerConditions.remove(player.getObjectId());
}
player.setIsInDuel(0);
}

View File

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

View File

@ -48,6 +48,6 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition
{
final L2Summon pet = caster.getPet();
final Collection<L2Summon> summons = caster.getServitors().values();
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(npcId -> _npcIds.contains(npcId));
return ((pet != null) && _npcIds.stream().anyMatch(npcId -> npcId == pet.getId())) || summons.stream().anyMatch(summon -> _npcIds.contains(summon.getId()));
}
}

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;
}