From bb9e1f2827a346d9a0ef64a8ccd18db1bb1e21fe Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 27 Sep 2017 01:59:41 +0000 Subject: [PATCH] Fixes for new Eclipse warnings. --- .../scripts/ai/areas/TalkingIsland/Raina/Raina.java | 2 +- .../OpNeedSummonOrPetSkillCondition.java | 2 +- .../gameserver/data/xml/impl/SkillTreesData.java | 2 +- .../l2jmobius/gameserver/model/actor/L2Attackable.java | 5 +++-- .../com/l2jmobius/loginserver/GameServerTable.java | 2 +- .../com/l2jmobius/loginserver/LoginController.java | 10 +++++----- .../java/com/l2jmobius/loginserver/SelectorHelper.java | 3 ++- .../loginserver/network/mmocore/IAcceptFilter.java | 3 ++- .../scripts/ai/areas/TalkingIsland/Raina/Raina.java | 2 +- .../OpNeedSummonOrPetSkillCondition.java | 2 +- .../gameserver/data/xml/impl/SkillTreesData.java | 2 +- .../l2jmobius/gameserver/model/actor/L2Attackable.java | 5 +++-- .../com/l2jmobius/loginserver/GameServerTable.java | 2 +- .../com/l2jmobius/loginserver/LoginController.java | 10 +++++----- .../java/com/l2jmobius/loginserver/SelectorHelper.java | 3 ++- .../loginserver/network/mmocore/IAcceptFilter.java | 3 ++- .../scripts/ai/areas/TalkingIsland/Raina/Raina.java | 2 +- .../OpNeedSummonOrPetSkillCondition.java | 2 +- .../gameserver/data/xml/impl/SkillTreesData.java | 2 +- .../l2jmobius/gameserver/model/actor/L2Attackable.java | 5 +++-- .../com/l2jmobius/loginserver/GameServerTable.java | 2 +- .../com/l2jmobius/loginserver/LoginController.java | 10 +++++----- .../java/com/l2jmobius/loginserver/SelectorHelper.java | 3 ++- .../loginserver/network/mmocore/IAcceptFilter.java | 3 ++- .../game/data/scripts/custom/NpcBuffer/NpcBuffer.java | 6 +++--- .../com/l2jmobius/gameserver/model/entity/Duel.java | 2 +- .../com/l2jmobius/loginserver/GameServerTable.java | 2 +- .../OpNeedSummonOrPetSkillCondition.java | 2 +- .../gameserver/data/xml/impl/SkillTreesData.java | 2 +- .../l2jmobius/gameserver/model/actor/L2Attackable.java | 5 +++-- .../com/l2jmobius/loginserver/GameServerTable.java | 2 +- .../com/l2jmobius/loginserver/LoginController.java | 10 +++++----- .../java/com/l2jmobius/loginserver/SelectorHelper.java | 3 ++- .../loginserver/network/mmocore/IAcceptFilter.java | 3 ++- 34 files changed, 68 insertions(+), 56 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java index 0c86d40053..155fcc0e96 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java @@ -665,7 +665,7 @@ public final class Raina extends AbstractNpcAI if (subId.equalsOrChildOf(cid)) { - availSubs.remove(cid); + availSubs.remove(subList.getClassDefinition()); break; } } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java index 3929b3ccf6..2c983cd677 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java @@ -48,6 +48,6 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition { final L2Summon pet = caster.getPet(); final Collection 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())); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 34eb9f0517..0f1eee643e 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -421,7 +421,7 @@ public final class SkillTreesData implements IGameXmlReader } else if (type.equals("revelationSkillTree") && (subType != null)) { - final Map revelationSkillTrees = _revelationSkillTree.get(race); + final Map revelationSkillTrees = _revelationSkillTree.get(subType); if (revelationSkillTrees == null) { _revelationSkillTree.put(subType, revelationSkillTree); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java index 68cdaf4061..87a8bef0c0 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java @@ -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); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/GameServerTable.java index 50d1f9229e..4bb7ad5248 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/GameServerTable.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/GameServerTable.java @@ -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(); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginController.java index a83b097ee9..b7865426f2 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginController.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginController.java @@ -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; } /** diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/SelectorHelper.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/SelectorHelper.java index fd2418e86f..551816b583 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/SelectorHelper.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/SelectorHelper.java @@ -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, IClientFacto } @Override - public boolean accept(SocketChannel sc) + public boolean accept(SocketChannel sc) throws UnknownHostException { return _ipv4filter.accept(sc) && !LoginController.getInstance().isBannedAddress(sc.socket().getInetAddress()); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java index a0b2f52439..afa58be791 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java @@ -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; } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java index 0c86d40053..155fcc0e96 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java @@ -665,7 +665,7 @@ public final class Raina extends AbstractNpcAI if (subId.equalsOrChildOf(cid)) { - availSubs.remove(cid); + availSubs.remove(subList.getClassDefinition()); break; } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java index 3929b3ccf6..2c983cd677 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java @@ -48,6 +48,6 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition { final L2Summon pet = caster.getPet(); final Collection 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())); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 34eb9f0517..0f1eee643e 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -421,7 +421,7 @@ public final class SkillTreesData implements IGameXmlReader } else if (type.equals("revelationSkillTree") && (subType != null)) { - final Map revelationSkillTrees = _revelationSkillTree.get(race); + final Map revelationSkillTrees = _revelationSkillTree.get(subType); if (revelationSkillTrees == null) { _revelationSkillTree.put(subType, revelationSkillTree); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java index 3464bde3d7..9cbe09a42b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java @@ -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); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/GameServerTable.java index 50d1f9229e..4bb7ad5248 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/GameServerTable.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/GameServerTable.java @@ -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(); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginController.java index a83b097ee9..b7865426f2 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginController.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginController.java @@ -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; } /** diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/SelectorHelper.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/SelectorHelper.java index fd2418e86f..551816b583 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/SelectorHelper.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/SelectorHelper.java @@ -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, IClientFacto } @Override - public boolean accept(SocketChannel sc) + public boolean accept(SocketChannel sc) throws UnknownHostException { return _ipv4filter.accept(sc) && !LoginController.getInstance().isBannedAddress(sc.socket().getInetAddress()); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java index a0b2f52439..afa58be791 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java @@ -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; } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java index 0c86d40053..155fcc0e96 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java @@ -665,7 +665,7 @@ public final class Raina extends AbstractNpcAI if (subId.equalsOrChildOf(cid)) { - availSubs.remove(cid); + availSubs.remove(subList.getClassDefinition()); break; } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java index 3929b3ccf6..2c983cd677 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java @@ -48,6 +48,6 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition { final L2Summon pet = caster.getPet(); final Collection 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())); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 34eb9f0517..0f1eee643e 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -421,7 +421,7 @@ public final class SkillTreesData implements IGameXmlReader } else if (type.equals("revelationSkillTree") && (subType != null)) { - final Map revelationSkillTrees = _revelationSkillTree.get(race); + final Map revelationSkillTrees = _revelationSkillTree.get(subType); if (revelationSkillTrees == null) { _revelationSkillTree.put(subType, revelationSkillTree); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java index 3464bde3d7..9cbe09a42b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java @@ -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); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/GameServerTable.java index 50d1f9229e..4bb7ad5248 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/GameServerTable.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/GameServerTable.java @@ -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(); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginController.java index a83b097ee9..b7865426f2 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginController.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginController.java @@ -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; } /** diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/SelectorHelper.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/SelectorHelper.java index fd2418e86f..551816b583 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/SelectorHelper.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/SelectorHelper.java @@ -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, IClientFacto } @Override - public boolean accept(SocketChannel sc) + public boolean accept(SocketChannel sc) throws UnknownHostException { return _ipv4filter.accept(sc) && !LoginController.getInstance().isBannedAddress(sc.socket().getInetAddress()); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java index a0b2f52439..afa58be791 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java @@ -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; } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/custom/NpcBuffer/NpcBuffer.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/custom/NpcBuffer/NpcBuffer.java index 3666d8edd7..2df1a65623 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/custom/NpcBuffer/NpcBuffer.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/custom/NpcBuffer/NpcBuffer.java @@ -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)); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Duel.java index 367deab176..062eb88ec5 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Duel.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Duel.java @@ -1084,7 +1084,7 @@ public class Duel if (cond != null) { cond.teleportBack(); - _playerConditions.remove(cond); + _playerConditions.remove(player.getObjectId()); } player.setIsInDuel(0); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/GameServerTable.java index 54032f55f1..bada399c49 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/GameServerTable.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/GameServerTable.java @@ -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(); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java index 3929b3ccf6..2c983cd677 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/skillconditionhandlers/OpNeedSummonOrPetSkillCondition.java @@ -48,6 +48,6 @@ public class OpNeedSummonOrPetSkillCondition implements ISkillCondition { final L2Summon pet = caster.getPet(); final Collection 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())); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 34eb9f0517..0f1eee643e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -421,7 +421,7 @@ public final class SkillTreesData implements IGameXmlReader } else if (type.equals("revelationSkillTree") && (subType != null)) { - final Map revelationSkillTrees = _revelationSkillTree.get(race); + final Map revelationSkillTrees = _revelationSkillTree.get(subType); if (revelationSkillTrees == null) { _revelationSkillTree.put(subType, revelationSkillTree); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java index 3464bde3d7..9cbe09a42b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java @@ -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); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/GameServerTable.java index 50d1f9229e..4bb7ad5248 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/GameServerTable.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/GameServerTable.java @@ -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(); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginController.java index a83b097ee9..b7865426f2 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginController.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginController.java @@ -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; } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/SelectorHelper.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/SelectorHelper.java index fd2418e86f..551816b583 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/SelectorHelper.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/SelectorHelper.java @@ -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, IClientFacto } @Override - public boolean accept(SocketChannel sc) + public boolean accept(SocketChannel sc) throws UnknownHostException { return _ipv4filter.accept(sc) && !LoginController.getInstance().isBannedAddress(sc.socket().getInetAddress()); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java index a0b2f52439..afa58be791 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/mmocore/IAcceptFilter.java @@ -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; }