From 847ff1fa4f59e9dc39b7c326ed8755afad708c08 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 11 Apr 2018 11:25:53 +0000 Subject: [PATCH] Various code changes. --- .../commons/util/DeadLockDetector.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 5 +- .../gameserver/ItemsAutoDestroy.java | 1 - .../com/l2jmobius/gameserver/MonsterRace.java | 16 +--- .../gameserver/RecipeController.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 8 +- .../l2jmobius/gameserver/cache/HtmCache.java | 2 +- .../gameserver/communitybbs/BB/Forum.java | 10 +-- .../Manager/ForumsBBSManager.java | 9 +-- .../communitybbs/Manager/PostBBSManager.java | 28 ++----- .../communitybbs/Manager/TopicBBSManager.java | 22 +----- .../data/sql/impl/CharNameTable.java | 7 +- .../gameserver/data/sql/impl/ClanTable.java | 16 ++-- .../gameserver/datatables/EventDroplist.java | 10 +-- .../gameserver/engines/DocumentBase.java | 3 +- .../engines/items/DocumentItem.java | 1 - .../gameserver/enums/PlayerAction.java | 2 +- .../l2jmobius/gameserver/enums/ShotType.java | 2 +- .../handler/AdminCommandHandler.java | 13 +--- .../gameserver/idfactory/BitSetIDFactory.java | 13 +--- .../instancemanager/MapRegionManager.java | 1 - .../instancemanager/QuestManager.java | 1 - .../instancemanager/SellBuffsManager.java | 2 +- .../tasks/MessageDeletionTask.java | 4 +- .../gameserver/model/AbsorberInfo.java | 20 +---- .../gameserver/model/AbstractPlayerGroup.java | 2 +- .../l2jmobius/gameserver/model/AggroInfo.java | 6 ++ .../l2jmobius/gameserver/model/BlockList.java | 16 ++-- .../gameserver/model/DamageDoneInfo.java | 12 +-- .../gameserver/model/L2AccessLevel.java | 24 ++---- .../l2jmobius/gameserver/model/L2Clan.java | 38 +++------- .../gameserver/model/L2ClanMember.java | 34 ++------- .../gameserver/model/L2CommandChannel.java | 2 +- .../gameserver/model/L2GroupSpawn.java | 10 +-- .../gameserver/model/L2NpcWalkerNode.java | 2 +- .../l2jmobius/gameserver/model/L2Object.java | 6 +- .../gameserver/model/L2RecipeInstance.java | 1 - .../model/L2RecipeStatInstance.java | 1 - .../gameserver/model/L2Territory.java | 13 +--- .../l2jmobius/gameserver/model/L2World.java | 40 +++++----- .../gameserver/model/L2WorldRegion.java | 1 - .../l2jmobius/gameserver/model/MobGroup.java | 18 ++--- .../gameserver/model/MobGroupTable.java | 2 +- .../l2jmobius/gameserver/model/Petition.java | 2 +- .../l2jmobius/gameserver/model/ShortCuts.java | 12 +-- .../l2jmobius/gameserver/model/TradeList.java | 49 ++++-------- .../model/entity/BlockCheckerEngine.java | 24 +++--- .../gameserver/model/entity/Couple.java | 2 +- .../gameserver/model/entity/Fort.java | 59 ++++---------- .../gameserver/model/entity/L2Event.java | 8 +- .../holders/InstanceReenterTimeHolder.java | 2 +- .../model/interfaces/IParserAdvUtils.java | 1 - .../model/itemcontainer/ClanWarehouse.java | 2 +- .../model/items/instance/L2ItemInstance.java | 2 +- .../model/items/type/MaterialType.java | 2 +- .../gameserver/model/quest/Quest.java | 37 ++------- .../gameserver/model/quest/QuestState.java | 22 +++--- .../gameserver/model/stats/TraitType.java | 2 +- .../model/zone/form/ZoneCuboid.java | 8 +- .../model/zone/form/ZoneCylinder.java | 10 +-- .../gameserver/model/zone/form/ZoneNPoly.java | 24 ++---- .../model/zone/type/L2CastleZone.java | 1 - .../model/zone/type/L2NoRestartZone.java | 2 +- .../model/zone/type/L2NoSummonFriendZone.java | 1 - .../type/L2ResidenceHallTeleportZone.java | 7 +- .../gameserver/network/BlowFishKeygen.java | 2 - .../gameserver/network/IncomingPackets.java | 1 - .../loginserverpackets/game/AuthRequest.java | 1 - .../game/ReplyCharacters.java | 2 - .../login/AuthResponse.java | 2 - .../login/ChangePasswordResponse.java | 1 - .../loginserverpackets/login/InitLS.java | 1 - .../loginserverpackets/login/KickPlayer.java | 2 - .../login/LoginServerFail.java | 2 - .../login/PlayerAuthResponse.java | 4 +- .../gameserver/script/DateRange.java | 8 +- .../gameserver/script/ScriptDocument.java | 2 - .../gameserver/script/ScriptEngine.java | 6 +- .../gameserver/taskmanager/Task.java | 1 - .../gameserver/taskmanager/TaskManager.java | 28 +++---- .../gameserver/util/FloodProtectorAction.java | 37 +++++---- .../l2jmobius/gameserver/util/GMAudit.java | 1 - .../gameserver/util/LinePointIterator.java | 23 +++--- .../gameserver/util/LinePointIterator3D.java | 37 +++++---- .../gameserver/util/PrimeFinder.java | 22 ++---- .../commons/util/DeadLockDetector.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 5 +- .../gameserver/ItemsAutoDestroy.java | 1 - .../com/l2jmobius/gameserver/MonsterRace.java | 16 +--- .../gameserver/RecipeController.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 8 +- .../l2jmobius/gameserver/cache/HtmCache.java | 2 +- .../gameserver/communitybbs/BB/Forum.java | 10 +-- .../Manager/ForumsBBSManager.java | 9 +-- .../communitybbs/Manager/PostBBSManager.java | 28 ++----- .../communitybbs/Manager/TopicBBSManager.java | 22 +----- .../data/sql/impl/CharNameTable.java | 7 +- .../gameserver/data/sql/impl/ClanTable.java | 16 ++-- .../gameserver/datatables/EventDroplist.java | 10 +-- .../gameserver/engines/DocumentBase.java | 3 +- .../engines/items/DocumentItem.java | 1 - .../gameserver/enums/PlayerAction.java | 2 +- .../l2jmobius/gameserver/enums/ShotType.java | 2 +- .../handler/AdminCommandHandler.java | 13 +--- .../gameserver/idfactory/BitSetIDFactory.java | 13 +--- .../instancemanager/MapRegionManager.java | 1 - .../instancemanager/QuestManager.java | 1 - .../instancemanager/SellBuffsManager.java | 2 +- .../tasks/MessageDeletionTask.java | 4 +- .../gameserver/model/AbstractPlayerGroup.java | 2 +- .../l2jmobius/gameserver/model/AggroInfo.java | 6 ++ .../l2jmobius/gameserver/model/BlockList.java | 16 ++-- .../gameserver/model/DamageDoneInfo.java | 12 +-- .../gameserver/model/L2AccessLevel.java | 24 ++---- .../l2jmobius/gameserver/model/L2Clan.java | 38 +++------- .../gameserver/model/L2ClanMember.java | 34 ++------- .../gameserver/model/L2CommandChannel.java | 2 +- .../gameserver/model/L2GroupSpawn.java | 10 +-- .../gameserver/model/L2NpcWalkerNode.java | 2 +- .../l2jmobius/gameserver/model/L2Object.java | 6 +- .../gameserver/model/L2RecipeInstance.java | 1 - .../model/L2RecipeStatInstance.java | 1 - .../gameserver/model/L2Territory.java | 13 +--- .../l2jmobius/gameserver/model/L2World.java | 40 +++++----- .../gameserver/model/L2WorldRegion.java | 1 - .../l2jmobius/gameserver/model/MobGroup.java | 18 ++--- .../gameserver/model/MobGroupTable.java | 2 +- .../l2jmobius/gameserver/model/Petition.java | 2 +- .../l2jmobius/gameserver/model/ShortCuts.java | 12 +-- .../l2jmobius/gameserver/model/TradeList.java | 49 ++++-------- .../model/entity/BlockCheckerEngine.java | 24 +++--- .../gameserver/model/entity/Couple.java | 2 +- .../gameserver/model/entity/Fort.java | 59 ++++---------- .../gameserver/model/entity/L2Event.java | 8 +- .../holders/InstanceReenterTimeHolder.java | 2 +- .../model/interfaces/IParserAdvUtils.java | 1 - .../model/itemcontainer/ClanWarehouse.java | 2 +- .../model/items/instance/L2ItemInstance.java | 2 +- .../model/items/type/MaterialType.java | 2 +- .../gameserver/model/quest/Quest.java | 37 ++------- .../gameserver/model/quest/QuestState.java | 22 +++--- .../gameserver/model/stats/TraitType.java | 2 +- .../model/zone/form/ZoneCuboid.java | 8 +- .../model/zone/form/ZoneCylinder.java | 10 +-- .../gameserver/model/zone/form/ZoneNPoly.java | 24 ++---- .../model/zone/type/L2CastleZone.java | 1 - .../model/zone/type/L2NoRestartZone.java | 2 +- .../model/zone/type/L2NoSummonFriendZone.java | 1 - .../type/L2ResidenceHallTeleportZone.java | 7 +- .../gameserver/network/BlowFishKeygen.java | 2 - .../gameserver/network/IncomingPackets.java | 1 - .../loginserverpackets/game/AuthRequest.java | 1 - .../game/ReplyCharacters.java | 2 - .../login/AuthResponse.java | 2 - .../login/ChangePasswordResponse.java | 1 - .../loginserverpackets/login/InitLS.java | 1 - .../loginserverpackets/login/KickPlayer.java | 2 - .../login/LoginServerFail.java | 2 - .../login/PlayerAuthResponse.java | 4 +- .../gameserver/script/DateRange.java | 8 +- .../gameserver/script/ScriptDocument.java | 2 - .../gameserver/script/ScriptEngine.java | 6 +- .../gameserver/taskmanager/Task.java | 1 - .../gameserver/taskmanager/TaskManager.java | 28 +++---- .../gameserver/util/FloodProtectorAction.java | 37 +++++---- .../l2jmobius/gameserver/util/GMAudit.java | 1 - .../gameserver/util/LinePointIterator.java | 23 +++--- .../gameserver/util/LinePointIterator3D.java | 37 +++++---- .../gameserver/util/PrimeFinder.java | 22 ++---- .../commons/util/DeadLockDetector.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 5 +- .../gameserver/ItemsAutoDestroy.java | 1 - .../com/l2jmobius/gameserver/MonsterRace.java | 16 +--- .../gameserver/RecipeController.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 8 +- .../l2jmobius/gameserver/cache/HtmCache.java | 2 +- .../gameserver/communitybbs/BB/Forum.java | 10 +-- .../Manager/ForumsBBSManager.java | 9 +-- .../communitybbs/Manager/PostBBSManager.java | 28 ++----- .../communitybbs/Manager/TopicBBSManager.java | 22 +----- .../data/sql/impl/CharNameTable.java | 7 +- .../gameserver/data/sql/impl/ClanTable.java | 16 ++-- .../gameserver/datatables/EventDroplist.java | 10 +-- .../gameserver/engines/DocumentBase.java | 3 +- .../engines/items/DocumentItem.java | 1 - .../gameserver/enums/PlayerAction.java | 2 +- .../l2jmobius/gameserver/enums/ShotType.java | 2 +- .../handler/AdminCommandHandler.java | 13 +--- .../gameserver/idfactory/BitSetIDFactory.java | 13 +--- .../instancemanager/MapRegionManager.java | 1 - .../instancemanager/QuestManager.java | 1 - .../instancemanager/SellBuffsManager.java | 2 +- .../tasks/MessageDeletionTask.java | 4 +- .../gameserver/model/AbstractPlayerGroup.java | 2 +- .../l2jmobius/gameserver/model/AggroInfo.java | 6 ++ .../l2jmobius/gameserver/model/BlockList.java | 16 ++-- .../gameserver/model/DamageDoneInfo.java | 12 +-- .../gameserver/model/L2AccessLevel.java | 24 ++---- .../l2jmobius/gameserver/model/L2Clan.java | 38 +++------- .../gameserver/model/L2ClanMember.java | 34 ++------- .../gameserver/model/L2CommandChannel.java | 2 +- .../gameserver/model/L2GroupSpawn.java | 10 +-- .../gameserver/model/L2NpcWalkerNode.java | 2 +- .../l2jmobius/gameserver/model/L2Object.java | 6 +- .../gameserver/model/L2RecipeInstance.java | 1 - .../model/L2RecipeStatInstance.java | 1 - .../gameserver/model/L2Territory.java | 13 +--- .../l2jmobius/gameserver/model/L2World.java | 40 +++++----- .../gameserver/model/L2WorldRegion.java | 1 - .../l2jmobius/gameserver/model/MobGroup.java | 18 ++--- .../gameserver/model/MobGroupTable.java | 2 +- .../l2jmobius/gameserver/model/Petition.java | 2 +- .../l2jmobius/gameserver/model/ShortCuts.java | 12 +-- .../l2jmobius/gameserver/model/TradeList.java | 49 ++++-------- .../model/entity/BlockCheckerEngine.java | 24 +++--- .../gameserver/model/entity/Couple.java | 2 +- .../gameserver/model/entity/Fort.java | 59 ++++---------- .../gameserver/model/entity/L2Event.java | 8 +- .../holders/InstanceReenterTimeHolder.java | 2 +- .../model/interfaces/IParserAdvUtils.java | 1 - .../model/itemcontainer/ClanWarehouse.java | 2 +- .../model/items/instance/L2ItemInstance.java | 2 +- .../model/items/type/MaterialType.java | 2 +- .../gameserver/model/quest/Quest.java | 37 ++------- .../gameserver/model/quest/QuestState.java | 22 +++--- .../gameserver/model/stats/TraitType.java | 2 +- .../model/zone/form/ZoneCuboid.java | 8 +- .../model/zone/form/ZoneCylinder.java | 10 +-- .../gameserver/model/zone/form/ZoneNPoly.java | 24 ++---- .../model/zone/type/L2CastleZone.java | 1 - .../model/zone/type/L2NoRestartZone.java | 2 +- .../model/zone/type/L2NoSummonFriendZone.java | 1 - .../type/L2ResidenceHallTeleportZone.java | 7 +- .../gameserver/network/BlowFishKeygen.java | 2 - .../gameserver/network/IncomingPackets.java | 1 - .../loginserverpackets/game/AuthRequest.java | 1 - .../game/ReplyCharacters.java | 2 - .../login/AuthResponse.java | 2 - .../login/ChangePasswordResponse.java | 1 - .../loginserverpackets/login/InitLS.java | 1 - .../loginserverpackets/login/KickPlayer.java | 2 - .../login/LoginServerFail.java | 2 - .../login/PlayerAuthResponse.java | 4 +- .../gameserver/script/DateRange.java | 8 +- .../gameserver/script/ScriptDocument.java | 2 - .../gameserver/script/ScriptEngine.java | 6 +- .../gameserver/taskmanager/Task.java | 1 - .../gameserver/taskmanager/TaskManager.java | 28 +++---- .../gameserver/util/FloodProtectorAction.java | 37 +++++---- .../l2jmobius/gameserver/util/GMAudit.java | 1 - .../gameserver/util/LinePointIterator.java | 23 +++--- .../gameserver/util/LinePointIterator3D.java | 37 +++++---- .../gameserver/util/PrimeFinder.java | 22 ++---- .../commons/util/DeadLockDetector.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 5 +- .../gameserver/ItemsAutoDestroy.java | 1 - .../com/l2jmobius/gameserver/MonsterRace.java | 16 +--- .../com/l2jmobius/gameserver/Shutdown.java | 8 +- .../l2jmobius/gameserver/cache/HtmCache.java | 2 +- .../gameserver/communitybbs/BB/Forum.java | 10 +-- .../Manager/ForumsBBSManager.java | 9 +-- .../communitybbs/Manager/PostBBSManager.java | 28 ++----- .../communitybbs/Manager/TopicBBSManager.java | 22 +----- .../data/sql/impl/CharNameTable.java | 7 +- .../gameserver/data/sql/impl/ClanTable.java | 16 ++-- .../gameserver/datatables/EventDroplist.java | 10 +-- .../gameserver/engines/DocumentBase.java | 3 +- .../engines/items/DocumentItem.java | 1 - .../gameserver/enums/PlayerAction.java | 2 +- .../l2jmobius/gameserver/enums/ShotType.java | 2 +- .../handler/AdminCommandHandler.java | 13 +--- .../gameserver/idfactory/BitSetIDFactory.java | 13 +--- .../instancemanager/MapRegionManager.java | 1 - .../instancemanager/QuestManager.java | 1 - .../instancemanager/SellBuffsManager.java | 2 +- .../tasks/MessageDeletionTask.java | 4 +- .../gameserver/model/AbstractPlayerGroup.java | 2 +- .../l2jmobius/gameserver/model/AggroInfo.java | 6 ++ .../l2jmobius/gameserver/model/BlockList.java | 16 ++-- .../gameserver/model/DamageDoneInfo.java | 12 +-- .../gameserver/model/L2AccessLevel.java | 24 ++---- .../l2jmobius/gameserver/model/L2Clan.java | 38 +++------- .../gameserver/model/L2ClanMember.java | 34 ++------- .../gameserver/model/L2CommandChannel.java | 2 +- .../gameserver/model/L2GroupSpawn.java | 10 +-- .../gameserver/model/L2NpcWalkerNode.java | 2 +- .../l2jmobius/gameserver/model/L2Object.java | 6 +- .../gameserver/model/L2Territory.java | 13 +--- .../l2jmobius/gameserver/model/L2World.java | 40 +++++----- .../gameserver/model/L2WorldRegion.java | 1 - .../l2jmobius/gameserver/model/MobGroup.java | 18 ++--- .../gameserver/model/MobGroupTable.java | 2 +- .../l2jmobius/gameserver/model/Petition.java | 2 +- .../l2jmobius/gameserver/model/ShortCuts.java | 12 +-- .../model/entity/BlockCheckerEngine.java | 24 +++--- .../gameserver/model/entity/Couple.java | 2 +- .../gameserver/model/entity/Fort.java | 59 ++++---------- .../gameserver/model/entity/L2Event.java | 8 +- .../holders/InstanceReenterTimeHolder.java | 2 +- .../model/interfaces/IParserAdvUtils.java | 1 - .../model/itemcontainer/ClanWarehouse.java | 2 +- .../model/items/instance/L2ItemInstance.java | 2 +- .../model/items/type/MaterialType.java | 2 +- .../gameserver/model/quest/Quest.java | 37 ++------- .../gameserver/model/quest/QuestState.java | 22 +++--- .../gameserver/model/stats/TraitType.java | 2 +- .../model/zone/form/ZoneCuboid.java | 8 +- .../model/zone/form/ZoneCylinder.java | 10 +-- .../gameserver/model/zone/form/ZoneNPoly.java | 24 ++---- .../model/zone/type/L2CastleZone.java | 1 - .../model/zone/type/L2NoRestartZone.java | 2 +- .../model/zone/type/L2NoSummonFriendZone.java | 1 - .../type/L2ResidenceHallTeleportZone.java | 7 +- .../gameserver/network/BlowFishKeygen.java | 2 - .../gameserver/network/IncomingPackets.java | 1 - .../loginserverpackets/game/AuthRequest.java | 1 - .../game/ReplyCharacters.java | 2 - .../login/AuthResponse.java | 2 - .../login/ChangePasswordResponse.java | 1 - .../loginserverpackets/login/InitLS.java | 1 - .../loginserverpackets/login/KickPlayer.java | 2 - .../login/LoginServerFail.java | 2 - .../login/PlayerAuthResponse.java | 4 +- .../gameserver/script/DateRange.java | 8 +- .../gameserver/script/ScriptDocument.java | 2 - .../gameserver/script/ScriptEngine.java | 6 +- .../gameserver/taskmanager/Task.java | 1 - .../gameserver/taskmanager/TaskManager.java | 28 +++---- .../gameserver/util/FloodProtectorAction.java | 37 +++++---- .../l2jmobius/gameserver/util/GMAudit.java | 1 - .../gameserver/util/LinePointIterator.java | 23 +++--- .../gameserver/util/LinePointIterator3D.java | 37 +++++---- .../gameserver/util/PrimeFinder.java | 22 ++---- .../game/data/instances/CastleDungeon.xml | 2 +- .../CavernOfThePirateCaptainWorldDay60.xml | 2 +- .../CavernOfThePirateCaptainWorldDay83.xml | 2 +- .../CavernOfThePirateCaptainWorldNight60.xml | 2 +- .../game/data/instances/CrystalCaverns.xml | 2 +- .../dist/game/data/instances/DemonPrince.xml | 2 +- .../instances/IceQueensCastleNormalBattle.xml | 2 +- .../IceQueensCastleNormalBattleEasy.xml | 2 +- .../IceQueensCastleNormalBattleHardcore.xml | 2 +- .../dist/game/data/instances/Ranku.xml | 2 +- .../instances/SeedOfDestructionStage1.xml | 2 +- .../scripts/ai/areas/BeastFarm/BeastFarm.java | 4 +- .../scripts/ai/areas/DenOfEvil/DenOfEvil.java | 2 +- .../SeedOfAnnihilation.java | 2 +- .../HallOfSufferingAttack.java | 2 +- .../HallOfSufferingDefence.java | 2 +- .../SeedOfDestruction/SeedOfDestruction.java | 2 +- .../AI/Zones/TowerOfNaia/TowerOfNaia.java | 2 +- .../AI/Zones/TullyWorkshop/TullyWorkshop.java | 2 +- .../ai/areas/HotSprings/HotSprings.java | 2 +- .../KetraOrcSupport/KetraOrcSupport.java | 2 +- .../SelMahumSquad.java | 2 +- .../ai/areas/StakatoNest/StakatoNest.java | 2 +- .../VarkaSilenosSupport.java | 2 +- .../data/scripts/ai/bosses/Orfen/Orfen.java | 2 +- .../scripts/ai/bosses/Valakas/Valakas.java | 2 +- .../ai/others/AvantGarde/AvantGarde.java | 2 +- .../others/HealerTrainer/HealerTrainer.java | 2 +- .../others/NpcBuffers/impl/CabaleBuffer.java | 2 +- .../DevastatedCastle/DevastatedCastle.java | 2 +- .../scripts/custom/NpcBuffer/NpcBuffer.java | 2 +- .../data/scripts/custom/events/Race/Race.java | 2 +- .../admincommandhandlers/AdminEffects.java | 2 +- .../admincommandhandlers/AdminReload.java | 2 +- .../admincommandhandlers/AdminSkill.java | 2 +- .../admincommandhandlers/AdminTest.java | 2 +- .../handlers/communityboard/HomeBoard.java | 2 +- .../handlers/effecthandlers/CallPc.java | 4 +- .../handlers/effecthandlers/HealPercent.java | 2 +- .../effecthandlers/MagicalAttackMp.java | 6 +- .../handlers/effecthandlers/ManaHeal.java | 2 +- .../effecthandlers/ManaHealByLevel.java | 2 +- .../effecthandlers/ManaHealPercent.java | 2 +- .../handlers/effecthandlers/SetSkill.java | 2 +- .../effecthandlers/TriggerSkillByAttack.java | 2 +- .../effecthandlers/TriggerSkillByAvoid.java | 2 +- .../effecthandlers/TriggerSkillByDamage.java | 2 +- .../effecthandlers/TriggerSkillBySkill.java | 2 +- .../handlers/itemhandlers/BeastSoulShot.java | 2 +- .../itemhandlers/BeastSpiritShot.java | 2 +- .../itemhandlers/BlessedSpiritShot.java | 2 +- .../handlers/itemhandlers/FishShots.java | 2 +- .../handlers/itemhandlers/PetFood.java | 4 +- .../handlers/itemhandlers/SoulShots.java | 2 +- .../handlers/itemhandlers/SpiritShot.java | 2 +- .../telnethandlers/server/Reload.java | 2 +- .../handlers/usercommandhandlers/Unstuck.java | 2 +- .../voicedcommandhandlers/Wedding.java | 2 +- .../scripts/instances/AbstractInstance.java | 4 +- .../CrystalCaverns/CrystalCaverns.java | 2 +- .../FinalEmperialTomb/FinalEmperialTomb.java | 2 +- .../FinalEmperialTomb/ScarletVanHalisha.java | 2 +- .../scripts/instances/Kamaloka/Kamaloka.java | 2 +- .../NornilsGarden/NornilsGarden.java | 2 +- .../Q00144_PailakaInjuredDragon.java | 2 +- .../Q00242_PossessorOfAPreciousSoul2.java | 2 +- .../dist/game/data/xsd/instance.xsd | 4 +- .../commons/util/DeadLockDetector.java | 26 +++---- .../commons/util/PropertiesParser.java | 44 +++++------ .../com/l2jmobius/gameserver/FortUpdater.java | 4 +- .../com/l2jmobius/gameserver/GameServer.java | 19 +++-- .../gameserver/GameTimeController.java | 8 +- .../com/l2jmobius/gameserver/MonsterRace.java | 14 ++-- .../gameserver/RecipeController.java | 6 +- .../com/l2jmobius/gameserver/Shutdown.java | 2 +- .../l2jmobius/gameserver/ai/AbstractAI.java | 8 +- .../gameserver/ai/L2AttackableAI.java | 2 +- .../com/l2jmobius/gameserver/ai/L2BoatAI.java | 24 +++--- .../gameserver/ai/L2CharacterAI.java | 6 +- .../com/l2jmobius/gameserver/ai/L2DoorAI.java | 4 +- .../l2jmobius/gameserver/ai/L2PlayableAI.java | 9 +-- .../l2jmobius/gameserver/ai/L2PlayerAI.java | 6 +- .../l2jmobius/gameserver/ai/L2VehicleAI.java | 6 +- .../l2jmobius/gameserver/cache/HtmCache.java | 14 ++-- .../gameserver/communitybbs/BB/Forum.java | 27 +++---- .../gameserver/communitybbs/BB/Post.java | 38 ++++++---- .../gameserver/communitybbs/BB/Topic.java | 6 +- .../communitybbs/Manager/BaseBBSManager.java | 2 +- .../Manager/ForumsBBSManager.java | 25 ++++-- .../communitybbs/Manager/PostBBSManager.java | 22 ++---- .../communitybbs/Manager/TopicBBSManager.java | 6 +- .../data/sql/impl/CharNameTable.java | 57 +++++++------- .../data/sql/impl/CharSummonTable.java | 2 +- .../gameserver/data/sql/impl/ClanTable.java | 22 +++--- .../gameserver/data/xml/impl/NpcData.java | 1 - .../data/xml/impl/PetSkillData.java | 7 +- .../xml/impl}/SkillData.java | 3 +- .../data/xml/impl/SkillTreesData.java | 1 - .../gameserver/datatables/BotReportTable.java | 24 +++--- .../gameserver/datatables/EventDroplist.java | 7 +- .../gameserver/datatables/ItemTable.java | 13 ++-- .../gameserver/engines/DocumentEngine.java | 26 +++---- .../gameserver/enums/InstanceReenterType.java | 4 +- .../gameserver/geoengine/GeoEngine.java | 2 +- .../HandysBlockCheckerManager.java | 2 +- .../instancemanager/SellBuffsManager.java | 4 +- .../instancemanager/SiegeManager.java | 2 +- .../instancemanager/TerritoryWarManager.java | 2 +- .../gameserver/model/CombatFlag.java | 2 +- .../gameserver/model/CursedWeapon.java | 2 +- .../gameserver/model/L2AccessLevel.java | 70 ++++++++++------- .../model/L2AdminCommandAccessRight.java | 2 +- .../l2jmobius/gameserver/model/L2Clan.java | 25 +++--- .../gameserver/model/L2ClanMember.java | 8 +- .../gameserver/model/L2CommandChannel.java | 21 ++--- .../gameserver/model/L2ContactList.java | 43 ++++++----- .../l2jmobius/gameserver/model/L2Crest.java | 2 +- .../model/L2ExtractableProduct.java | 2 +- .../gameserver/model/L2GroupSpawn.java | 2 +- .../gameserver/model/L2MapRegion.java | 36 ++++++++- .../l2jmobius/gameserver/model/L2PetData.java | 8 +- .../l2jmobius/gameserver/model/L2Radar.java | 19 +++-- .../l2jmobius/gameserver/model/L2Spawn.java | 16 ++-- .../gameserver/model/L2Territory.java | 21 ++++- .../gameserver/model/L2WorldRegion.java | 1 - .../gameserver/model/MobGroupTable.java | 3 +- .../gameserver/model/PartyMatchRoom.java | 2 +- .../gameserver/model/PcCondOverride.java | 2 +- .../l2jmobius/gameserver/model/ShortCuts.java | 30 ++++---- .../gameserver/model/SpawnListener.java | 1 - .../l2jmobius/gameserver/model/StatsSet.java | 4 +- .../l2jmobius/gameserver/model/TradeList.java | 7 +- .../gameserver/model/actor/L2Attackable.java | 2 +- .../gameserver/model/actor/L2Character.java | 4 +- .../gameserver/model/actor/L2Summon.java | 4 +- .../actor/instance/L2BabyPetInstance.java | 2 +- .../instance/L2ClanHallManagerInstance.java | 2 +- .../model/actor/instance/L2CubicInstance.java | 2 +- .../model/actor/instance/L2DecoyInstance.java | 2 +- .../actor/instance/L2FishermanInstance.java | 2 +- .../actor/instance/L2FortManagerInstance.java | 2 +- .../actor/instance/L2NpcBufferInstance.java | 4 +- .../model/actor/instance/L2NpcInstance.java | 2 +- .../model/actor/instance/L2PcInstance.java | 18 ++--- .../model/actor/instance/L2PetInstance.java | 2 +- .../actor/instance/L2ServitorInstance.java | 2 +- .../actor/instance/L2TamedBeastInstance.java | 2 +- .../model/actor/instance/L2TrapInstance.java | 4 +- .../model/actor/status/PcStatus.java | 2 +- .../model/actor/status/PetStatus.java | 2 +- .../model/actor/transform/Transform.java | 2 +- .../model/entity/BlockCheckerEngine.java | 8 +- .../gameserver/model/entity/Castle.java | 27 +++---- .../gameserver/model/entity/Fort.java | 40 +++++----- .../gameserver/model/entity/TvTEvent.java | 2 +- .../holders/InstanceReenterTimeHolder.java | 2 +- .../gameserver/model/holders/SkillHolder.java | 4 +- .../itemauction/AuctionDateGenerator.java | 8 +- .../model/items/type/ArmorType.java | 2 +- .../model/items/type/CrystalType.java | 2 +- .../model/items/type/WeaponType.java | 2 +- .../gameserver/model/quest/Quest.java | 10 +-- .../gameserver/model/skills/BuffTimeTask.java | 2 +- .../gameserver/model/skills/CommonSkill.java | 4 +- .../gameserver/model/skills/Skill.java | 2 +- .../model/skills/SkillChannelizer.java | 2 +- .../gameserver/model/stats/Formulas.java | 26 +++---- .../gameserver/model/zone/L2ZoneForm.java | 3 +- .../model/zone/form/ZoneCuboid.java | 10 +-- .../model/zone/form/ZoneCylinder.java | 76 ++++++++++++++----- .../gameserver/model/zone/form/ZoneNPoly.java | 10 +-- .../model/zone/type/L2ConditionZone.java | 38 +++++----- .../model/zone/type/L2EffectZone.java | 2 +- .../model/zone/type/L2JailZone.java | 66 ++++++++-------- .../model/zone/type/L2MotherTreeZone.java | 30 ++++---- .../model/zone/type/L2SiegeZone.java | 2 +- .../model/zone/type/NpcSpawnTerritory.java | 3 +- .../clientpackets/CharacterCreate.java | 2 +- .../clientpackets/RequestAcquireSkill.java | 4 +- .../RequestAcquireSkillInfo.java | 2 +- .../clientpackets/RequestActionUse.java | 2 +- .../RequestAnswerFriendInvite.java | 2 +- .../RequestCancelPostAttachment.java | 2 +- .../network/clientpackets/RequestDispel.java | 2 +- .../clientpackets/RequestEnchantItem.java | 2 +- .../clientpackets/RequestExEnchantSkill.java | 2 +- .../RequestExEnchantSkillInfo.java | 2 +- .../RequestExEnchantSkillRouteChange.java | 2 +- .../RequestExEnchantSkillSafe.java | 2 +- .../RequestExEnchantSkillUntrain.java | 2 +- .../RequestExMagicSkillUseGround.java | 2 +- .../clientpackets/RequestFriendInvite.java | 2 +- .../clientpackets/RequestJoinParty.java | 6 +- .../RequestPartyMatchDetail.java | 2 +- .../clientpackets/RequestPostAttachment.java | 4 +- .../RequestRejectPostAttachment.java | 2 +- .../network/clientpackets/TradeRequest.java | 4 +- .../serverpackets/AbstractMessagePacket.java | 35 +-------- .../serverpackets/ExShowContactList.java | 4 +- .../serverpackets/GMViewSkillInfo.java | 2 +- ...lMessage.java => NpcQuestHtmlMessage.java} | 4 +- .../serverpackets/PrivateStoreListBuy.java | 4 +- .../gameserver/taskmanager/Task.java | 2 +- .../gameserver/taskmanager/TaskManager.java | 18 ++--- .../taskmanager/tasks/TaskBirthday.java | 4 +- .../tasks/TaskClanLeaderApply.java | 2 +- .../tasks/TaskDailySkillReuseClean.java | 4 +- .../taskmanager/tasks/TaskNevit.java | 2 +- .../taskmanager/tasks/TaskOlympiadSave.java | 2 +- .../tasks/TaskRaidPointsReset.java | 2 +- .../taskmanager/tasks/TaskRecom.java | 4 +- .../tasks/TaskSevenSignsUpdate.java | 4 +- .../l2jmobius/gameserver/util/HtmlUtil.java | 2 +- .../gameserver/util/LinePointIterator3D.java | 6 ++ .../l2jmobius/gameserver/util/MinionList.java | 12 +-- .../commons/util/DeadLockDetector.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 5 +- .../gameserver/ItemsAutoDestroy.java | 1 - .../gameserver/RecipeController.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 8 +- .../l2jmobius/gameserver/cache/HtmCache.java | 2 +- .../gameserver/communitybbs/BB/Forum.java | 10 +-- .../Manager/ForumsBBSManager.java | 9 +-- .../communitybbs/Manager/PostBBSManager.java | 28 ++----- .../communitybbs/Manager/TopicBBSManager.java | 22 +----- .../data/sql/impl/CharNameTable.java | 7 +- .../gameserver/data/sql/impl/ClanTable.java | 16 ++-- .../gameserver/datatables/EventDroplist.java | 10 +-- .../gameserver/engines/DocumentBase.java | 3 +- .../engines/items/DocumentItem.java | 1 - .../gameserver/enums/PlayerAction.java | 2 +- .../l2jmobius/gameserver/enums/ShotType.java | 2 +- .../handler/AdminCommandHandler.java | 13 +--- .../gameserver/idfactory/BitSetIDFactory.java | 13 +--- .../instancemanager/MapRegionManager.java | 1 - .../instancemanager/QuestManager.java | 1 - .../instancemanager/SellBuffsManager.java | 2 +- .../tasks/MessageDeletionTask.java | 4 +- .../gameserver/model/AbstractPlayerGroup.java | 2 +- .../l2jmobius/gameserver/model/AggroInfo.java | 6 ++ .../l2jmobius/gameserver/model/BlockList.java | 16 ++-- .../gameserver/model/DamageDoneInfo.java | 12 +-- .../gameserver/model/L2AccessLevel.java | 24 ++---- .../l2jmobius/gameserver/model/L2Clan.java | 38 +++------- .../gameserver/model/L2ClanMember.java | 34 ++------- .../gameserver/model/L2CommandChannel.java | 2 +- .../gameserver/model/L2GroupSpawn.java | 10 +-- .../gameserver/model/L2NpcWalkerNode.java | 2 +- .../l2jmobius/gameserver/model/L2Object.java | 6 +- .../gameserver/model/L2RecipeInstance.java | 1 - .../model/L2RecipeStatInstance.java | 1 - .../gameserver/model/L2Territory.java | 13 +--- .../l2jmobius/gameserver/model/L2World.java | 40 +++++----- .../gameserver/model/L2WorldRegion.java | 1 - .../l2jmobius/gameserver/model/MobGroup.java | 18 ++--- .../gameserver/model/MobGroupTable.java | 2 +- .../l2jmobius/gameserver/model/Petition.java | 2 +- .../l2jmobius/gameserver/model/ShortCuts.java | 12 +-- .../l2jmobius/gameserver/model/TradeList.java | 49 ++++-------- .../model/entity/BlockCheckerEngine.java | 24 +++--- .../gameserver/model/entity/Couple.java | 2 +- .../gameserver/model/entity/Fort.java | 59 ++++---------- .../gameserver/model/entity/L2Event.java | 8 +- .../holders/InstanceReenterTimeHolder.java | 2 +- .../model/interfaces/IParserAdvUtils.java | 1 - .../model/itemcontainer/ClanWarehouse.java | 2 +- .../model/items/instance/L2ItemInstance.java | 2 +- .../model/items/type/MaterialType.java | 2 +- .../gameserver/model/quest/Quest.java | 35 ++------- .../gameserver/model/quest/QuestState.java | 22 +++--- .../gameserver/model/stats/TraitType.java | 2 +- .../model/zone/form/ZoneCuboid.java | 8 +- .../model/zone/form/ZoneCylinder.java | 10 +-- .../gameserver/model/zone/form/ZoneNPoly.java | 24 ++---- .../model/zone/type/L2CastleZone.java | 1 - .../model/zone/type/L2NoRestartZone.java | 2 +- .../model/zone/type/L2NoSummonFriendZone.java | 1 - .../type/L2ResidenceHallTeleportZone.java | 7 +- .../gameserver/network/BlowFishKeygen.java | 2 - .../gameserver/network/IncomingPackets.java | 1 - .../loginserverpackets/game/AuthRequest.java | 1 - .../game/ReplyCharacters.java | 2 - .../login/AuthResponse.java | 2 - .../login/ChangePasswordResponse.java | 1 - .../loginserverpackets/login/InitLS.java | 1 - .../loginserverpackets/login/KickPlayer.java | 2 - .../login/LoginServerFail.java | 2 - .../login/PlayerAuthResponse.java | 4 +- .../gameserver/script/DateRange.java | 8 +- .../gameserver/script/ScriptDocument.java | 2 - .../gameserver/script/ScriptEngine.java | 6 +- .../gameserver/taskmanager/Task.java | 1 - .../gameserver/taskmanager/TaskManager.java | 28 +++---- .../gameserver/util/FloodProtectorAction.java | 37 +++++---- .../l2jmobius/gameserver/util/GMAudit.java | 1 - .../gameserver/util/LinePointIterator.java | 23 +++--- .../gameserver/util/LinePointIterator3D.java | 37 +++++---- .../gameserver/util/PrimeFinder.java | 22 ++---- .../commons/util/DeadLockDetector.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 5 +- .../gameserver/ItemsAutoDestroy.java | 1 - .../gameserver/RecipeController.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 8 +- .../l2jmobius/gameserver/cache/HtmCache.java | 2 +- .../gameserver/communitybbs/BB/Forum.java | 10 +-- .../Manager/ForumsBBSManager.java | 9 +-- .../communitybbs/Manager/PostBBSManager.java | 28 ++----- .../communitybbs/Manager/TopicBBSManager.java | 22 +----- .../data/sql/impl/CharNameTable.java | 7 +- .../gameserver/data/sql/impl/ClanTable.java | 16 ++-- .../gameserver/datatables/EventDroplist.java | 10 +-- .../gameserver/engines/DocumentBase.java | 3 +- .../engines/items/DocumentItem.java | 1 - .../gameserver/enums/PlayerAction.java | 2 +- .../l2jmobius/gameserver/enums/ShotType.java | 2 +- .../handler/AdminCommandHandler.java | 13 +--- .../gameserver/idfactory/BitSetIDFactory.java | 13 +--- .../instancemanager/MapRegionManager.java | 1 - .../instancemanager/QuestManager.java | 1 - .../instancemanager/SellBuffsManager.java | 2 +- .../tasks/MessageDeletionTask.java | 4 +- .../gameserver/model/AbstractPlayerGroup.java | 2 +- .../l2jmobius/gameserver/model/AggroInfo.java | 6 ++ .../l2jmobius/gameserver/model/BlockList.java | 16 ++-- .../gameserver/model/DamageDoneInfo.java | 12 +-- .../gameserver/model/L2AccessLevel.java | 24 ++---- .../l2jmobius/gameserver/model/L2Clan.java | 38 +++------- .../gameserver/model/L2ClanMember.java | 34 ++------- .../gameserver/model/L2CommandChannel.java | 2 +- .../gameserver/model/L2GroupSpawn.java | 10 +-- .../gameserver/model/L2NpcWalkerNode.java | 2 +- .../l2jmobius/gameserver/model/L2Object.java | 6 +- .../gameserver/model/L2RecipeInstance.java | 1 - .../model/L2RecipeStatInstance.java | 1 - .../gameserver/model/L2Territory.java | 13 +--- .../l2jmobius/gameserver/model/L2World.java | 40 +++++----- .../gameserver/model/L2WorldRegion.java | 1 - .../l2jmobius/gameserver/model/MobGroup.java | 18 ++--- .../gameserver/model/MobGroupTable.java | 2 +- .../l2jmobius/gameserver/model/Petition.java | 2 +- .../l2jmobius/gameserver/model/ShortCuts.java | 12 +-- .../model/entity/BlockCheckerEngine.java | 24 +++--- .../gameserver/model/entity/Couple.java | 2 +- .../gameserver/model/entity/Fort.java | 59 ++++---------- .../gameserver/model/entity/L2Event.java | 8 +- .../holders/InstanceReenterTimeHolder.java | 2 +- .../model/interfaces/IParserAdvUtils.java | 1 - .../model/itemcontainer/ClanWarehouse.java | 2 +- .../model/items/instance/L2ItemInstance.java | 2 +- .../model/items/type/MaterialType.java | 2 +- .../gameserver/model/quest/Quest.java | 35 ++------- .../gameserver/model/quest/QuestState.java | 22 +++--- .../gameserver/model/stats/TraitType.java | 2 +- .../model/zone/form/ZoneCuboid.java | 8 +- .../model/zone/form/ZoneCylinder.java | 10 +-- .../gameserver/model/zone/form/ZoneNPoly.java | 24 ++---- .../model/zone/type/L2CastleZone.java | 1 - .../model/zone/type/L2NoRestartZone.java | 2 +- .../model/zone/type/L2NoSummonFriendZone.java | 1 - .../type/L2ResidenceHallTeleportZone.java | 7 +- .../gameserver/network/BlowFishKeygen.java | 2 - .../gameserver/network/IncomingPackets.java | 1 - .../loginserverpackets/game/AuthRequest.java | 1 - .../game/ReplyCharacters.java | 2 - .../login/AuthResponse.java | 2 - .../login/ChangePasswordResponse.java | 1 - .../loginserverpackets/login/InitLS.java | 1 - .../loginserverpackets/login/KickPlayer.java | 2 - .../login/LoginServerFail.java | 2 - .../login/PlayerAuthResponse.java | 4 +- .../gameserver/script/DateRange.java | 8 +- .../gameserver/script/ScriptDocument.java | 2 - .../gameserver/script/ScriptEngine.java | 6 +- .../gameserver/taskmanager/Task.java | 1 - .../gameserver/taskmanager/TaskManager.java | 28 +++---- .../gameserver/util/FloodProtectorAction.java | 37 +++++---- .../l2jmobius/gameserver/util/GMAudit.java | 1 - .../gameserver/util/LinePointIterator.java | 23 +++--- .../gameserver/util/LinePointIterator3D.java | 37 +++++---- .../gameserver/util/PrimeFinder.java | 22 ++---- 713 files changed, 2432 insertions(+), 4262 deletions(-) rename L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/{datatables => data/xml/impl}/SkillData.java (94%) rename L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/{ExNpcQuestHtmlMessage.java => NpcQuestHtmlMessage.java} (88%) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/commons/util/DeadLockDetector.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/commons/util/DeadLockDetector.java index e9f16e2ccc..ad202531e4 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/commons/util/DeadLockDetector.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/commons/util/DeadLockDetector.java @@ -114,7 +114,7 @@ public class DeadLockDetector extends Thread } catch (Exception e) { - LOGGER.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "DeadLockDetector: ", e); } } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java index b0ac450a50..629fcee727 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java @@ -180,7 +180,7 @@ public class GameServer if (!IdFactory.getInstance().isInitialized()) { LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration."); - throw new Exception("Could not initialize the ID factory"); + throw new Exception("Could not initialize the ID factory!"); } // load script engines @@ -265,6 +265,7 @@ public class GameServer if (Config.PREMIUM_SYSTEM_ENABLED) { + LOGGER.info("PremiumManager: Premium system is enabled."); PremiumManager.getInstance(); } @@ -458,7 +459,7 @@ public class GameServer /*** Main ***/ // Create log folder - final File logFolder = new File(".", LOG_FOLDER); + final File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER); logFolder.mkdir(); // Create input stream for log file -- or store file data into memory diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java index a4fc1b00a2..75089ff0f6 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java @@ -87,7 +87,6 @@ public final class ItemsAutoDestroy ItemsOnGroundManager.getInstance().removeObject(item); } } - } } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/MonsterRace.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/MonsterRace.java index 6387c1c3c6..2cf628c10f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/MonsterRace.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/MonsterRace.java @@ -16,7 +16,6 @@ */ package com.l2jmobius.gameserver; -import java.lang.reflect.Constructor; import java.util.logging.Level; import java.util.logging.Logger; @@ -64,14 +63,12 @@ public class MonsterRace try { final L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random); - final Constructor constructor = Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0]; - _monsters[i] = (L2Npc) constructor.newInstance(template); + _monsters[i] = (L2Npc) Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0].newInstance(template); } catch (Exception e) { - LOGGER.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "Unable to create monster!", e); } - // LOGGER.info("Monster "+i+" is id: "+(id+random)); } newSpeeds(); } @@ -87,14 +84,7 @@ public class MonsterRace total = 0; for (int j = 0; j < 20; j++) { - if (j == 19) - { - _speeds[i][j] = 100; - } - else - { - _speeds[i][j] = Rnd.get(60) + 65; - } + _speeds[i][j] = j == 19 ? 100 : Rnd.get(60) + 65; total += _speeds[i][j]; } if (total >= _first[1]) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/RecipeController.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/RecipeController.java index 06c67d16e2..5bf504afb5 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/RecipeController.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/RecipeController.java @@ -60,6 +60,7 @@ public class RecipeController protected RecipeController() { + // Prevent external initialization. } public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft) @@ -336,7 +337,6 @@ public class RecipeController if (Config.ALT_GAME_CREATION && !_items.isEmpty()) { - if (!calculateStatUse(true, true)) { return; // check stat use diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java index 2e99f8f99f..547750542b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java @@ -263,11 +263,10 @@ public class Shutdown extends Thread try { DatabaseFactory.getInstance().close(); - LOGGER.info("L2Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); + LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); } catch (Throwable t) { - } // server will quit, when this function ends. @@ -536,9 +535,6 @@ public class Shutdown extends Thread } } - /* - * if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true); - */ final TimeCounter tc = new TimeCounter(); // Save all raidboss and GrandBoss status ^_^ @@ -590,7 +586,7 @@ public class Shutdown extends Thread if (Config.BOTREPORT_ENABLE) { BotReportTable.getInstance().saveReportedCharData(); - LOGGER.info("Bot Report Table: Sucessfully saved reports to database!"); + LOGGER.info("Bot Report Table: Successfully saved reports to database!"); } try diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/cache/HtmCache.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/cache/HtmCache.java index fec436d1fa..2da85f99ff 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/cache/HtmCache.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/cache/HtmCache.java @@ -43,7 +43,7 @@ public class HtmCache private static final Pattern ABSTRACT_BLOCK_PATTERN = Pattern.compile("", Pattern.DOTALL); private static final Pattern BLOCK_PATTERN = Pattern.compile("(.*?)", Pattern.DOTALL); - private final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); + private static final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); private int _loadedFiles; private long _bytesBuffLen; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java index 6a19cc7d31..3f98953c02 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java @@ -204,14 +204,7 @@ public class Forum public Forum getChildByName(String name) { vload(); - for (Forum f : _children) - { - if (f.getName().equals(name)) - { - return f; - } - } - return null; + return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null); } /** @@ -220,7 +213,6 @@ public class Forum public void rmTopicByID(int id) { _topic.remove(id); - } public void insertIntoDb() diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java index bc05a8ff5c..a4df772cc3 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java @@ -46,9 +46,7 @@ public class ForumsBBSManager extends BaseBBSManager { while (rs.next()) { - final int forumId = rs.getInt("forum_id"); - final Forum f = new Forum(forumId, null); - addForum(f); + addForum(new Forum(rs.getInt("forum_id"), null)); } } catch (Exception e) @@ -62,10 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager */ public void initRoot() { - for (Forum f : _table) - { - f.vload(); - } + _table.forEach(f -> f.vload()); _log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index 188d99945c..7d74ef6eb4 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import com.l2jmobius.gameserver.communitybbs.BB.Forum; import com.l2jmobius.gameserver.communitybbs.BB.Post; -import com.l2jmobius.gameserver.communitybbs.BB.Post.CPost; import com.l2jmobius.gameserver.communitybbs.BB.Topic; import com.l2jmobius.gameserver.handler.CommunityBoardHandler; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -68,21 +67,8 @@ public class PostBBSManager extends BaseBBSManager st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); final int idp = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } - + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind); } else if (command.startsWith("_bbsposts;edit;")) @@ -106,7 +92,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); if ((forum == null) || (topic == null) || (p == null)) { - CommunityBoardHandler.separateAndSend("

Error, this forum, topic or post does not exit !


", activeChar); + CommunityBoardHandler.separateAndSend("

Error, this forum, topic or post does not exist!


", activeChar); } else { @@ -118,7 +104,7 @@ public class PostBBSManager extends BaseBBSManager { if ((forum == null) || (topic == null)) { - CommunityBoardHandler.separateAndSend("

Error, this forum is not implemented yet


", activeChar); + CommunityBoardHandler.separateAndSend("

Error: This forum is not implemented yet!
", activeChar); } else if (forum.getType() == Forum.MEMO) { @@ -126,7 +112,7 @@ public class PostBBSManager extends BaseBBSManager } else { - CommunityBoardHandler.separateAndSend("

the forum: " + forum.getName() + " is not implemented yet


", activeChar); + CommunityBoardHandler.separateAndSend("

The forum: " + forum.getName() + " is not implemented yet!
", activeChar); } } @@ -139,7 +125,6 @@ public class PostBBSManager extends BaseBBSManager private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum) { - // final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); @@ -176,8 +161,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(t); if (p != null) { - final CPost cp = p.getCPost(idp); - if (cp == null) + if (p.getCPost(idp) == null) { CommunityBoardHandler.separateAndSend("

the post: " + idp + " does not exist !


", activeChar); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index db6e17a2b0..427f456b84 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -60,11 +60,7 @@ public class TopicBBSManager extends BaseBBSManager public int getMaxID(Forum f) { final Integer i = _maxId.get(f); - if (i == null) - { - return 0; - } - return i; + return i == null ? 0 : i; } public Topic getTopicByID(int idf) @@ -146,20 +142,8 @@ public class TopicBBSManager extends BaseBBSManager st.nextToken(); st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf); } else if (command.startsWith("_bbstopics;crea")) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java index d8dc164725..609f0858d5 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java @@ -170,12 +170,7 @@ public class CharNameTable public final int getAccessLevelById(int objectId) { - if (getNameById(objectId) != null) - { - return _accessLevels.get(objectId); - } - - return 0; + return getNameById(objectId) != null ? _accessLevels.get(objectId) : 0; } public synchronized boolean doesCharNameExist(String name) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java index df544c991d..6f2cf45ae6 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java @@ -66,7 +66,6 @@ import com.l2jmobius.gameserver.util.Util; public class ClanTable { private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName()); - private final Map _clans = new ConcurrentHashMap<>(); protected ClanTable() @@ -440,16 +439,13 @@ public class ClanTable for (L2Clan clan : _clans.values()) { final int allyId = clan.getAllyId(); - if ((allyId != 0) && (clan.getId() != allyId)) + if ((allyId != 0) && (clan.getId() != allyId) && !_clans.containsKey(allyId)) { - if (!_clans.containsKey(allyId)) - { - clan.setAllyId(0); - clan.setAllyName(null); - clan.changeAllyCrest(0, true); - clan.updateClanInDB(); - LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); - } + clan.setAllyId(0); + clan.setAllyName(null); + clan.changeAllyCrest(0, true); + clan.updateClanInDB(); + LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); } } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/EventDroplist.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/EventDroplist.java index c22e5eb0ee..ba8c26bbd8 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/EventDroplist.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/EventDroplist.java @@ -35,7 +35,7 @@ public class EventDroplist /** * The table containing all DataDrop object */ - private static final List _allNpcDateDrops = new CopyOnWriteArrayList<>(); + private static final List ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>(); public static class DateDrop { @@ -74,7 +74,7 @@ public class EventDroplist */ public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); } /** @@ -86,7 +86,7 @@ public class EventDroplist */ public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); } /** @@ -96,7 +96,7 @@ public class EventDroplist */ public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop) { - _allNpcDateDrops.add(new DateDrop(dateRange, eventDrop)); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, eventDrop)); } /** @@ -106,7 +106,7 @@ public class EventDroplist { final List list = new LinkedList<>(); final Date currentDate = new Date(); - for (DateDrop drop : _allNpcDateDrops) + for (DateDrop drop : ALL_NPC_DATE_DROPS) { if (drop._dateRange.isWithinRange(currentDate)) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/engines/DocumentBase.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/engines/DocumentBase.java index 0050c0a281..37410b0b38 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/engines/DocumentBase.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/engines/DocumentBase.java @@ -151,12 +151,11 @@ public abstract class DocumentBase protected final Logger _log = Logger.getLogger(getClass().getName()); private final File _file; - protected Map _tables; + protected final Map _tables = new HashMap<>(); protected DocumentBase(File pFile) { _file = pFile; - _tables = new HashMap<>(); } public Document parse() diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java index 0e3b945cf4..4d3be938c9 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java @@ -79,7 +79,6 @@ public final class DocumentItem extends DocumentBase implements IGameXmlReader { if ("list".equalsIgnoreCase(n.getNodeName())) { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("item".equalsIgnoreCase(d.getNodeName())) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/PlayerAction.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/PlayerAction.java index 95b3da5c8d..a9a2393db7 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/PlayerAction.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/PlayerAction.java @@ -30,7 +30,7 @@ public enum PlayerAction private PlayerAction() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/ShotType.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/ShotType.java index 2e98cb6d93..87e917b8bf 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/ShotType.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/enums/ShotType.java @@ -31,7 +31,7 @@ public enum ShotType private ShotType() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java index cb1452b64b..adf6462b78 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java @@ -34,8 +34,7 @@ public class AdminCommandHandler implements IHandler= FREE_OBJECT_ID_SIZE) { throw new NullPointerException("Ran out of valid Id's."); } + increaseBitSetCapacity(); } _nextFreeId.set(nextFree); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java index 6a3e232a26..002a6f75c3 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java @@ -316,7 +316,6 @@ public final class MapRegionManager implements IGameXmlReader return flags.stream().findAny().get().getLocation(); } } - } else if (fort != null) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java index 8f24f8dfc6..4e3abc79eb 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java @@ -191,7 +191,6 @@ public final class QuestManager { old.unload(); LOGGER.info("Replaced quest " + old.getName() + " (" + old.getId() + ") with a new version!"); - } if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java index e3235b056e..cd7118dc3b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java @@ -427,7 +427,7 @@ public final class SellBuffsManager implements IGameXmlReader } else if (player.isMounted() || player.isFlyingMounted() || player.isFlying()) { - player.sendMessage("You can't sell buffs in Mounth state!"); + player.sendMessage("You can't sell buffs in Mount state!"); return false; } else if (player.isTransformed()) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java index 70cfb5d922..5e16e5a91f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java @@ -71,9 +71,7 @@ public final class MessageDeletionTask implements Runnable final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId()); if (receiver != null) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME); - // sm.addString(msg.getReceiverName()); - receiver.sendPacket(sm); + receiver.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME)); } } catch (Exception e) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AbsorberInfo.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AbsorberInfo.java index d2ec54baa8..dc422d4013 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AbsorberInfo.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AbsorberInfo.java @@ -1,14 +1,12 @@ /* - * Copyright (C) 2004-2015 L2J Server + * This file is part of the L2J Mobius project. * - * This file is part of L2J Server. - * - * L2J Server is free software: you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * L2J Server is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. @@ -58,17 +56,7 @@ public final class AbsorberInfo implements IUniqueId @Override public final boolean equals(Object obj) { - if (this == obj) - { - return true; - } - - if (obj instanceof AbsorberInfo) - { - return (((AbsorberInfo) obj).getObjectId() == _objectId); - } - - return false; + return (this == obj) || ((obj instanceof AbsorberInfo) && (((AbsorberInfo) obj).getObjectId() == _objectId)); } @Override diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java index 43cf6815de..964757069c 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java @@ -78,7 +78,7 @@ public abstract class AbstractPlayerGroup */ public boolean isLeader(L2PcInstance player) { - return (getLeaderObjectId() == player.getObjectId()); + return getLeaderObjectId() == player.getObjectId(); } /** diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AggroInfo.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AggroInfo.java index 3be79b12bb..613e113b28 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AggroInfo.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/AggroInfo.java @@ -93,4 +93,10 @@ public final class AggroInfo { return _attacker.getObjectId(); } + + @Override + public String toString() + { + return "AggroInfo [attacker=" + _attacker + ", hate=" + _hate + ", damage=" + _damage + "]"; + } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/BlockList.java index 08918cc853..627b0dbbe4 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/BlockList.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/BlockList.java @@ -33,14 +33,10 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.BlockListPacket; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -/** - * This class ... - * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $ - */ public class BlockList { private static Logger _log = Logger.getLogger(BlockList.class.getName()); - private static Map> _offlineList = new ConcurrentHashMap<>(); + private static final Map> OFFLINE_LIST = new ConcurrentHashMap<>(); private final L2PcInstance _owner; private List _blockList; @@ -48,7 +44,7 @@ public class BlockList public BlockList(L2PcInstance owner) { _owner = owner; - _blockList = _offlineList.get(owner.getObjectId()); + _blockList = OFFLINE_LIST.get(owner.getObjectId()); if (_blockList == null) { _blockList = loadList(_owner.getObjectId()); @@ -69,7 +65,7 @@ public class BlockList public void playerLogout() { - _offlineList.put(_owner.getObjectId(), _blockList); + OFFLINE_LIST.put(_owner.getObjectId(), _blockList); } private static List loadList(int ObjId) @@ -263,10 +259,10 @@ public class BlockList { return BlockList.isBlocked(player, targetId); } - if (!_offlineList.containsKey(ownerId)) + if (!OFFLINE_LIST.containsKey(ownerId)) { - _offlineList.put(ownerId, loadList(ownerId)); + OFFLINE_LIST.put(ownerId, loadList(ownerId)); } - return _offlineList.get(ownerId).contains(targetId); + return OFFLINE_LIST.get(ownerId).contains(targetId); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java index ee640a3d9c..047d3d7074 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java @@ -49,17 +49,7 @@ public final class DamageDoneInfo @Override public final boolean equals(Object obj) { - if (this == obj) - { - return true; - } - - if (obj instanceof DamageDoneInfo) - { - return (((DamageDoneInfo) obj).getAttacker() == _attacker); - } - - return false; + return (this == obj) || ((obj instanceof DamageDoneInfo) && (((DamageDoneInfo) obj).getAttacker() == _attacker)); } @Override diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2AccessLevel.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2AccessLevel.java index a050f2f872..aefc7fb15d 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2AccessLevel.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2AccessLevel.java @@ -23,29 +23,19 @@ import com.l2jmobius.gameserver.data.xml.impl.AdminData; */ public class L2AccessLevel { - /** - * The access level
- */ + /** The access level. */ private int _accessLevel = 0; - /** - * The access level name
- */ + /** The access level name. */ private String _name = null; - /** Child access levels */ + /** Child access levels. */ L2AccessLevel _childsAccessLevel = null; - /** Child access levels */ + /** Child access levels. */ private int _child = 0; - /** - * The name color for the access level
- */ + /** The name color for the access level. */ private int _nameColor = 0; - /** - * The title color for the access level
- */ + /** The title color for the access level. */ private int _titleColor = 0; - /** - * Flag to determine if the access level has gm access
- */ + /** Flag to determine if the access level has GM access. */ private boolean _isGm = false; /** Flag for peace zone attack */ private boolean _allowPeaceAttack = false; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java index 1d1f8c517b..b69ba5f017 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -218,7 +218,7 @@ public class L2Clan implements IIdentifiable, INamable */ public int getLeaderId() { - return (_leader != null ? _leader.getObjectId() : 0); + return _leader != null ? _leader.getObjectId() : 0; } /** @@ -260,7 +260,6 @@ public class L2Clan implements IIdentifiable, INamable } exLeader.getClanPrivileges().clear(); exLeader.broadcastUserInfo(); - } else { @@ -377,6 +376,7 @@ public class L2Clan implements IIdentifiable, INamable player.setPledgeClass(L2ClanMember.calculatePledgeClass(player)); player.sendPacket(new PledgeShowMemberListUpdate(player)); player.sendPacket(new PledgeSkillList(this)); + addSkillEffects(player); // Notify to scripts @@ -1333,7 +1333,6 @@ public class L2Clan implements IIdentifiable, INamable Skill oldSkill = null; if (newSkill != null) { - if (subType == -2) { oldSkill = _skills.put(newSkill.getId(), newSkill); @@ -1792,12 +1791,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final SubPledge getSubPledge(int pledgeType) { - if (_subPledges == null) - { - return null; - } - - return _subPledges.get(pledgeType); + return _subPledges == null ? null : _subPledges.get(pledgeType); } /** @@ -1998,21 +1992,15 @@ public class L2Clan implements IIdentifiable, INamable public void initializePrivs() { - RankPrivs privs; for (int i = 1; i < 10; i++) { - privs = new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false)); - _privs.put(i, privs); + _privs.put(i, new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false))); } } public EnumIntBitmask getRankPrivs(int rank) { - if (_privs.get(rank) != null) - { - return _privs.get(rank).getPrivs(); - } - return new EnumIntBitmask<>(ClanPrivilege.class, false); + return _privs.get(rank) != null ? _privs.get(rank).getPrivs() : new EnumIntBitmask<>(ClanPrivilege.class, false); } public void setRankPrivs(int rank, int privs) @@ -2079,12 +2067,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final RankPrivs[] getAllRankPrivs() { - if (_privs == null) - { - return new RankPrivs[0]; - } - - return _privs.values().toArray(new RankPrivs[_privs.values().size()]); + return _privs == null ? new RankPrivs[0] : _privs.values().toArray(new RankPrivs[_privs.values().size()]); } public int getLeaderSubPledge(int leaderId) @@ -2416,13 +2399,10 @@ public class L2Clan implements IIdentifiable, INamable player.sendPacket(SystemMessageId.TO_CREATE_AN_ALLIANCE_YOUR_CLAN_MUST_BE_LEVEL_5_OR_HIGHER); return; } - if (getAllyPenaltyExpiryTime() > System.currentTimeMillis()) + if ((getAllyPenaltyExpiryTime() > System.currentTimeMillis()) && (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY)) { - if (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); - return; - } + player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); + return; } if (getDissolvingExpiryTime() > System.currentTimeMillis()) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ClanMember.java index daef76108a..7f0fa86028 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ClanMember.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ClanMember.java @@ -151,8 +151,8 @@ public class L2ClanMember } /** - * Checks if is online. - * @return true, if is online + * Verifies if the clan member is online. + * @return {@code true} if is online */ public boolean isOnline() { @@ -263,11 +263,7 @@ public class L2ClanMember */ public int getPowerGrade() { - if (_player != null) - { - return _player.getPowerGrade(); - } - return _powerGrade; + return _player != null ? _player.getPowerGrade() : _powerGrade; } /** @@ -323,11 +319,7 @@ public class L2ClanMember */ public int getRaceOrdinal() { - if (_player != null) - { - return _player.getRace().ordinal(); - } - return _raceOrdinal; + return _player != null ? _player.getRace().ordinal() : _raceOrdinal; } /** @@ -336,11 +328,7 @@ public class L2ClanMember */ public boolean getSex() { - if (_player != null) - { - return _player.getAppearance().getSex(); - } - return _sex; + return _player != null ? _player.getAppearance().getSex() : _sex; } /** @@ -349,11 +337,7 @@ public class L2ClanMember */ public int getSponsor() { - if (_player != null) - { - return _player.getSponsor(); - } - return _sponsor; + return _player != null ? _player.getSponsor() : _sponsor; } /** @@ -362,11 +346,7 @@ public class L2ClanMember */ public int getApprentice() { - if (_player != null) - { - return _player.getApprentice(); - } - return _apprentice; + return _player != null ? _player.getApprentice() : _apprentice; } /** diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2CommandChannel.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2CommandChannel.java index bb1b4b57c4..d91e7e0554 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2CommandChannel.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2CommandChannel.java @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class L2CommandChannel extends AbstractPlayerGroup { private final List _parties = new CopyOnWriteArrayList<>(); - private L2PcInstance _commandLeader = null; + private L2PcInstance _commandLeader; private int _channelLvl; /** diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java index 09025eeed1..f485978cf6 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java @@ -68,19 +68,11 @@ public class L2GroupSpawn extends L2Spawn final L2Npc mob = new L2ControllableMobInstance(_template); mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp()); - if (getHeading() == -1) - { - mob.setHeading(Rnd.nextInt(61794)); - } - else - { - mob.setHeading(getHeading()); - } + mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading()); mob.setSpawn(this); mob.spawnMe(newlocx, newlocy, newlocz); return mob; - } catch (Exception e) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java index 7875bdbb6a..905a58c1b8 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java @@ -35,7 +35,7 @@ public class L2NpcWalkerNode extends Location _delay = delay; _runToLocation = runToLocation; _npcString = npcString; - _chatString = ((chatText == null) ? "" : chatText); + _chatString = (chatText == null) ? "" : chatText; } public int getDelay() diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Object.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Object.java index 9164db110c..171ad1e543 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Object.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Object.java @@ -782,7 +782,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared) { final double distance = Math.pow(x - getX(), 2) + Math.pow(y - getY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0); - return (squared) ? distance : Math.sqrt(distance); + return squared ? distance : Math.sqrt(distance); } /** @@ -898,12 +898,12 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab @Override public boolean equals(Object obj) { - return ((obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId())); + return (obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId()); } @Override public String toString() { - return (getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"); + return getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"; } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java index 469b9843cc..c0fad148f8 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java @@ -53,5 +53,4 @@ public class L2RecipeInstance { return _quantity; } - } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java index ae06fa8c1b..c22321462d 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java @@ -55,5 +55,4 @@ public class L2RecipeStatInstance { return _value; } - } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Territory.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Territory.java index 5152d69c0d..41cb26df2b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Territory.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Territory.java @@ -16,8 +16,8 @@ */ package com.l2jmobius.gameserver.model; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Logger; import com.l2jmobius.commons.util.Rnd; @@ -44,7 +44,7 @@ public class L2Territory } } - private final List _points = new ArrayList<>(); + private final List _points = new CopyOnWriteArrayList<>(); private final int _terr; private int _xMin; private int _xMax; @@ -96,14 +96,6 @@ public class L2Territory _procMax += proc; } - public void print() - { - for (Point p : _points) - { - _log.info("(" + p._x + "," + p._y + ")"); - } - } - public boolean isIntersect(int x, int y, Point p1, Point p2) { final double dy1 = p1._y - y; @@ -163,7 +155,6 @@ public class L2Territory return new Location(p1._x, p1._y, Rnd.get(p1._zmin, p1._zmax)); } } - } for (int i = 0; i < 100; i++) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2World.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2World.java index 805e0c0ed2..9b02364b07 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2World.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2World.java @@ -282,20 +282,20 @@ public final class L2World } /** - * Add a L2Object in the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
- * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Add a L2Object in the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
+ * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Add the L2Object object in _allPlayers* of L2World
  • *
  • Add the L2Object object in _gmList** of GmListTable
  • - *
  • Add object in _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding PlayerInstance in its _knownPlayer

  • - * * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of WorldRegion (need synchronisation)
    + *
  • Add object in _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding L2PcInstance in its _knownPlayer

  • + * * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of L2WorldRegion (need synchronisation)
    * Caution : This method DOESN'T ADD the object to _allObjects and _allPlayers* of L2World (need synchronisation) Example of use : *
  • Drop an Item
  • *
  • Spawn a L2Character
  • - *
  • Apply Death Penalty of a PlayerInstance
  • + *
  • Apply Death Penalty of a L2PcInstance
  • * @param object L2object to add in the world - * @param newRegion WorldRegion in wich the object will be add (not used) + * @param newRegion L2WorldRegion in wich the object will be add (not used) */ public void addVisibleObject(L2Object object, L2WorldRegion newRegion) { @@ -371,18 +371,18 @@ public final class L2World } /** - * Remove a L2Object from the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Remove a L2Object from the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Remove the L2Object object from _allPlayers* of L2World
  • - *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of WorldRegion
  • + *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of L2WorldRegion
  • *
  • Remove the L2Object object from _gmList** of GmListTable
  • - *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all PlayerInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Example of use : + *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all L2PcInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Example of use : *
  • Pickup an Item
  • *
  • Decay a L2Character
  • * @param object L2object to remove from the world - * @param oldRegion WorldRegion in which the object was before removing + * @param oldRegion L2WorldRegion in which the object was before removing */ public void removeVisibleObject(L2Object object, L2WorldRegion oldRegion) { @@ -395,7 +395,7 @@ public final class L2World { oldRegion.removeVisibleObject(object); - // Go through all surrounding WorldRegion Creatures + // Go through all surrounding L2WorldRegion L2Characters oldRegion.forEachSurroundingRegion(w -> { for (L2Object wo : w.getVisibleObjects().values()) @@ -714,7 +714,7 @@ public final class L2World } /** - * Calculate the current WorldRegions of the object according to its position (x,y). Example of use : + * Calculate the current L2WorldRegions of the object according to its position (x,y). Example of use : *
  • Set position of a new L2Object (drop, spawn...)
  • *
  • Update position of a L2Object after a movement

  • * @param point position of the object @@ -749,12 +749,12 @@ public final class L2World } /** - * Check if the current WorldRegions of the object is valid according to its position (x,y). Example of use : - *
  • Init WorldRegions

  • + * Check if the current L2WorldRegions of the object is valid according to its position (x,y). Example of use : + *
  • Init L2WorldRegions

  • * @param x X position of the object * @param y Y position of the object * @param z Z position of the object - * @return True if the WorldRegion is valid + * @return True if the L2WorldRegion is valid */ public static boolean validRegion(int x, int y, int z) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 6bfaf3a33d..97608b326d 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -136,7 +136,6 @@ public final class L2WorldRegion } LOGGER.finer(c + " mobs were turned on"); } - } public boolean isActive() diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MobGroup.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MobGroup.java index 88cc4a5599..4eb38cf27b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MobGroup.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MobGroup.java @@ -191,8 +191,7 @@ public final class MobGroup final int y = player.getY() + Rnd.nextInt(50); mobInst.teleToLocation(new Location(x, y, player.getZ()), true); - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(player); + ((L2ControllableMobAI) mobInst.getAI()).follow(player); } } } @@ -294,8 +293,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.forceAttack(target); + ((L2ControllableMobAI) mobInst.getAI()).forceAttack(target); } } @@ -310,8 +308,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.stop(); + ((L2ControllableMobAI) mobInst.getAI()).stop(); } } @@ -347,8 +344,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(character); + ((L2ControllableMobAI) mobInst.getAI()).follow(character); } } @@ -363,8 +359,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setAlternateAI(L2ControllableMobAI.AI_CAST); + ((L2ControllableMobAI) mobInst.getAI()).setAlternateAI(L2ControllableMobAI.AI_CAST); } } @@ -379,8 +374,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setNotMoving(enabled); + ((L2ControllableMobAI) mobInst.getAI()).setNotMoving(enabled); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MobGroupTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MobGroupTable.java index db0a789765..da1b620a40 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MobGroupTable.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MobGroupTable.java @@ -75,7 +75,7 @@ public class MobGroupTable public boolean removeGroup(int groupKey) { - return (_groupMap.remove(groupKey) != null); + return _groupMap.remove(groupKey) != null; } private static class SingletonHolder diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/Petition.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/Petition.java index 8596c3ea61..cbed80441a 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/Petition.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/Petition.java @@ -98,7 +98,7 @@ public final class Petition } PetitionManager.getInstance().getCompletedPetitions().put(getId(), this); - return (PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null); + return PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null; } public String getContent() diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ShortCuts.java index 2bbf25dee0..3f8d959ef6 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ShortCuts.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ShortCuts.java @@ -55,13 +55,10 @@ public class ShortCuts implements IRestorable { Shortcut sc = _shortCuts.get(slot + (page * MAX_SHORTCUTS_PER_BAR)); // Verify shortcut - if ((sc != null) && (sc.getType() == ShortcutType.ITEM)) + if ((sc != null) && (sc.getType() == ShortcutType.ITEM) && (_owner.getInventory().getItemByObjectId(sc.getId()) == null)) { - if (_owner.getInventory().getItemByObjectId(sc.getId()) == null) - { - deleteShortCut(sc.getSlot(), sc.getPage()); - sc = null; - } + deleteShortCut(sc.getSlot(), sc.getPage()); + sc = null; } return sc; } @@ -78,8 +75,7 @@ public class ShortCuts implements IRestorable } shortcut.setSharedReuseGroup(item.getSharedReuseGroup()); } - final Shortcut oldShortCut = _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut); - registerShortCutInDb(shortcut, oldShortCut); + registerShortCutInDb(shortcut, _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut)); } private void registerShortCutInDb(Shortcut shortcut, Shortcut oldShortCut) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/TradeList.java index 29362b8549..eeee7d0cae 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/TradeList.java @@ -149,11 +149,7 @@ public class TradeList { if (exclItem.getItem().getId() == item.getId()) { - if (item.getCount() <= exclItem.getCount()) - { - return null; - } - return new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice()); + return item.getCount() <= exclItem.getCount() ? null : new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice()); } } } @@ -440,11 +436,7 @@ public class TradeList { partnerList.lock(); lock(); - if (!partnerList.validate()) - { - return false; - } - if (!validate()) + if (!partnerList.validate() || !validate()) { return false; } @@ -616,12 +608,12 @@ public class TradeList boolean success = false; // check weight and slots - if ((!getOwner().getInventory().validateWeight(partnerList.calcItemsWeight())) || !(partnerList.getOwner().getInventory().validateWeight(calcItemsWeight()))) + if (!getOwner().getInventory().validateWeight(partnerList.calcItemsWeight()) || !partnerList.getOwner().getInventory().validateWeight(calcItemsWeight())) { partnerList.getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT); getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT); } - else if ((!getOwner().getInventory().validateCapacity(partnerList.countItemsSlots(getOwner()))) || (!partnerList.getOwner().getInventory().validateCapacity(countItemsSlots(partnerList.getOwner())))) + else if (!getOwner().getInventory().validateCapacity(partnerList.countItemsSlots(getOwner())) || !partnerList.getOwner().getInventory().validateCapacity(countItemsSlots(partnerList.getOwner()))) { partnerList.getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL); getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL); @@ -846,42 +838,36 @@ public class TradeList } // Send messages about the transaction to both players + SystemMessage msg; if (newItem.isStackable()) { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); + msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); msg.addString(player.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); msg.addString(_owner.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); - player.sendPacket(msg); } else { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); + msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); msg.addString(player.getName()); msg.addItemName(newItem); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); msg.addString(_owner.getName()); msg.addItemName(newItem); - player.sendPacket(msg); } + player.sendPacket(msg); } // Send inventory update packet _owner.sendInventoryUpdate(ownerIU); player.sendInventoryUpdate(playerIU); - if (ok) - { - return 0; - } - return 2; + return ok ? 0 : 2; } /** @@ -892,12 +878,7 @@ public class TradeList */ public synchronized boolean privateStoreSell(L2PcInstance player, ItemRequest[] requestedItems) { - if (_locked) - { - return false; - } - - if (!_owner.isOnline() || !player.isOnline()) + if (_locked || !_owner.isOnline() || !player.isOnline()) { return false; } @@ -1037,32 +1018,30 @@ public class TradeList } // Send messages about the transaction to both players + SystemMessage msg; if (newItem.isStackable()) { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); + msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); msg.addString(player.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); msg.addString(_owner.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); - player.sendPacket(msg); } else { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); + msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); msg.addString(player.getName()); msg.addItemName(newItem); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); msg.addString(_owner.getName()); msg.addItemName(newItem); - player.sendPacket(msg); } + player.sendPacket(msg); } if (totalPrice > 0) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java index d77bf6af86..6892d0798a 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java @@ -454,21 +454,18 @@ public final class BlockCheckerEngine switch (_round) { - case 1: + case 1: // Schedule second spawn round { - // Schedule second spawn round _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); break; } - case 2: + case 2: // Schedule third spawn round { - // Schedule third spawn round _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); break; } - case 3: + case 3: // Schedule Event End Count Down { - // Schedule Event End Count Down _task = ThreadPool.schedule(new EndEvent(), 180000); break; } @@ -572,7 +569,7 @@ public final class BlockCheckerEngine /* * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_WILL_END_IN_5_SECONDS)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } + * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } */ /** @@ -652,7 +649,7 @@ public final class BlockCheckerEngine } /** - * Reward the speicifed team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra + * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra * @param isRed */ private void rewardAsWinner(boolean isRed) @@ -714,8 +711,7 @@ public final class BlockCheckerEngine */ private void rewardAsLooser(boolean isRed) { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - for (Entry entry : tempPoints.entrySet()) + for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) { final L2PcInstance player = entry.getKey(); if ((player != null) && (entry.getValue() >= 10)) @@ -726,7 +722,7 @@ public final class BlockCheckerEngine } /** - * Telport players back, give status back and send final packet + * Teleport players back, give status back and send final packet */ private void setPlayersBack() { @@ -748,13 +744,11 @@ public final class BlockCheckerEngine final PcInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); } if (inv.getItemByItemId(13788) != null) { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); } broadcastRelationChanged(player); // Teleport Back diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Couple.java index 7901689adf..c31232e232 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Couple.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Couple.java @@ -99,7 +99,7 @@ public class Couple } catch (Exception e) { - _log.log(Level.SEVERE, "Could not create couple:", e); + _log.log(Level.SEVERE, "Could not create couple: " + e.getMessage(), e); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java index e9b3160a50..75ec9236b8 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -192,12 +192,7 @@ public final class Fort extends AbstractResidence } if ((getOwnerClan().getWarehouse().getAdena() >= _fee) || !_cwh) { - int fee = _fee; - if (getEndTime() == -1) - { - fee = _tempFee; - } - + final int fee = getEndTime() == -1 ? _tempFee : _fee; setEndTime(System.currentTimeMillis() + getRate()); dbSave(); if (_cwh) @@ -549,7 +544,6 @@ public final class Fort extends AbstractResidence if (door != null) { door.setCurrentHp(door.getMaxHp() + hp); - saveDoorUpgrade(doorId, hp, pDef, mDef); } } @@ -589,7 +583,7 @@ public final class Fort extends AbstractResidence long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis(); while (initial > (Config.FS_UPDATE_FRQ * 60000L)) { - initial -= (Config.FS_UPDATE_FRQ * 60000L); + initial -= Config.FS_UPDATE_FRQ * 60000L; } initial = (Config.FS_UPDATE_FRQ * 60000L) - initial; if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600))) @@ -609,7 +603,6 @@ public final class Fort extends AbstractResidence { setOwnerClan(null); } - } catch (Exception e) { @@ -675,12 +668,9 @@ public final class Fort extends AbstractResidence { return false; } - if (lease > 0) + if ((lease > 0) && !player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) { - if (!player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) - { - return false; - } + return false; } if (addNew) { @@ -690,20 +680,16 @@ public final class Fort extends AbstractResidence { removeFunction(type); } + else if ((lease - _function.get(type).getLease()) > 0) + { + _function.remove(type); + _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); + } else { - final int diffLease = lease - _function.get(type).getLease(); - if (diffLease > 0) - { - _function.remove(type); - _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); - } - else - { - _function.get(type).setLease(lease); - _function.get(type).setLvl(lvl); - _function.get(type).dbSave(); - } + _function.get(type).setLease(lease); + _function.get(type).setLvl(lvl); + _function.get(type).dbSave(); } return true; } @@ -934,31 +920,17 @@ public final class Fort extends AbstractResidence public final int getOwnedTime() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); } public final int getTimeTillRebelArmy() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); } public final long getTimeTillNextFortUpdate() { - if (_FortUpdater[0] == null) - { - return 0; - } - return _FortUpdater[0].getDelay(TimeUnit.SECONDS); + return _FortUpdater[0] == null ? 0 : _FortUpdater[0].getDelay(TimeUnit.SECONDS); } public void updateClansReputation(L2Clan owner, boolean removePoints) @@ -999,7 +971,6 @@ public final class Fort extends AbstractResidence _log.log(Level.WARNING, "Exception in endFortressSiege " + e.getMessage(), e); } } - } /** diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/L2Event.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/L2Event.java index ad93bd97a4..be28d47897 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/L2Event.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/L2Event.java @@ -46,7 +46,8 @@ import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse; import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; /** - * @since $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $ This ancient thingie got reworked by Nik at $Date: 2011/05/17 21:51:39 $ Yeah, for 6 years no one bothered reworking this buggy event engine. + * @author Nik + * @Since 2011/05/17 21:51:39 */ public class L2Event { @@ -164,7 +165,6 @@ public class L2Event try { final L2Spawn spawn = new L2Spawn(_npcId); - spawn.setX(target.getX() + 50); spawn.setY(target.getY() + 50); spawn.setZ(target.getZ()); @@ -184,13 +184,11 @@ public class L2Event spawn.getLastSpawn().broadcastPacket(new MagicSkillUse(spawn.getLastSpawn(), spawn.getLastSpawn(), 1034, 1, 1, 1)); // _npcs.add(spawn.getLastSpawn()); - } catch (Exception e) { _log.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e); } - } /** @@ -274,7 +272,6 @@ public class L2Event */ public static void removeAndResetPlayer(L2PcInstance player) { - try { if (isParticipant(player)) @@ -475,7 +472,6 @@ public class L2Event biggestLvlPlayer.setEventStatus(); i = (i + 1) % _teamsNumber; } - } catch (Exception e) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java index 64f1bd2117..08f8d8f701 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java @@ -30,7 +30,7 @@ public final class InstanceReenterTimeHolder private int _minute = -1; private long _time = -1; - public InstanceReenterTimeHolder(int time) + public InstanceReenterTimeHolder(long time) { _time = TimeUnit.MINUTES.toMillis(time); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java index ee59be43a2..03514cc06f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java @@ -45,5 +45,4 @@ public interface IParserAdvUtils extends IParserUtils Duration getDuration(String key); > T getEnum(String key, Class clazz); - } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java index 3930368188..f97917af4f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java @@ -62,7 +62,7 @@ public final class ClanWarehouse extends Warehouse @Override public boolean validateCapacity(long slots) { - return ((_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN); + return (_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN; } @Override diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 344a7e4415..de53a8d9da 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -1795,7 +1795,7 @@ public final class L2ItemInstance extends L2Object public boolean isTimeLimitedItem() { - return (_time > 0); + return _time > 0; } /** diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java index a4d6c7d9db..2d9fc312b0 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java @@ -49,5 +49,5 @@ public enum MaterialType FISH, RUNE_XP, RUNE_SP, - RUNE_REMOVE_PENALTY + RUNE_REMOVE_PENALTY; } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/Quest.java index 7eff40bff6..a462adcc3a 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/Quest.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/Quest.java @@ -153,7 +153,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ protected void onLoad() { - } /** @@ -164,7 +163,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onSave() { - } /** @@ -1054,7 +1052,7 @@ public class Quest extends AbstractScript implements IIdentifiable */ public String onDeath(L2Character killer, L2Character victim, QuestState qs) { - return onAdvEvent("", ((killer instanceof L2Npc) ? ((L2Npc) killer) : null), qs.getPlayer()); + return onAdvEvent("", (killer instanceof L2Npc) ? (L2Npc) killer : null, qs.getPlayer()); } /** @@ -1387,7 +1385,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) { - } /** @@ -1397,7 +1394,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadLose(L2PcInstance loser, CompetitionType type) { - } /** @@ -1406,7 +1402,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onMoveFinished(L2Npc npc) { - } /** @@ -1415,7 +1410,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onNodeArrived(L2Npc npc) { - } /** @@ -1424,7 +1418,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onRouteFinished(L2Npc npc) { - } /** @@ -2622,11 +2615,7 @@ public class Quest extends AbstractScript implements IIdentifiable } } } - if ((luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc)) - { - return luckyPlayer; - } - return null; + return (luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc) ? luckyPlayer : null; } /** @@ -2661,15 +2650,7 @@ public class Quest extends AbstractScript implements IIdentifiable QuestState qs = player.getQuestState(getName()); if (!player.isInParty()) { - if (!checkPartyMemberConditions(qs, condition, target)) - { - return null; - } - if (!checkDistanceToTarget(player, target)) - { - return null; - } - return qs; + return !checkPartyMemberConditions(qs, condition, target) || !checkDistanceToTarget(player, target) ? null : qs; } final List candidates = new ArrayList<>(); @@ -2701,21 +2682,17 @@ public class Quest extends AbstractScript implements IIdentifiable } qs = candidates.get(getRandom(candidates.size())); - if (!checkDistanceToTarget(qs.getPlayer(), target)) - { - return null; - } - return qs; + return !checkDistanceToTarget(qs.getPlayer(), target) ? null : qs; } private boolean checkPartyMemberConditions(QuestState qs, int condition, L2Npc npc) { - return ((qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc)); + return (qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc); } private static boolean checkDistanceToTarget(L2PcInstance player, L2Npc target) { - return ((target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true)); + return (target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true); } /** @@ -2823,7 +2800,7 @@ public class Quest extends AbstractScript implements IIdentifiable { for (int id : items) { - if (ItemTable.getInstance().getTemplate(id) == null) + if ((id != 0) && (ItemTable.getInstance().getTemplate(id) == null)) { _log.severe(super.getClass().getSimpleName() + ": Found registerQuestItems for non existing item: " + id + "!"); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/QuestState.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/QuestState.java index abf9825d8e..23c0acc8d1 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/QuestState.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/QuestState.java @@ -114,7 +114,7 @@ public final class QuestState */ public boolean isCreated() { - return (_state == State.CREATED); + return _state == State.CREATED; } /** @@ -123,7 +123,7 @@ public final class QuestState */ public boolean isStarted() { - return (_state == State.STARTED); + return _state == State.STARTED; } /** @@ -132,7 +132,7 @@ public final class QuestState */ public boolean isCompleted() { - return (_state == State.COMPLETED); + return _state == State.COMPLETED; } /** @@ -340,10 +340,10 @@ public final class QuestState // since no flag had been skipped until now, the least significant bits must all // be set to 1, up until "old" number of bits. - completedStateFlags |= ((1 << old) - 1); + completedStateFlags |= (1 << old) - 1; // now, just set the bit corresponding to the passed cond to 1 (current step) - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } } @@ -352,7 +352,7 @@ public final class QuestState else if (cond < old) { // note, this also unsets the flag indicating that there exist skips - completedStateFlags &= ((1 << cond) - 1); + completedStateFlags &= (1 << cond) - 1; // now, check if this resulted in no steps being skipped any more if (completedStateFlags == ((1 << cond) - 1)) @@ -372,7 +372,7 @@ public final class QuestState // Just mark this state and we are done. else { - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } @@ -463,7 +463,7 @@ public final class QuestState */ public boolean isCond(int condition) { - return (getInt("cond") == condition); + return getInt("cond") == condition; } /** @@ -523,7 +523,7 @@ public final class QuestState */ public boolean isSet(String variable) { - return (get(variable) != null); + return get(variable) != null; } /** @@ -578,7 +578,7 @@ public final class QuestState public boolean isMemoState(int memoState) { - return (getInt("memoState") == memoState); + return getInt("memoState") == memoState; } /** @@ -823,7 +823,7 @@ public final class QuestState public boolean isNowAvailable() { final String val = get("restartTime"); - return (val != null) && (!Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis())); + return (val == null) || !Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis()); } public void setSimulated(boolean simulated) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/TraitType.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/TraitType.java index e7a799703d..890e7b48b8 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/TraitType.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/stats/TraitType.java @@ -83,7 +83,7 @@ public enum TraitType { _type = type; } - + public int getType() { return _type; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java index 4433e97b28..f431bdab71 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java @@ -49,13 +49,13 @@ public class ZoneCuboid extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_r.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _r.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -65,9 +65,9 @@ public class ZoneCuboid extends L2ZoneForm final int _x2 = _r.x + _r.width; final int _y1 = _r.y; final int _y2 = _r.y + _r.height; - double test, shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); + double test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); + double shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); - test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); if (test < shortestDist) { shortestDist = test; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java index afdfd3fade..5f3b143379 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java @@ -43,11 +43,7 @@ public class ZoneCylinder extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - if (((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) > _radS) || (z < _z1) || (z > _z2)) - { - return false; - } - return true; + return ((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) <= _radS) && (z >= _z1) && (z <= _z2); } @Override @@ -130,9 +126,7 @@ public class ZoneCylinder extends L2ZoneForm final double angle = (2 * Math.PI) / count; for (int i = 0; i < count; i++) { - final int x = (int) (Math.cos(angle * i) * _rad); - final int y = (int) (Math.sin(angle * i) * _rad); - dropDebugItem(Inventory.ADENA_ID, 1, _x + x, _y + y, z); + dropDebugItem(Inventory.ADENA_ID, 1, _x + (int) (Math.cos(angle * i) * _rad), _y + (int) (Math.sin(angle * i) * _rad), z); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java index 2340c1b218..d1ef507961 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java @@ -51,13 +51,13 @@ public class ZoneNPoly extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_p.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _p.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -95,25 +95,15 @@ public class ZoneNPoly extends L2ZoneForm @Override public void visualizeZone(int z) { - final int[] _x = _p.xpoints; - final int[] _y = _p.ypoints; - for (int i = 0; i < _p.npoints; i++) { - int nextIndex = i + 1; - // ending point to first one - if (nextIndex == _x.length) - { - nextIndex = 0; - } - final int vx = _x[nextIndex] - _x[i]; - final int vy = _y[nextIndex] - _y[i]; - float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)); - lenght /= STEP; + final int nextIndex = (i + 1) == _p.xpoints.length ? 0 : i + 1; + final int vx = _p.xpoints[nextIndex] - _p.xpoints[i]; + final int vy = _p.ypoints[nextIndex] - _p.ypoints[i]; + final float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)) / STEP; for (int o = 1; o <= lenght; o++) { - final float k = o / lenght; - dropDebugItem(Inventory.ADENA_ID, 1, (int) (_x[i] + (k * vx)), (int) (_y[i] + (k * vy)), z); + dropDebugItem(Inventory.ADENA_ID, 1, (int) (_p.xpoints[i] + ((o / lenght) * vx)), (int) (_p.ypoints[i] + ((o / lenght) * vy)), z); } } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java index 09ea4b531a..904a7f2919 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public final class L2CastleZone extends L2ResidenceZone { - public L2CastleZone(int id) { super(id); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java index ec9a75b975..a1a99b7051 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java @@ -99,7 +99,7 @@ public class L2NoRestartZone extends L2ZoneType return; } - if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.getInstance().getStartedTime()) > getRestartAllowedTime())) + if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis()) > getRestartAllowedTime())) { player.teleToLocation(TeleportWhereType.TOWN); } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java index 45e377e22a..b3b1c77f42 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java @@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public class L2NoSummonFriendZone extends L2ZoneType { - public L2NoSummonFriendZone(int id) { super(id); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java index cb7760aee0..9ab43dd1cd 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java @@ -71,12 +71,7 @@ public class L2ResidenceHallTeleportZone extends L2ResidenceTeleportZone @Override public void run() { - int index = 0; - if (getSpawns().size() > 1) - { - index = Rnd.get(getSpawns().size()); - } - + final int index = getSpawns().size() > 1 ? Rnd.get(getSpawns().size()) : 0; final Location loc = getSpawns().get(index); if (loc == null) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java index e63f1883f1..46037463d5 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java @@ -26,7 +26,6 @@ public class BlowFishKeygen { private static final int CRYPT_KEYS_SIZE = 20; private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16]; - static { // init the GS encryption keys on class load @@ -54,7 +53,6 @@ public class BlowFishKeygen // block instantiation private BlowFishKeygen() { - } /** diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/IncomingPackets.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/IncomingPackets.java index 98362130f8..85b3fad9fd 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/IncomingPackets.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/IncomingPackets.java @@ -208,7 +208,6 @@ public enum IncomingPackets implements IIncomingPackets EX_PACKET(0xD0, ExPacket::new, ConnectionState.values()); // This packet has its own connection state checking so we allow all of them public static final IncomingPackets[] PACKET_ARRAY; - static { final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java index 8681078d71..cf476ab880 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java @@ -56,5 +56,4 @@ public class AuthRequest extends BaseSendablePacket { return getBytes(); } - } \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java index 69264263b4..2603512fdf 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java @@ -25,7 +25,6 @@ import com.l2jmobius.commons.network.BaseSendablePacket; */ public class ReplyCharacters extends BaseSendablePacket { - public ReplyCharacters(String account, int chars, List timeToDel) { writeC(0x08); @@ -43,5 +42,4 @@ public class ReplyCharacters extends BaseSendablePacket { return getBytes(); } - } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java index 113caaea70..ed3375e8d2 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class AuthResponse extends BaseRecievePacket { - private final int _serverId; private final String _serverName; @@ -52,5 +51,4 @@ public class AuthResponse extends BaseRecievePacket { return _serverName; } - } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java index 6945db648c..721ff58f8e 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java @@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; public class ChangePasswordResponse extends BaseRecievePacket { - public ChangePasswordResponse(byte[] decrypt) { super(decrypt); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java index d937c4762e..6f43b2976d 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java @@ -43,5 +43,4 @@ public class InitLS extends BaseRecievePacket final int size = readD(); _key = readB(size); } - } \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java index fe2c0b2d88..bbf888d495 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class KickPlayer extends BaseRecievePacket { - private final String _account; /** @@ -39,5 +38,4 @@ public class KickPlayer extends BaseRecievePacket { return _account; } - } \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java index f50e7a95e6..ae76f77fb7 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class LoginServerFail extends BaseRecievePacket { - private static final String[] REASONS = { "None", @@ -52,5 +51,4 @@ public class LoginServerFail extends BaseRecievePacket { return _reason; } - } \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java index a87742fab7..c747b9bb56 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class PlayerAuthResponse extends BaseRecievePacket { - private final String _account; private final boolean _authed; @@ -35,7 +34,7 @@ public class PlayerAuthResponse extends BaseRecievePacket super(decrypt); _account = readS(); - _authed = (readC() != 0); + _authed = readC() != 0; } /** @@ -53,5 +52,4 @@ public class PlayerAuthResponse extends BaseRecievePacket { return _authed; } - } \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/DateRange.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/DateRange.java index e825d08b90..3b8acae352 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/DateRange.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/DateRange.java @@ -43,10 +43,7 @@ public class DateRange { try { - final Date start = format.parse(date[0]); - final Date end = format.parse(date[1]); - - return new DateRange(start, end); + return new DateRange(format.parse(date[0]), format.parse(date[1])); } catch (ParseException e) { @@ -63,7 +60,8 @@ public class DateRange public boolean isWithinRange(Date date) { - return date.after(_startDate) && date.before(_endDate); + return (date.equals(_startDate) || date.after(_startDate)) // + && (date.equals(_endDate) || date.before(_endDate)); } public Date getEndDate() diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/ScriptDocument.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/ScriptDocument.java index 00b292822c..eacfe5baf8 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/ScriptDocument.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/ScriptDocument.java @@ -63,7 +63,6 @@ public class ScriptDocument { // Parser with specified options can't be built _log.log(Level.WARNING, "", pce); - } catch (IOException ioe) { @@ -90,5 +89,4 @@ public class ScriptDocument { return _name; } - } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/ScriptEngine.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/ScriptEngine.java index 41525b111f..bdef90d7b6 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/ScriptEngine.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/script/ScriptEngine.java @@ -41,16 +41,16 @@ public class ScriptEngine s = parserFactories.get(name); if (s == null) // if the shape factory is not there even now { - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } catch (ClassNotFoundException e) { // We'll throw an exception to indicate that // the shape could not be created - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } - return (s.create()); + return s.create(); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/Task.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/Task.java index ecbef18add..d76a02c101 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/Task.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/Task.java @@ -43,6 +43,5 @@ public abstract class Task public void onDestroy() { - } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java index 7f86a2bfb3..6b73502977 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java @@ -104,7 +104,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.warning("Cannot updated the Global Task " + id + ": " + e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Cannot updated the Global Task " + id + ": " + e.getMessage(), e); } if ((type == TYPE_SHEDULED) || (type == TYPE_TIME)) @@ -116,15 +116,7 @@ public final class TaskManager @Override public boolean equals(Object object) { - if (this == object) - { - return true; - } - if (!(object instanceof ExecutedTask)) - { - return false; - } - return id == ((ExecutedTask) object).id; + return (this == object) || ((object instanceof ExecutedTask) && (id == ((ExecutedTask) object).id)); } @Override @@ -169,7 +161,6 @@ public final class TaskManager _currentTasks.remove(this); } - } private void initializate() @@ -182,8 +173,7 @@ public final class TaskManager public void registerTask(Task task) { - final int key = task.getName().hashCode(); - _tasks.computeIfAbsent(key, k -> + _tasks.computeIfAbsent(task.getName().hashCode(), k -> { task.initializate(); return task; @@ -217,7 +207,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.SEVERE, "Error while loading Global Task table: ", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error while loading Global Task table: " + e.getMessage(), e); } } @@ -256,7 +246,7 @@ public final class TaskManager task.scheduled = ThreadPool.schedule(task, diff); return true; } - LOGGER.info("Task " + task.getId() + " is obsoleted."); + LOGGER.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted."); } catch (Exception e) { @@ -280,7 +270,7 @@ public final class TaskManager if (hour.length != 3) { - LOGGER.warning("Task " + task.getId() + " has incorrect parameters"); + LOGGER.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters"); return false; } @@ -296,7 +286,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.WARNING, "Bad parameter on task " + task.getId() + ": ", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Bad parameter on task " + task.getId() + ": " + e.getMessage(), e); return false; } @@ -348,7 +338,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the unique task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the unique task: " + e.getMessage(), e); } return false; } @@ -374,7 +364,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the task: " + e.getMessage(), e); } return false; } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java index e23716eba1..f005fca2ea 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java @@ -94,7 +94,7 @@ public final class FloodProtectorAction if ((curTick < _nextGameTick) || _punishmentInProgress) { - if (_config.LOG_FLOODING && !_logged && (_log.getLevel() == Level.WARNING)) + if (_config.LOG_FLOODING && !_logged && _log.isLoggable(Level.WARNING)) { log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeController.MILLIS_IN_TICK), " ms after previous command"); _logged = true; @@ -124,12 +124,9 @@ public final class FloodProtectorAction return false; } - if (_count.get() > 0) + if ((_count.get() > 0) && _config.LOG_FLOODING && _log.isLoggable(Level.WARNING)) { - if (_config.LOG_FLOODING && (_log.getLevel() == Level.WARNING)) - { - log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); - } + log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); } _nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL; @@ -145,7 +142,7 @@ public final class FloodProtectorAction { Disconnection.of(_client).defaultSequence(false); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log("kicked for flooding"); } @@ -157,7 +154,7 @@ public final class FloodProtectorAction private void banAccount() { PunishmentManager.getInstance().startPunishment(new PunishmentTask(_client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log(" banned for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } @@ -168,18 +165,20 @@ public final class FloodProtectorAction */ private void jailChar() { - if (_client.getActiveChar() != null) + if (_client.getActiveChar() == null) { - final int charId = _client.getActiveChar().getObjectId(); - if (charId > 0) - { - PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - } - - if (_log.getLevel() == Level.WARNING) - { - log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); - } + return; + } + + final int charId = _client.getActiveChar().getObjectId(); + if (charId > 0) + { + PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); + } + + if (_log.isLoggable(Level.WARNING)) + { + log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/GMAudit.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/GMAudit.java index ab7aa87ed6..c2ee25069b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/GMAudit.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/GMAudit.java @@ -32,7 +32,6 @@ import com.l2jmobius.Config; public class GMAudit { private static final Logger _log = Logger.getLogger(GMAudit.class.getName()); - static { new File("log/GMAudit").mkdirs(); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/LinePointIterator.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/LinePointIterator.java index 2208c5092d..168255fafd 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/LinePointIterator.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/LinePointIterator.java @@ -65,7 +65,7 @@ public final class LinePointIterator _first = false; return true; } - else if (_dx >= _dy) + if (_dx >= _dy) { if (_srcX != _dstX) { @@ -81,21 +81,18 @@ public final class LinePointIterator return true; } } - else + else if (_srcY != _dstY) { - if (_srcY != _dstY) + _srcY += _sy; + + _error += _dx; + if (_error >= _dy) { - _srcY += _sy; - - _error += _dx; - if (_error >= _dy) - { - _srcX += _sx; - _error -= _dy; - } - - return true; + _srcX += _sx; + _error -= _dy; } + + return true; } return false; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java index 771bbb5fc7..c9dd0c3840 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java @@ -75,7 +75,7 @@ public final class LinePointIterator3D _first = false; return true; } - else if ((_dx >= _dy) && (_dx >= _dz)) + if ((_dx >= _dy) && (_dx >= _dz)) { if (_srcX != _dstX) { @@ -121,28 +121,25 @@ public final class LinePointIterator3D return true; } } - else + else if (_srcZ != _dstZ) { - if (_srcZ != _dstZ) + _srcZ += _sz; + + _error += _dx; + if (_error >= _dz) { - _srcZ += _sz; - - _error += _dx; - if (_error >= _dz) - { - _srcX += _sx; - _error -= _dz; - } - - _error2 += _dy; - if (_error2 >= _dz) - { - _srcY += _sy; - _error2 -= _dz; - } - - return true; + _srcX += _sx; + _error -= _dz; } + + _error2 += _dy; + if (_error2 >= _dz) + { + _srcY += _sy; + _error2 -= _dz; + } + + return true; } return false; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/PrimeFinder.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/PrimeFinder.java index a454fd5289..e032195067 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/PrimeFinder.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/PrimeFinder.java @@ -1,18 +1,13 @@ /* - * This file is part of the L2J Mobius project. + * Copyright (c) 1999 CERN - European Organization for Nuclear Research. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear in + * supporting documentation. CERN makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without expressed or implied warranty. */ package com.l2jmobius.gameserver.util; @@ -331,7 +326,6 @@ public final class PrimeFinder 800076929, 1600153859 }; - static { // initializer // The above prime numbers are formatted for human readability. diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/commons/util/DeadLockDetector.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/commons/util/DeadLockDetector.java index e9f16e2ccc..ad202531e4 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/commons/util/DeadLockDetector.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/commons/util/DeadLockDetector.java @@ -114,7 +114,7 @@ public class DeadLockDetector extends Thread } catch (Exception e) { - LOGGER.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "DeadLockDetector: ", e); } } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java index 1ba2e69658..37469431bb 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java @@ -184,7 +184,7 @@ public class GameServer if (!IdFactory.getInstance().isInitialized()) { LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration."); - throw new Exception("Could not initialize the ID factory"); + throw new Exception("Could not initialize the ID factory!"); } // load script engines @@ -273,6 +273,7 @@ public class GameServer if (Config.PREMIUM_SYSTEM_ENABLED) { + LOGGER.info("PremiumManager: Premium system is enabled."); PremiumManager.getInstance(); } @@ -466,7 +467,7 @@ public class GameServer /*** Main ***/ // Create log folder - final File logFolder = new File(".", LOG_FOLDER); + final File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER); logFolder.mkdir(); // Create input stream for log file -- or store file data into memory diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java index a4fc1b00a2..75089ff0f6 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java @@ -87,7 +87,6 @@ public final class ItemsAutoDestroy ItemsOnGroundManager.getInstance().removeObject(item); } } - } } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/MonsterRace.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/MonsterRace.java index 6387c1c3c6..2cf628c10f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/MonsterRace.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/MonsterRace.java @@ -16,7 +16,6 @@ */ package com.l2jmobius.gameserver; -import java.lang.reflect.Constructor; import java.util.logging.Level; import java.util.logging.Logger; @@ -64,14 +63,12 @@ public class MonsterRace try { final L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random); - final Constructor constructor = Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0]; - _monsters[i] = (L2Npc) constructor.newInstance(template); + _monsters[i] = (L2Npc) Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0].newInstance(template); } catch (Exception e) { - LOGGER.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "Unable to create monster!", e); } - // LOGGER.info("Monster "+i+" is id: "+(id+random)); } newSpeeds(); } @@ -87,14 +84,7 @@ public class MonsterRace total = 0; for (int j = 0; j < 20; j++) { - if (j == 19) - { - _speeds[i][j] = 100; - } - else - { - _speeds[i][j] = Rnd.get(60) + 65; - } + _speeds[i][j] = j == 19 ? 100 : Rnd.get(60) + 65; total += _speeds[i][j]; } if (total >= _first[1]) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/RecipeController.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/RecipeController.java index 06c67d16e2..5bf504afb5 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/RecipeController.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/RecipeController.java @@ -60,6 +60,7 @@ public class RecipeController protected RecipeController() { + // Prevent external initialization. } public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft) @@ -336,7 +337,6 @@ public class RecipeController if (Config.ALT_GAME_CREATION && !_items.isEmpty()) { - if (!calculateStatUse(true, true)) { return; // check stat use diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java index 2e99f8f99f..547750542b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java @@ -263,11 +263,10 @@ public class Shutdown extends Thread try { DatabaseFactory.getInstance().close(); - LOGGER.info("L2Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); + LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); } catch (Throwable t) { - } // server will quit, when this function ends. @@ -536,9 +535,6 @@ public class Shutdown extends Thread } } - /* - * if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true); - */ final TimeCounter tc = new TimeCounter(); // Save all raidboss and GrandBoss status ^_^ @@ -590,7 +586,7 @@ public class Shutdown extends Thread if (Config.BOTREPORT_ENABLE) { BotReportTable.getInstance().saveReportedCharData(); - LOGGER.info("Bot Report Table: Sucessfully saved reports to database!"); + LOGGER.info("Bot Report Table: Successfully saved reports to database!"); } try diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/cache/HtmCache.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/cache/HtmCache.java index fec436d1fa..2da85f99ff 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/cache/HtmCache.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/cache/HtmCache.java @@ -43,7 +43,7 @@ public class HtmCache private static final Pattern ABSTRACT_BLOCK_PATTERN = Pattern.compile("", Pattern.DOTALL); private static final Pattern BLOCK_PATTERN = Pattern.compile("(.*?)", Pattern.DOTALL); - private final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); + private static final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); private int _loadedFiles; private long _bytesBuffLen; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java index 6a19cc7d31..3f98953c02 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java @@ -204,14 +204,7 @@ public class Forum public Forum getChildByName(String name) { vload(); - for (Forum f : _children) - { - if (f.getName().equals(name)) - { - return f; - } - } - return null; + return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null); } /** @@ -220,7 +213,6 @@ public class Forum public void rmTopicByID(int id) { _topic.remove(id); - } public void insertIntoDb() diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java index bc05a8ff5c..a4df772cc3 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java @@ -46,9 +46,7 @@ public class ForumsBBSManager extends BaseBBSManager { while (rs.next()) { - final int forumId = rs.getInt("forum_id"); - final Forum f = new Forum(forumId, null); - addForum(f); + addForum(new Forum(rs.getInt("forum_id"), null)); } } catch (Exception e) @@ -62,10 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager */ public void initRoot() { - for (Forum f : _table) - { - f.vload(); - } + _table.forEach(f -> f.vload()); _log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index 188d99945c..7d74ef6eb4 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import com.l2jmobius.gameserver.communitybbs.BB.Forum; import com.l2jmobius.gameserver.communitybbs.BB.Post; -import com.l2jmobius.gameserver.communitybbs.BB.Post.CPost; import com.l2jmobius.gameserver.communitybbs.BB.Topic; import com.l2jmobius.gameserver.handler.CommunityBoardHandler; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -68,21 +67,8 @@ public class PostBBSManager extends BaseBBSManager st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); final int idp = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } - + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind); } else if (command.startsWith("_bbsposts;edit;")) @@ -106,7 +92,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); if ((forum == null) || (topic == null) || (p == null)) { - CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exit !


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exist!


    ", activeChar); } else { @@ -118,7 +104,7 @@ public class PostBBSManager extends BaseBBSManager { if ((forum == null) || (topic == null)) { - CommunityBoardHandler.separateAndSend("

    Error, this forum is not implemented yet


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error: This forum is not implemented yet!
    ", activeChar); } else if (forum.getType() == Forum.MEMO) { @@ -126,7 +112,7 @@ public class PostBBSManager extends BaseBBSManager } else { - CommunityBoardHandler.separateAndSend("

    the forum: " + forum.getName() + " is not implemented yet


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    The forum: " + forum.getName() + " is not implemented yet!
    ", activeChar); } } @@ -139,7 +125,6 @@ public class PostBBSManager extends BaseBBSManager private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum) { - // final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); @@ -176,8 +161,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(t); if (p != null) { - final CPost cp = p.getCPost(idp); - if (cp == null) + if (p.getCPost(idp) == null) { CommunityBoardHandler.separateAndSend("

    the post: " + idp + " does not exist !


    ", activeChar); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index db6e17a2b0..427f456b84 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -60,11 +60,7 @@ public class TopicBBSManager extends BaseBBSManager public int getMaxID(Forum f) { final Integer i = _maxId.get(f); - if (i == null) - { - return 0; - } - return i; + return i == null ? 0 : i; } public Topic getTopicByID(int idf) @@ -146,20 +142,8 @@ public class TopicBBSManager extends BaseBBSManager st.nextToken(); st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf); } else if (command.startsWith("_bbstopics;crea")) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java index d8dc164725..609f0858d5 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java @@ -170,12 +170,7 @@ public class CharNameTable public final int getAccessLevelById(int objectId) { - if (getNameById(objectId) != null) - { - return _accessLevels.get(objectId); - } - - return 0; + return getNameById(objectId) != null ? _accessLevels.get(objectId) : 0; } public synchronized boolean doesCharNameExist(String name) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java index df544c991d..6f2cf45ae6 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java @@ -66,7 +66,6 @@ import com.l2jmobius.gameserver.util.Util; public class ClanTable { private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName()); - private final Map _clans = new ConcurrentHashMap<>(); protected ClanTable() @@ -440,16 +439,13 @@ public class ClanTable for (L2Clan clan : _clans.values()) { final int allyId = clan.getAllyId(); - if ((allyId != 0) && (clan.getId() != allyId)) + if ((allyId != 0) && (clan.getId() != allyId) && !_clans.containsKey(allyId)) { - if (!_clans.containsKey(allyId)) - { - clan.setAllyId(0); - clan.setAllyName(null); - clan.changeAllyCrest(0, true); - clan.updateClanInDB(); - LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); - } + clan.setAllyId(0); + clan.setAllyName(null); + clan.changeAllyCrest(0, true); + clan.updateClanInDB(); + LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); } } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/EventDroplist.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/EventDroplist.java index c22e5eb0ee..ba8c26bbd8 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/EventDroplist.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/EventDroplist.java @@ -35,7 +35,7 @@ public class EventDroplist /** * The table containing all DataDrop object */ - private static final List _allNpcDateDrops = new CopyOnWriteArrayList<>(); + private static final List ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>(); public static class DateDrop { @@ -74,7 +74,7 @@ public class EventDroplist */ public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); } /** @@ -86,7 +86,7 @@ public class EventDroplist */ public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); } /** @@ -96,7 +96,7 @@ public class EventDroplist */ public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop) { - _allNpcDateDrops.add(new DateDrop(dateRange, eventDrop)); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, eventDrop)); } /** @@ -106,7 +106,7 @@ public class EventDroplist { final List list = new LinkedList<>(); final Date currentDate = new Date(); - for (DateDrop drop : _allNpcDateDrops) + for (DateDrop drop : ALL_NPC_DATE_DROPS) { if (drop._dateRange.isWithinRange(currentDate)) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/engines/DocumentBase.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/engines/DocumentBase.java index 0050c0a281..37410b0b38 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/engines/DocumentBase.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/engines/DocumentBase.java @@ -151,12 +151,11 @@ public abstract class DocumentBase protected final Logger _log = Logger.getLogger(getClass().getName()); private final File _file; - protected Map _tables; + protected final Map _tables = new HashMap<>(); protected DocumentBase(File pFile) { _file = pFile; - _tables = new HashMap<>(); } public Document parse() diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java index 0e3b945cf4..4d3be938c9 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java @@ -79,7 +79,6 @@ public final class DocumentItem extends DocumentBase implements IGameXmlReader { if ("list".equalsIgnoreCase(n.getNodeName())) { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("item".equalsIgnoreCase(d.getNodeName())) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/PlayerAction.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/PlayerAction.java index 95b3da5c8d..a9a2393db7 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/PlayerAction.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/PlayerAction.java @@ -30,7 +30,7 @@ public enum PlayerAction private PlayerAction() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/ShotType.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/ShotType.java index 2e98cb6d93..87e917b8bf 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/ShotType.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/enums/ShotType.java @@ -31,7 +31,7 @@ public enum ShotType private ShotType() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java index cb1452b64b..adf6462b78 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java @@ -34,8 +34,7 @@ public class AdminCommandHandler implements IHandler= FREE_OBJECT_ID_SIZE) { throw new NullPointerException("Ran out of valid Id's."); } + increaseBitSetCapacity(); } _nextFreeId.set(nextFree); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java index 6a3e232a26..002a6f75c3 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java @@ -316,7 +316,6 @@ public final class MapRegionManager implements IGameXmlReader return flags.stream().findAny().get().getLocation(); } } - } else if (fort != null) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java index 8f24f8dfc6..4e3abc79eb 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java @@ -191,7 +191,6 @@ public final class QuestManager { old.unload(); LOGGER.info("Replaced quest " + old.getName() + " (" + old.getId() + ") with a new version!"); - } if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java index e3235b056e..cd7118dc3b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java @@ -427,7 +427,7 @@ public final class SellBuffsManager implements IGameXmlReader } else if (player.isMounted() || player.isFlyingMounted() || player.isFlying()) { - player.sendMessage("You can't sell buffs in Mounth state!"); + player.sendMessage("You can't sell buffs in Mount state!"); return false; } else if (player.isTransformed()) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java index 70cfb5d922..5e16e5a91f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java @@ -71,9 +71,7 @@ public final class MessageDeletionTask implements Runnable final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId()); if (receiver != null) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME); - // sm.addString(msg.getReceiverName()); - receiver.sendPacket(sm); + receiver.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME)); } } catch (Exception e) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java index 43cf6815de..964757069c 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java @@ -78,7 +78,7 @@ public abstract class AbstractPlayerGroup */ public boolean isLeader(L2PcInstance player) { - return (getLeaderObjectId() == player.getObjectId()); + return getLeaderObjectId() == player.getObjectId(); } /** diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/AggroInfo.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/AggroInfo.java index 3be79b12bb..613e113b28 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/AggroInfo.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/AggroInfo.java @@ -93,4 +93,10 @@ public final class AggroInfo { return _attacker.getObjectId(); } + + @Override + public String toString() + { + return "AggroInfo [attacker=" + _attacker + ", hate=" + _hate + ", damage=" + _damage + "]"; + } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/BlockList.java index 08918cc853..627b0dbbe4 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/BlockList.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/BlockList.java @@ -33,14 +33,10 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.BlockListPacket; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -/** - * This class ... - * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $ - */ public class BlockList { private static Logger _log = Logger.getLogger(BlockList.class.getName()); - private static Map> _offlineList = new ConcurrentHashMap<>(); + private static final Map> OFFLINE_LIST = new ConcurrentHashMap<>(); private final L2PcInstance _owner; private List _blockList; @@ -48,7 +44,7 @@ public class BlockList public BlockList(L2PcInstance owner) { _owner = owner; - _blockList = _offlineList.get(owner.getObjectId()); + _blockList = OFFLINE_LIST.get(owner.getObjectId()); if (_blockList == null) { _blockList = loadList(_owner.getObjectId()); @@ -69,7 +65,7 @@ public class BlockList public void playerLogout() { - _offlineList.put(_owner.getObjectId(), _blockList); + OFFLINE_LIST.put(_owner.getObjectId(), _blockList); } private static List loadList(int ObjId) @@ -263,10 +259,10 @@ public class BlockList { return BlockList.isBlocked(player, targetId); } - if (!_offlineList.containsKey(ownerId)) + if (!OFFLINE_LIST.containsKey(ownerId)) { - _offlineList.put(ownerId, loadList(ownerId)); + OFFLINE_LIST.put(ownerId, loadList(ownerId)); } - return _offlineList.get(ownerId).contains(targetId); + return OFFLINE_LIST.get(ownerId).contains(targetId); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java index ee640a3d9c..047d3d7074 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java @@ -49,17 +49,7 @@ public final class DamageDoneInfo @Override public final boolean equals(Object obj) { - if (this == obj) - { - return true; - } - - if (obj instanceof DamageDoneInfo) - { - return (((DamageDoneInfo) obj).getAttacker() == _attacker); - } - - return false; + return (this == obj) || ((obj instanceof DamageDoneInfo) && (((DamageDoneInfo) obj).getAttacker() == _attacker)); } @Override diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2AccessLevel.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2AccessLevel.java index a050f2f872..aefc7fb15d 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2AccessLevel.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2AccessLevel.java @@ -23,29 +23,19 @@ import com.l2jmobius.gameserver.data.xml.impl.AdminData; */ public class L2AccessLevel { - /** - * The access level
    - */ + /** The access level. */ private int _accessLevel = 0; - /** - * The access level name
    - */ + /** The access level name. */ private String _name = null; - /** Child access levels */ + /** Child access levels. */ L2AccessLevel _childsAccessLevel = null; - /** Child access levels */ + /** Child access levels. */ private int _child = 0; - /** - * The name color for the access level
    - */ + /** The name color for the access level. */ private int _nameColor = 0; - /** - * The title color for the access level
    - */ + /** The title color for the access level. */ private int _titleColor = 0; - /** - * Flag to determine if the access level has gm access
    - */ + /** Flag to determine if the access level has GM access. */ private boolean _isGm = false; /** Flag for peace zone attack */ private boolean _allowPeaceAttack = false; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java index 08b62e547b..e1bbddd336 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -219,7 +219,7 @@ public class L2Clan implements IIdentifiable, INamable */ public int getLeaderId() { - return (_leader != null ? _leader.getObjectId() : 0); + return _leader != null ? _leader.getObjectId() : 0; } /** @@ -261,7 +261,6 @@ public class L2Clan implements IIdentifiable, INamable } exLeader.getClanPrivileges().clear(); exLeader.broadcastUserInfo(); - } else { @@ -378,6 +377,7 @@ public class L2Clan implements IIdentifiable, INamable player.setPledgeClass(L2ClanMember.calculatePledgeClass(player)); player.sendPacket(new PledgeShowMemberListUpdate(player)); player.sendPacket(new PledgeSkillList(this)); + addSkillEffects(player); // Notify to scripts @@ -1334,7 +1334,6 @@ public class L2Clan implements IIdentifiable, INamable Skill oldSkill = null; if (newSkill != null) { - if (subType == -2) { oldSkill = _skills.put(newSkill.getId(), newSkill); @@ -1793,12 +1792,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final SubPledge getSubPledge(int pledgeType) { - if (_subPledges == null) - { - return null; - } - - return _subPledges.get(pledgeType); + return _subPledges == null ? null : _subPledges.get(pledgeType); } /** @@ -1999,21 +1993,15 @@ public class L2Clan implements IIdentifiable, INamable public void initializePrivs() { - RankPrivs privs; for (int i = 1; i < 10; i++) { - privs = new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false)); - _privs.put(i, privs); + _privs.put(i, new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false))); } } public EnumIntBitmask getRankPrivs(int rank) { - if (_privs.get(rank) != null) - { - return _privs.get(rank).getPrivs(); - } - return new EnumIntBitmask<>(ClanPrivilege.class, false); + return _privs.get(rank) != null ? _privs.get(rank).getPrivs() : new EnumIntBitmask<>(ClanPrivilege.class, false); } public void setRankPrivs(int rank, int privs) @@ -2080,12 +2068,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final RankPrivs[] getAllRankPrivs() { - if (_privs == null) - { - return new RankPrivs[0]; - } - - return _privs.values().toArray(new RankPrivs[_privs.values().size()]); + return _privs == null ? new RankPrivs[0] : _privs.values().toArray(new RankPrivs[_privs.values().size()]); } public int getLeaderSubPledge(int leaderId) @@ -2417,13 +2400,10 @@ public class L2Clan implements IIdentifiable, INamable player.sendPacket(SystemMessageId.TO_CREATE_AN_ALLIANCE_YOUR_CLAN_MUST_BE_LEVEL_5_OR_HIGHER); return; } - if (getAllyPenaltyExpiryTime() > System.currentTimeMillis()) + if ((getAllyPenaltyExpiryTime() > System.currentTimeMillis()) && (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY)) { - if (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); - return; - } + player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); + return; } if (getDissolvingExpiryTime() > System.currentTimeMillis()) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ClanMember.java index 02d3c77259..139c302ce9 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ClanMember.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ClanMember.java @@ -151,8 +151,8 @@ public class L2ClanMember } /** - * Checks if is online. - * @return true, if is online + * Verifies if the clan member is online. + * @return {@code true} if is online */ public boolean isOnline() { @@ -263,11 +263,7 @@ public class L2ClanMember */ public int getPowerGrade() { - if (_player != null) - { - return _player.getPowerGrade(); - } - return _powerGrade; + return _player != null ? _player.getPowerGrade() : _powerGrade; } /** @@ -323,11 +319,7 @@ public class L2ClanMember */ public int getRaceOrdinal() { - if (_player != null) - { - return _player.getRace().ordinal(); - } - return _raceOrdinal; + return _player != null ? _player.getRace().ordinal() : _raceOrdinal; } /** @@ -336,11 +328,7 @@ public class L2ClanMember */ public boolean getSex() { - if (_player != null) - { - return _player.getAppearance().getSex(); - } - return _sex; + return _player != null ? _player.getAppearance().getSex() : _sex; } /** @@ -349,11 +337,7 @@ public class L2ClanMember */ public int getSponsor() { - if (_player != null) - { - return _player.getSponsor(); - } - return _sponsor; + return _player != null ? _player.getSponsor() : _sponsor; } /** @@ -362,11 +346,7 @@ public class L2ClanMember */ public int getApprentice() { - if (_player != null) - { - return _player.getApprentice(); - } - return _apprentice; + return _player != null ? _player.getApprentice() : _apprentice; } /** diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2CommandChannel.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2CommandChannel.java index bb1b4b57c4..d91e7e0554 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2CommandChannel.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2CommandChannel.java @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class L2CommandChannel extends AbstractPlayerGroup { private final List _parties = new CopyOnWriteArrayList<>(); - private L2PcInstance _commandLeader = null; + private L2PcInstance _commandLeader; private int _channelLvl; /** diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java index 09025eeed1..f485978cf6 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java @@ -68,19 +68,11 @@ public class L2GroupSpawn extends L2Spawn final L2Npc mob = new L2ControllableMobInstance(_template); mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp()); - if (getHeading() == -1) - { - mob.setHeading(Rnd.nextInt(61794)); - } - else - { - mob.setHeading(getHeading()); - } + mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading()); mob.setSpawn(this); mob.spawnMe(newlocx, newlocy, newlocz); return mob; - } catch (Exception e) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java index 7875bdbb6a..905a58c1b8 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java @@ -35,7 +35,7 @@ public class L2NpcWalkerNode extends Location _delay = delay; _runToLocation = runToLocation; _npcString = npcString; - _chatString = ((chatText == null) ? "" : chatText); + _chatString = (chatText == null) ? "" : chatText; } public int getDelay() diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Object.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Object.java index 9164db110c..171ad1e543 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Object.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Object.java @@ -782,7 +782,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared) { final double distance = Math.pow(x - getX(), 2) + Math.pow(y - getY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0); - return (squared) ? distance : Math.sqrt(distance); + return squared ? distance : Math.sqrt(distance); } /** @@ -898,12 +898,12 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab @Override public boolean equals(Object obj) { - return ((obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId())); + return (obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId()); } @Override public String toString() { - return (getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"); + return getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"; } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java index 469b9843cc..c0fad148f8 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java @@ -53,5 +53,4 @@ public class L2RecipeInstance { return _quantity; } - } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java index ae06fa8c1b..c22321462d 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java @@ -55,5 +55,4 @@ public class L2RecipeStatInstance { return _value; } - } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Territory.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Territory.java index 5152d69c0d..41cb26df2b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Territory.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Territory.java @@ -16,8 +16,8 @@ */ package com.l2jmobius.gameserver.model; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Logger; import com.l2jmobius.commons.util.Rnd; @@ -44,7 +44,7 @@ public class L2Territory } } - private final List _points = new ArrayList<>(); + private final List _points = new CopyOnWriteArrayList<>(); private final int _terr; private int _xMin; private int _xMax; @@ -96,14 +96,6 @@ public class L2Territory _procMax += proc; } - public void print() - { - for (Point p : _points) - { - _log.info("(" + p._x + "," + p._y + ")"); - } - } - public boolean isIntersect(int x, int y, Point p1, Point p2) { final double dy1 = p1._y - y; @@ -163,7 +155,6 @@ public class L2Territory return new Location(p1._x, p1._y, Rnd.get(p1._zmin, p1._zmax)); } } - } for (int i = 0; i < 100; i++) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2World.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2World.java index 805e0c0ed2..9b02364b07 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2World.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2World.java @@ -282,20 +282,20 @@ public final class L2World } /** - * Add a L2Object in the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Add a L2Object in the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Add the L2Object object in _allPlayers* of L2World
  • *
  • Add the L2Object object in _gmList** of GmListTable
  • - *
  • Add object in _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding PlayerInstance in its _knownPlayer

  • - * * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of WorldRegion (need synchronisation)
    + *
  • Add object in _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding L2PcInstance in its _knownPlayer

  • + * * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of L2WorldRegion (need synchronisation)
    * Caution : This method DOESN'T ADD the object to _allObjects and _allPlayers* of L2World (need synchronisation) Example of use : *
  • Drop an Item
  • *
  • Spawn a L2Character
  • - *
  • Apply Death Penalty of a PlayerInstance
  • + *
  • Apply Death Penalty of a L2PcInstance
  • * @param object L2object to add in the world - * @param newRegion WorldRegion in wich the object will be add (not used) + * @param newRegion L2WorldRegion in wich the object will be add (not used) */ public void addVisibleObject(L2Object object, L2WorldRegion newRegion) { @@ -371,18 +371,18 @@ public final class L2World } /** - * Remove a L2Object from the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Remove a L2Object from the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Remove the L2Object object from _allPlayers* of L2World
  • - *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of WorldRegion
  • + *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of L2WorldRegion
  • *
  • Remove the L2Object object from _gmList** of GmListTable
  • - *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all PlayerInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Example of use : + *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all L2PcInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Example of use : *
  • Pickup an Item
  • *
  • Decay a L2Character
  • * @param object L2object to remove from the world - * @param oldRegion WorldRegion in which the object was before removing + * @param oldRegion L2WorldRegion in which the object was before removing */ public void removeVisibleObject(L2Object object, L2WorldRegion oldRegion) { @@ -395,7 +395,7 @@ public final class L2World { oldRegion.removeVisibleObject(object); - // Go through all surrounding WorldRegion Creatures + // Go through all surrounding L2WorldRegion L2Characters oldRegion.forEachSurroundingRegion(w -> { for (L2Object wo : w.getVisibleObjects().values()) @@ -714,7 +714,7 @@ public final class L2World } /** - * Calculate the current WorldRegions of the object according to its position (x,y). Example of use : + * Calculate the current L2WorldRegions of the object according to its position (x,y). Example of use : *
  • Set position of a new L2Object (drop, spawn...)
  • *
  • Update position of a L2Object after a movement

  • * @param point position of the object @@ -749,12 +749,12 @@ public final class L2World } /** - * Check if the current WorldRegions of the object is valid according to its position (x,y). Example of use : - *
  • Init WorldRegions

  • + * Check if the current L2WorldRegions of the object is valid according to its position (x,y). Example of use : + *
  • Init L2WorldRegions

  • * @param x X position of the object * @param y Y position of the object * @param z Z position of the object - * @return True if the WorldRegion is valid + * @return True if the L2WorldRegion is valid */ public static boolean validRegion(int x, int y, int z) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 6bfaf3a33d..97608b326d 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -136,7 +136,6 @@ public final class L2WorldRegion } LOGGER.finer(c + " mobs were turned on"); } - } public boolean isActive() diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MobGroup.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MobGroup.java index 88cc4a5599..4eb38cf27b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MobGroup.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MobGroup.java @@ -191,8 +191,7 @@ public final class MobGroup final int y = player.getY() + Rnd.nextInt(50); mobInst.teleToLocation(new Location(x, y, player.getZ()), true); - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(player); + ((L2ControllableMobAI) mobInst.getAI()).follow(player); } } } @@ -294,8 +293,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.forceAttack(target); + ((L2ControllableMobAI) mobInst.getAI()).forceAttack(target); } } @@ -310,8 +308,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.stop(); + ((L2ControllableMobAI) mobInst.getAI()).stop(); } } @@ -347,8 +344,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(character); + ((L2ControllableMobAI) mobInst.getAI()).follow(character); } } @@ -363,8 +359,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setAlternateAI(L2ControllableMobAI.AI_CAST); + ((L2ControllableMobAI) mobInst.getAI()).setAlternateAI(L2ControllableMobAI.AI_CAST); } } @@ -379,8 +374,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setNotMoving(enabled); + ((L2ControllableMobAI) mobInst.getAI()).setNotMoving(enabled); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MobGroupTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MobGroupTable.java index db0a789765..da1b620a40 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MobGroupTable.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MobGroupTable.java @@ -75,7 +75,7 @@ public class MobGroupTable public boolean removeGroup(int groupKey) { - return (_groupMap.remove(groupKey) != null); + return _groupMap.remove(groupKey) != null; } private static class SingletonHolder diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/Petition.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/Petition.java index 8596c3ea61..cbed80441a 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/Petition.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/Petition.java @@ -98,7 +98,7 @@ public final class Petition } PetitionManager.getInstance().getCompletedPetitions().put(getId(), this); - return (PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null); + return PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null; } public String getContent() diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/ShortCuts.java index 2bbf25dee0..3f8d959ef6 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/ShortCuts.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/ShortCuts.java @@ -55,13 +55,10 @@ public class ShortCuts implements IRestorable { Shortcut sc = _shortCuts.get(slot + (page * MAX_SHORTCUTS_PER_BAR)); // Verify shortcut - if ((sc != null) && (sc.getType() == ShortcutType.ITEM)) + if ((sc != null) && (sc.getType() == ShortcutType.ITEM) && (_owner.getInventory().getItemByObjectId(sc.getId()) == null)) { - if (_owner.getInventory().getItemByObjectId(sc.getId()) == null) - { - deleteShortCut(sc.getSlot(), sc.getPage()); - sc = null; - } + deleteShortCut(sc.getSlot(), sc.getPage()); + sc = null; } return sc; } @@ -78,8 +75,7 @@ public class ShortCuts implements IRestorable } shortcut.setSharedReuseGroup(item.getSharedReuseGroup()); } - final Shortcut oldShortCut = _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut); - registerShortCutInDb(shortcut, oldShortCut); + registerShortCutInDb(shortcut, _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut)); } private void registerShortCutInDb(Shortcut shortcut, Shortcut oldShortCut) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/TradeList.java index 29362b8549..eeee7d0cae 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/TradeList.java @@ -149,11 +149,7 @@ public class TradeList { if (exclItem.getItem().getId() == item.getId()) { - if (item.getCount() <= exclItem.getCount()) - { - return null; - } - return new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice()); + return item.getCount() <= exclItem.getCount() ? null : new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice()); } } } @@ -440,11 +436,7 @@ public class TradeList { partnerList.lock(); lock(); - if (!partnerList.validate()) - { - return false; - } - if (!validate()) + if (!partnerList.validate() || !validate()) { return false; } @@ -616,12 +608,12 @@ public class TradeList boolean success = false; // check weight and slots - if ((!getOwner().getInventory().validateWeight(partnerList.calcItemsWeight())) || !(partnerList.getOwner().getInventory().validateWeight(calcItemsWeight()))) + if (!getOwner().getInventory().validateWeight(partnerList.calcItemsWeight()) || !partnerList.getOwner().getInventory().validateWeight(calcItemsWeight())) { partnerList.getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT); getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT); } - else if ((!getOwner().getInventory().validateCapacity(partnerList.countItemsSlots(getOwner()))) || (!partnerList.getOwner().getInventory().validateCapacity(countItemsSlots(partnerList.getOwner())))) + else if (!getOwner().getInventory().validateCapacity(partnerList.countItemsSlots(getOwner())) || !partnerList.getOwner().getInventory().validateCapacity(countItemsSlots(partnerList.getOwner()))) { partnerList.getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL); getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL); @@ -846,42 +838,36 @@ public class TradeList } // Send messages about the transaction to both players + SystemMessage msg; if (newItem.isStackable()) { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); + msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); msg.addString(player.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); msg.addString(_owner.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); - player.sendPacket(msg); } else { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); + msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); msg.addString(player.getName()); msg.addItemName(newItem); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); msg.addString(_owner.getName()); msg.addItemName(newItem); - player.sendPacket(msg); } + player.sendPacket(msg); } // Send inventory update packet _owner.sendInventoryUpdate(ownerIU); player.sendInventoryUpdate(playerIU); - if (ok) - { - return 0; - } - return 2; + return ok ? 0 : 2; } /** @@ -892,12 +878,7 @@ public class TradeList */ public synchronized boolean privateStoreSell(L2PcInstance player, ItemRequest[] requestedItems) { - if (_locked) - { - return false; - } - - if (!_owner.isOnline() || !player.isOnline()) + if (_locked || !_owner.isOnline() || !player.isOnline()) { return false; } @@ -1037,32 +1018,30 @@ public class TradeList } // Send messages about the transaction to both players + SystemMessage msg; if (newItem.isStackable()) { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); + msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); msg.addString(player.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); msg.addString(_owner.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); - player.sendPacket(msg); } else { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); + msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); msg.addString(player.getName()); msg.addItemName(newItem); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); msg.addString(_owner.getName()); msg.addItemName(newItem); - player.sendPacket(msg); } + player.sendPacket(msg); } if (totalPrice > 0) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java index d77bf6af86..6892d0798a 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java @@ -454,21 +454,18 @@ public final class BlockCheckerEngine switch (_round) { - case 1: + case 1: // Schedule second spawn round { - // Schedule second spawn round _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); break; } - case 2: + case 2: // Schedule third spawn round { - // Schedule third spawn round _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); break; } - case 3: + case 3: // Schedule Event End Count Down { - // Schedule Event End Count Down _task = ThreadPool.schedule(new EndEvent(), 180000); break; } @@ -572,7 +569,7 @@ public final class BlockCheckerEngine /* * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_WILL_END_IN_5_SECONDS)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } + * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } */ /** @@ -652,7 +649,7 @@ public final class BlockCheckerEngine } /** - * Reward the speicifed team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra + * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra * @param isRed */ private void rewardAsWinner(boolean isRed) @@ -714,8 +711,7 @@ public final class BlockCheckerEngine */ private void rewardAsLooser(boolean isRed) { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - for (Entry entry : tempPoints.entrySet()) + for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) { final L2PcInstance player = entry.getKey(); if ((player != null) && (entry.getValue() >= 10)) @@ -726,7 +722,7 @@ public final class BlockCheckerEngine } /** - * Telport players back, give status back and send final packet + * Teleport players back, give status back and send final packet */ private void setPlayersBack() { @@ -748,13 +744,11 @@ public final class BlockCheckerEngine final PcInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); } if (inv.getItemByItemId(13788) != null) { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); } broadcastRelationChanged(player); // Teleport Back diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Couple.java index 7901689adf..c31232e232 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Couple.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Couple.java @@ -99,7 +99,7 @@ public class Couple } catch (Exception e) { - _log.log(Level.SEVERE, "Could not create couple:", e); + _log.log(Level.SEVERE, "Could not create couple: " + e.getMessage(), e); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java index e9b3160a50..75ec9236b8 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -192,12 +192,7 @@ public final class Fort extends AbstractResidence } if ((getOwnerClan().getWarehouse().getAdena() >= _fee) || !_cwh) { - int fee = _fee; - if (getEndTime() == -1) - { - fee = _tempFee; - } - + final int fee = getEndTime() == -1 ? _tempFee : _fee; setEndTime(System.currentTimeMillis() + getRate()); dbSave(); if (_cwh) @@ -549,7 +544,6 @@ public final class Fort extends AbstractResidence if (door != null) { door.setCurrentHp(door.getMaxHp() + hp); - saveDoorUpgrade(doorId, hp, pDef, mDef); } } @@ -589,7 +583,7 @@ public final class Fort extends AbstractResidence long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis(); while (initial > (Config.FS_UPDATE_FRQ * 60000L)) { - initial -= (Config.FS_UPDATE_FRQ * 60000L); + initial -= Config.FS_UPDATE_FRQ * 60000L; } initial = (Config.FS_UPDATE_FRQ * 60000L) - initial; if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600))) @@ -609,7 +603,6 @@ public final class Fort extends AbstractResidence { setOwnerClan(null); } - } catch (Exception e) { @@ -675,12 +668,9 @@ public final class Fort extends AbstractResidence { return false; } - if (lease > 0) + if ((lease > 0) && !player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) { - if (!player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) - { - return false; - } + return false; } if (addNew) { @@ -690,20 +680,16 @@ public final class Fort extends AbstractResidence { removeFunction(type); } + else if ((lease - _function.get(type).getLease()) > 0) + { + _function.remove(type); + _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); + } else { - final int diffLease = lease - _function.get(type).getLease(); - if (diffLease > 0) - { - _function.remove(type); - _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); - } - else - { - _function.get(type).setLease(lease); - _function.get(type).setLvl(lvl); - _function.get(type).dbSave(); - } + _function.get(type).setLease(lease); + _function.get(type).setLvl(lvl); + _function.get(type).dbSave(); } return true; } @@ -934,31 +920,17 @@ public final class Fort extends AbstractResidence public final int getOwnedTime() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); } public final int getTimeTillRebelArmy() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); } public final long getTimeTillNextFortUpdate() { - if (_FortUpdater[0] == null) - { - return 0; - } - return _FortUpdater[0].getDelay(TimeUnit.SECONDS); + return _FortUpdater[0] == null ? 0 : _FortUpdater[0].getDelay(TimeUnit.SECONDS); } public void updateClansReputation(L2Clan owner, boolean removePoints) @@ -999,7 +971,6 @@ public final class Fort extends AbstractResidence _log.log(Level.WARNING, "Exception in endFortressSiege " + e.getMessage(), e); } } - } /** diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/L2Event.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/L2Event.java index ad93bd97a4..be28d47897 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/L2Event.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/L2Event.java @@ -46,7 +46,8 @@ import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse; import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; /** - * @since $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $ This ancient thingie got reworked by Nik at $Date: 2011/05/17 21:51:39 $ Yeah, for 6 years no one bothered reworking this buggy event engine. + * @author Nik + * @Since 2011/05/17 21:51:39 */ public class L2Event { @@ -164,7 +165,6 @@ public class L2Event try { final L2Spawn spawn = new L2Spawn(_npcId); - spawn.setX(target.getX() + 50); spawn.setY(target.getY() + 50); spawn.setZ(target.getZ()); @@ -184,13 +184,11 @@ public class L2Event spawn.getLastSpawn().broadcastPacket(new MagicSkillUse(spawn.getLastSpawn(), spawn.getLastSpawn(), 1034, 1, 1, 1)); // _npcs.add(spawn.getLastSpawn()); - } catch (Exception e) { _log.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e); } - } /** @@ -274,7 +272,6 @@ public class L2Event */ public static void removeAndResetPlayer(L2PcInstance player) { - try { if (isParticipant(player)) @@ -475,7 +472,6 @@ public class L2Event biggestLvlPlayer.setEventStatus(); i = (i + 1) % _teamsNumber; } - } catch (Exception e) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java index 64f1bd2117..08f8d8f701 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java @@ -30,7 +30,7 @@ public final class InstanceReenterTimeHolder private int _minute = -1; private long _time = -1; - public InstanceReenterTimeHolder(int time) + public InstanceReenterTimeHolder(long time) { _time = TimeUnit.MINUTES.toMillis(time); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java index ee59be43a2..03514cc06f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java @@ -45,5 +45,4 @@ public interface IParserAdvUtils extends IParserUtils Duration getDuration(String key); > T getEnum(String key, Class clazz); - } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java index 3930368188..f97917af4f 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java @@ -62,7 +62,7 @@ public final class ClanWarehouse extends Warehouse @Override public boolean validateCapacity(long slots) { - return ((_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN); + return (_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN; } @Override diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index a3e5358978..076cfe435a 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -1806,7 +1806,7 @@ public final class L2ItemInstance extends L2Object public boolean isTimeLimitedItem() { - return (_time > 0); + return _time > 0; } /** diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java index a4d6c7d9db..2d9fc312b0 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java @@ -49,5 +49,5 @@ public enum MaterialType FISH, RUNE_XP, RUNE_SP, - RUNE_REMOVE_PENALTY + RUNE_REMOVE_PENALTY; } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java index 950b9d353b..0c8a3b044b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java @@ -155,7 +155,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ protected void onLoad() { - } /** @@ -166,7 +165,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onSave() { - } /** @@ -1056,7 +1054,7 @@ public class Quest extends AbstractScript implements IIdentifiable */ public String onDeath(L2Character killer, L2Character victim, QuestState qs) { - return onAdvEvent("", ((killer instanceof L2Npc) ? ((L2Npc) killer) : null), qs.getPlayer()); + return onAdvEvent("", (killer instanceof L2Npc) ? (L2Npc) killer : null, qs.getPlayer()); } /** @@ -1389,7 +1387,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) { - } /** @@ -1399,7 +1396,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadLose(L2PcInstance loser, CompetitionType type) { - } /** @@ -1408,7 +1404,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onMoveFinished(L2Npc npc) { - } /** @@ -1417,7 +1412,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onNodeArrived(L2Npc npc) { - } /** @@ -1426,7 +1420,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onRouteFinished(L2Npc npc) { - } /** @@ -2624,11 +2617,7 @@ public class Quest extends AbstractScript implements IIdentifiable } } } - if ((luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc)) - { - return luckyPlayer; - } - return null; + return (luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc) ? luckyPlayer : null; } /** @@ -2663,15 +2652,7 @@ public class Quest extends AbstractScript implements IIdentifiable QuestState qs = player.getQuestState(getName()); if (!player.isInParty()) { - if (!checkPartyMemberConditions(qs, condition, target)) - { - return null; - } - if (!checkDistanceToTarget(player, target)) - { - return null; - } - return qs; + return !checkPartyMemberConditions(qs, condition, target) || !checkDistanceToTarget(player, target) ? null : qs; } final List candidates = new ArrayList<>(); @@ -2703,21 +2684,17 @@ public class Quest extends AbstractScript implements IIdentifiable } qs = candidates.get(getRandom(candidates.size())); - if (!checkDistanceToTarget(qs.getPlayer(), target)) - { - return null; - } - return qs; + return !checkDistanceToTarget(qs.getPlayer(), target) ? null : qs; } private boolean checkPartyMemberConditions(QuestState qs, int condition, L2Npc npc) { - return ((qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc)); + return (qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc); } private static boolean checkDistanceToTarget(L2PcInstance player, L2Npc target) { - return ((target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true)); + return (target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true); } /** @@ -2825,7 +2802,7 @@ public class Quest extends AbstractScript implements IIdentifiable { for (int id : items) { - if (ItemTable.getInstance().getTemplate(id) == null) + if ((id != 0) && (ItemTable.getInstance().getTemplate(id) == null)) { _log.severe(super.getClass().getSimpleName() + ": Found registerQuestItems for non existing item: " + id + "!"); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/QuestState.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/QuestState.java index abf9825d8e..23c0acc8d1 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/QuestState.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/QuestState.java @@ -114,7 +114,7 @@ public final class QuestState */ public boolean isCreated() { - return (_state == State.CREATED); + return _state == State.CREATED; } /** @@ -123,7 +123,7 @@ public final class QuestState */ public boolean isStarted() { - return (_state == State.STARTED); + return _state == State.STARTED; } /** @@ -132,7 +132,7 @@ public final class QuestState */ public boolean isCompleted() { - return (_state == State.COMPLETED); + return _state == State.COMPLETED; } /** @@ -340,10 +340,10 @@ public final class QuestState // since no flag had been skipped until now, the least significant bits must all // be set to 1, up until "old" number of bits. - completedStateFlags |= ((1 << old) - 1); + completedStateFlags |= (1 << old) - 1; // now, just set the bit corresponding to the passed cond to 1 (current step) - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } } @@ -352,7 +352,7 @@ public final class QuestState else if (cond < old) { // note, this also unsets the flag indicating that there exist skips - completedStateFlags &= ((1 << cond) - 1); + completedStateFlags &= (1 << cond) - 1; // now, check if this resulted in no steps being skipped any more if (completedStateFlags == ((1 << cond) - 1)) @@ -372,7 +372,7 @@ public final class QuestState // Just mark this state and we are done. else { - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } @@ -463,7 +463,7 @@ public final class QuestState */ public boolean isCond(int condition) { - return (getInt("cond") == condition); + return getInt("cond") == condition; } /** @@ -523,7 +523,7 @@ public final class QuestState */ public boolean isSet(String variable) { - return (get(variable) != null); + return get(variable) != null; } /** @@ -578,7 +578,7 @@ public final class QuestState public boolean isMemoState(int memoState) { - return (getInt("memoState") == memoState); + return getInt("memoState") == memoState; } /** @@ -823,7 +823,7 @@ public final class QuestState public boolean isNowAvailable() { final String val = get("restartTime"); - return (val != null) && (!Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis())); + return (val == null) || !Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis()); } public void setSimulated(boolean simulated) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/TraitType.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/TraitType.java index e7a799703d..890e7b48b8 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/TraitType.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/stats/TraitType.java @@ -83,7 +83,7 @@ public enum TraitType { _type = type; } - + public int getType() { return _type; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java index 4433e97b28..f431bdab71 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java @@ -49,13 +49,13 @@ public class ZoneCuboid extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_r.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _r.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -65,9 +65,9 @@ public class ZoneCuboid extends L2ZoneForm final int _x2 = _r.x + _r.width; final int _y1 = _r.y; final int _y2 = _r.y + _r.height; - double test, shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); + double test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); + double shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); - test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); if (test < shortestDist) { shortestDist = test; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java index afdfd3fade..5f3b143379 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java @@ -43,11 +43,7 @@ public class ZoneCylinder extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - if (((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) > _radS) || (z < _z1) || (z > _z2)) - { - return false; - } - return true; + return ((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) <= _radS) && (z >= _z1) && (z <= _z2); } @Override @@ -130,9 +126,7 @@ public class ZoneCylinder extends L2ZoneForm final double angle = (2 * Math.PI) / count; for (int i = 0; i < count; i++) { - final int x = (int) (Math.cos(angle * i) * _rad); - final int y = (int) (Math.sin(angle * i) * _rad); - dropDebugItem(Inventory.ADENA_ID, 1, _x + x, _y + y, z); + dropDebugItem(Inventory.ADENA_ID, 1, _x + (int) (Math.cos(angle * i) * _rad), _y + (int) (Math.sin(angle * i) * _rad), z); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java index 2340c1b218..d1ef507961 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java @@ -51,13 +51,13 @@ public class ZoneNPoly extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_p.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _p.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -95,25 +95,15 @@ public class ZoneNPoly extends L2ZoneForm @Override public void visualizeZone(int z) { - final int[] _x = _p.xpoints; - final int[] _y = _p.ypoints; - for (int i = 0; i < _p.npoints; i++) { - int nextIndex = i + 1; - // ending point to first one - if (nextIndex == _x.length) - { - nextIndex = 0; - } - final int vx = _x[nextIndex] - _x[i]; - final int vy = _y[nextIndex] - _y[i]; - float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)); - lenght /= STEP; + final int nextIndex = (i + 1) == _p.xpoints.length ? 0 : i + 1; + final int vx = _p.xpoints[nextIndex] - _p.xpoints[i]; + final int vy = _p.ypoints[nextIndex] - _p.ypoints[i]; + final float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)) / STEP; for (int o = 1; o <= lenght; o++) { - final float k = o / lenght; - dropDebugItem(Inventory.ADENA_ID, 1, (int) (_x[i] + (k * vx)), (int) (_y[i] + (k * vy)), z); + dropDebugItem(Inventory.ADENA_ID, 1, (int) (_p.xpoints[i] + ((o / lenght) * vx)), (int) (_p.ypoints[i] + ((o / lenght) * vy)), z); } } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java index 09ea4b531a..904a7f2919 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public final class L2CastleZone extends L2ResidenceZone { - public L2CastleZone(int id) { super(id); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java index ec9a75b975..a1a99b7051 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java @@ -99,7 +99,7 @@ public class L2NoRestartZone extends L2ZoneType return; } - if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.getInstance().getStartedTime()) > getRestartAllowedTime())) + if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis()) > getRestartAllowedTime())) { player.teleToLocation(TeleportWhereType.TOWN); } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java index 45e377e22a..b3b1c77f42 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java @@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public class L2NoSummonFriendZone extends L2ZoneType { - public L2NoSummonFriendZone(int id) { super(id); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java index cb7760aee0..9ab43dd1cd 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java @@ -71,12 +71,7 @@ public class L2ResidenceHallTeleportZone extends L2ResidenceTeleportZone @Override public void run() { - int index = 0; - if (getSpawns().size() > 1) - { - index = Rnd.get(getSpawns().size()); - } - + final int index = getSpawns().size() > 1 ? Rnd.get(getSpawns().size()) : 0; final Location loc = getSpawns().get(index); if (loc == null) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java index e63f1883f1..46037463d5 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java @@ -26,7 +26,6 @@ public class BlowFishKeygen { private static final int CRYPT_KEYS_SIZE = 20; private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16]; - static { // init the GS encryption keys on class load @@ -54,7 +53,6 @@ public class BlowFishKeygen // block instantiation private BlowFishKeygen() { - } /** diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/IncomingPackets.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/IncomingPackets.java index 98362130f8..85b3fad9fd 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/IncomingPackets.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/IncomingPackets.java @@ -208,7 +208,6 @@ public enum IncomingPackets implements IIncomingPackets EX_PACKET(0xD0, ExPacket::new, ConnectionState.values()); // This packet has its own connection state checking so we allow all of them public static final IncomingPackets[] PACKET_ARRAY; - static { final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java index 8681078d71..cf476ab880 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java @@ -56,5 +56,4 @@ public class AuthRequest extends BaseSendablePacket { return getBytes(); } - } \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java index 69264263b4..2603512fdf 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java @@ -25,7 +25,6 @@ import com.l2jmobius.commons.network.BaseSendablePacket; */ public class ReplyCharacters extends BaseSendablePacket { - public ReplyCharacters(String account, int chars, List timeToDel) { writeC(0x08); @@ -43,5 +42,4 @@ public class ReplyCharacters extends BaseSendablePacket { return getBytes(); } - } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java index 113caaea70..ed3375e8d2 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class AuthResponse extends BaseRecievePacket { - private final int _serverId; private final String _serverName; @@ -52,5 +51,4 @@ public class AuthResponse extends BaseRecievePacket { return _serverName; } - } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java index 6945db648c..721ff58f8e 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java @@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; public class ChangePasswordResponse extends BaseRecievePacket { - public ChangePasswordResponse(byte[] decrypt) { super(decrypt); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java index d937c4762e..6f43b2976d 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java @@ -43,5 +43,4 @@ public class InitLS extends BaseRecievePacket final int size = readD(); _key = readB(size); } - } \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java index fe2c0b2d88..bbf888d495 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class KickPlayer extends BaseRecievePacket { - private final String _account; /** @@ -39,5 +38,4 @@ public class KickPlayer extends BaseRecievePacket { return _account; } - } \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java index f50e7a95e6..ae76f77fb7 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class LoginServerFail extends BaseRecievePacket { - private static final String[] REASONS = { "None", @@ -52,5 +51,4 @@ public class LoginServerFail extends BaseRecievePacket { return _reason; } - } \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java index a87742fab7..c747b9bb56 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class PlayerAuthResponse extends BaseRecievePacket { - private final String _account; private final boolean _authed; @@ -35,7 +34,7 @@ public class PlayerAuthResponse extends BaseRecievePacket super(decrypt); _account = readS(); - _authed = (readC() != 0); + _authed = readC() != 0; } /** @@ -53,5 +52,4 @@ public class PlayerAuthResponse extends BaseRecievePacket { return _authed; } - } \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/DateRange.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/DateRange.java index e825d08b90..3b8acae352 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/DateRange.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/DateRange.java @@ -43,10 +43,7 @@ public class DateRange { try { - final Date start = format.parse(date[0]); - final Date end = format.parse(date[1]); - - return new DateRange(start, end); + return new DateRange(format.parse(date[0]), format.parse(date[1])); } catch (ParseException e) { @@ -63,7 +60,8 @@ public class DateRange public boolean isWithinRange(Date date) { - return date.after(_startDate) && date.before(_endDate); + return (date.equals(_startDate) || date.after(_startDate)) // + && (date.equals(_endDate) || date.before(_endDate)); } public Date getEndDate() diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/ScriptDocument.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/ScriptDocument.java index 00b292822c..eacfe5baf8 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/ScriptDocument.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/ScriptDocument.java @@ -63,7 +63,6 @@ public class ScriptDocument { // Parser with specified options can't be built _log.log(Level.WARNING, "", pce); - } catch (IOException ioe) { @@ -90,5 +89,4 @@ public class ScriptDocument { return _name; } - } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/ScriptEngine.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/ScriptEngine.java index 41525b111f..bdef90d7b6 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/ScriptEngine.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/script/ScriptEngine.java @@ -41,16 +41,16 @@ public class ScriptEngine s = parserFactories.get(name); if (s == null) // if the shape factory is not there even now { - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } catch (ClassNotFoundException e) { // We'll throw an exception to indicate that // the shape could not be created - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } - return (s.create()); + return s.create(); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/Task.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/Task.java index ecbef18add..d76a02c101 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/Task.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/Task.java @@ -43,6 +43,5 @@ public abstract class Task public void onDestroy() { - } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java index 7f86a2bfb3..6b73502977 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java @@ -104,7 +104,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.warning("Cannot updated the Global Task " + id + ": " + e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Cannot updated the Global Task " + id + ": " + e.getMessage(), e); } if ((type == TYPE_SHEDULED) || (type == TYPE_TIME)) @@ -116,15 +116,7 @@ public final class TaskManager @Override public boolean equals(Object object) { - if (this == object) - { - return true; - } - if (!(object instanceof ExecutedTask)) - { - return false; - } - return id == ((ExecutedTask) object).id; + return (this == object) || ((object instanceof ExecutedTask) && (id == ((ExecutedTask) object).id)); } @Override @@ -169,7 +161,6 @@ public final class TaskManager _currentTasks.remove(this); } - } private void initializate() @@ -182,8 +173,7 @@ public final class TaskManager public void registerTask(Task task) { - final int key = task.getName().hashCode(); - _tasks.computeIfAbsent(key, k -> + _tasks.computeIfAbsent(task.getName().hashCode(), k -> { task.initializate(); return task; @@ -217,7 +207,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.SEVERE, "Error while loading Global Task table: ", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error while loading Global Task table: " + e.getMessage(), e); } } @@ -256,7 +246,7 @@ public final class TaskManager task.scheduled = ThreadPool.schedule(task, diff); return true; } - LOGGER.info("Task " + task.getId() + " is obsoleted."); + LOGGER.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted."); } catch (Exception e) { @@ -280,7 +270,7 @@ public final class TaskManager if (hour.length != 3) { - LOGGER.warning("Task " + task.getId() + " has incorrect parameters"); + LOGGER.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters"); return false; } @@ -296,7 +286,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.WARNING, "Bad parameter on task " + task.getId() + ": ", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Bad parameter on task " + task.getId() + ": " + e.getMessage(), e); return false; } @@ -348,7 +338,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the unique task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the unique task: " + e.getMessage(), e); } return false; } @@ -374,7 +364,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the task: " + e.getMessage(), e); } return false; } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java index e23716eba1..f005fca2ea 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java @@ -94,7 +94,7 @@ public final class FloodProtectorAction if ((curTick < _nextGameTick) || _punishmentInProgress) { - if (_config.LOG_FLOODING && !_logged && (_log.getLevel() == Level.WARNING)) + if (_config.LOG_FLOODING && !_logged && _log.isLoggable(Level.WARNING)) { log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeController.MILLIS_IN_TICK), " ms after previous command"); _logged = true; @@ -124,12 +124,9 @@ public final class FloodProtectorAction return false; } - if (_count.get() > 0) + if ((_count.get() > 0) && _config.LOG_FLOODING && _log.isLoggable(Level.WARNING)) { - if (_config.LOG_FLOODING && (_log.getLevel() == Level.WARNING)) - { - log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); - } + log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); } _nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL; @@ -145,7 +142,7 @@ public final class FloodProtectorAction { Disconnection.of(_client).defaultSequence(false); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log("kicked for flooding"); } @@ -157,7 +154,7 @@ public final class FloodProtectorAction private void banAccount() { PunishmentManager.getInstance().startPunishment(new PunishmentTask(_client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log(" banned for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } @@ -168,18 +165,20 @@ public final class FloodProtectorAction */ private void jailChar() { - if (_client.getActiveChar() != null) + if (_client.getActiveChar() == null) { - final int charId = _client.getActiveChar().getObjectId(); - if (charId > 0) - { - PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - } - - if (_log.getLevel() == Level.WARNING) - { - log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); - } + return; + } + + final int charId = _client.getActiveChar().getObjectId(); + if (charId > 0) + { + PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); + } + + if (_log.isLoggable(Level.WARNING)) + { + log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/GMAudit.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/GMAudit.java index ab7aa87ed6..c2ee25069b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/GMAudit.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/GMAudit.java @@ -32,7 +32,6 @@ import com.l2jmobius.Config; public class GMAudit { private static final Logger _log = Logger.getLogger(GMAudit.class.getName()); - static { new File("log/GMAudit").mkdirs(); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/LinePointIterator.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/LinePointIterator.java index 2208c5092d..168255fafd 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/LinePointIterator.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/LinePointIterator.java @@ -65,7 +65,7 @@ public final class LinePointIterator _first = false; return true; } - else if (_dx >= _dy) + if (_dx >= _dy) { if (_srcX != _dstX) { @@ -81,21 +81,18 @@ public final class LinePointIterator return true; } } - else + else if (_srcY != _dstY) { - if (_srcY != _dstY) + _srcY += _sy; + + _error += _dx; + if (_error >= _dy) { - _srcY += _sy; - - _error += _dx; - if (_error >= _dy) - { - _srcX += _sx; - _error -= _dy; - } - - return true; + _srcX += _sx; + _error -= _dy; } + + return true; } return false; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java index 771bbb5fc7..c9dd0c3840 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java @@ -75,7 +75,7 @@ public final class LinePointIterator3D _first = false; return true; } - else if ((_dx >= _dy) && (_dx >= _dz)) + if ((_dx >= _dy) && (_dx >= _dz)) { if (_srcX != _dstX) { @@ -121,28 +121,25 @@ public final class LinePointIterator3D return true; } } - else + else if (_srcZ != _dstZ) { - if (_srcZ != _dstZ) + _srcZ += _sz; + + _error += _dx; + if (_error >= _dz) { - _srcZ += _sz; - - _error += _dx; - if (_error >= _dz) - { - _srcX += _sx; - _error -= _dz; - } - - _error2 += _dy; - if (_error2 >= _dz) - { - _srcY += _sy; - _error2 -= _dz; - } - - return true; + _srcX += _sx; + _error -= _dz; } + + _error2 += _dy; + if (_error2 >= _dz) + { + _srcY += _sy; + _error2 -= _dz; + } + + return true; } return false; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/PrimeFinder.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/PrimeFinder.java index a454fd5289..e032195067 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/PrimeFinder.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/PrimeFinder.java @@ -1,18 +1,13 @@ /* - * This file is part of the L2J Mobius project. + * Copyright (c) 1999 CERN - European Organization for Nuclear Research. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear in + * supporting documentation. CERN makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without expressed or implied warranty. */ package com.l2jmobius.gameserver.util; @@ -331,7 +326,6 @@ public final class PrimeFinder 800076929, 1600153859 }; - static { // initializer // The above prime numbers are formatted for human readability. diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/commons/util/DeadLockDetector.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/commons/util/DeadLockDetector.java index e9f16e2ccc..ad202531e4 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/commons/util/DeadLockDetector.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/commons/util/DeadLockDetector.java @@ -114,7 +114,7 @@ public class DeadLockDetector extends Thread } catch (Exception e) { - LOGGER.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "DeadLockDetector: ", e); } } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java index aca0927afe..28a1fb79c0 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java @@ -184,7 +184,7 @@ public class GameServer if (!IdFactory.getInstance().isInitialized()) { LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration."); - throw new Exception("Could not initialize the ID factory"); + throw new Exception("Could not initialize the ID factory!"); } // load script engines @@ -273,6 +273,7 @@ public class GameServer if (Config.PREMIUM_SYSTEM_ENABLED) { + LOGGER.info("PremiumManager: Premium system is enabled."); PremiumManager.getInstance(); } @@ -466,7 +467,7 @@ public class GameServer /*** Main ***/ // Create log folder - final File logFolder = new File(".", LOG_FOLDER); + final File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER); logFolder.mkdir(); // Create input stream for log file -- or store file data into memory diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java index a4fc1b00a2..75089ff0f6 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java @@ -87,7 +87,6 @@ public final class ItemsAutoDestroy ItemsOnGroundManager.getInstance().removeObject(item); } } - } } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/MonsterRace.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/MonsterRace.java index 6387c1c3c6..2cf628c10f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/MonsterRace.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/MonsterRace.java @@ -16,7 +16,6 @@ */ package com.l2jmobius.gameserver; -import java.lang.reflect.Constructor; import java.util.logging.Level; import java.util.logging.Logger; @@ -64,14 +63,12 @@ public class MonsterRace try { final L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random); - final Constructor constructor = Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0]; - _monsters[i] = (L2Npc) constructor.newInstance(template); + _monsters[i] = (L2Npc) Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0].newInstance(template); } catch (Exception e) { - LOGGER.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "Unable to create monster!", e); } - // LOGGER.info("Monster "+i+" is id: "+(id+random)); } newSpeeds(); } @@ -87,14 +84,7 @@ public class MonsterRace total = 0; for (int j = 0; j < 20; j++) { - if (j == 19) - { - _speeds[i][j] = 100; - } - else - { - _speeds[i][j] = Rnd.get(60) + 65; - } + _speeds[i][j] = j == 19 ? 100 : Rnd.get(60) + 65; total += _speeds[i][j]; } if (total >= _first[1]) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/RecipeController.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/RecipeController.java index 06c67d16e2..5bf504afb5 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/RecipeController.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/RecipeController.java @@ -60,6 +60,7 @@ public class RecipeController protected RecipeController() { + // Prevent external initialization. } public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft) @@ -336,7 +337,6 @@ public class RecipeController if (Config.ALT_GAME_CREATION && !_items.isEmpty()) { - if (!calculateStatUse(true, true)) { return; // check stat use diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java index 2e99f8f99f..547750542b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java @@ -263,11 +263,10 @@ public class Shutdown extends Thread try { DatabaseFactory.getInstance().close(); - LOGGER.info("L2Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); + LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); } catch (Throwable t) { - } // server will quit, when this function ends. @@ -536,9 +535,6 @@ public class Shutdown extends Thread } } - /* - * if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true); - */ final TimeCounter tc = new TimeCounter(); // Save all raidboss and GrandBoss status ^_^ @@ -590,7 +586,7 @@ public class Shutdown extends Thread if (Config.BOTREPORT_ENABLE) { BotReportTable.getInstance().saveReportedCharData(); - LOGGER.info("Bot Report Table: Sucessfully saved reports to database!"); + LOGGER.info("Bot Report Table: Successfully saved reports to database!"); } try diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/cache/HtmCache.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/cache/HtmCache.java index fec436d1fa..2da85f99ff 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/cache/HtmCache.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/cache/HtmCache.java @@ -43,7 +43,7 @@ public class HtmCache private static final Pattern ABSTRACT_BLOCK_PATTERN = Pattern.compile("", Pattern.DOTALL); private static final Pattern BLOCK_PATTERN = Pattern.compile("(.*?)", Pattern.DOTALL); - private final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); + private static final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); private int _loadedFiles; private long _bytesBuffLen; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java index 6a19cc7d31..3f98953c02 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java @@ -204,14 +204,7 @@ public class Forum public Forum getChildByName(String name) { vload(); - for (Forum f : _children) - { - if (f.getName().equals(name)) - { - return f; - } - } - return null; + return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null); } /** @@ -220,7 +213,6 @@ public class Forum public void rmTopicByID(int id) { _topic.remove(id); - } public void insertIntoDb() diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java index bc05a8ff5c..a4df772cc3 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java @@ -46,9 +46,7 @@ public class ForumsBBSManager extends BaseBBSManager { while (rs.next()) { - final int forumId = rs.getInt("forum_id"); - final Forum f = new Forum(forumId, null); - addForum(f); + addForum(new Forum(rs.getInt("forum_id"), null)); } } catch (Exception e) @@ -62,10 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager */ public void initRoot() { - for (Forum f : _table) - { - f.vload(); - } + _table.forEach(f -> f.vload()); _log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index 188d99945c..7d74ef6eb4 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import com.l2jmobius.gameserver.communitybbs.BB.Forum; import com.l2jmobius.gameserver.communitybbs.BB.Post; -import com.l2jmobius.gameserver.communitybbs.BB.Post.CPost; import com.l2jmobius.gameserver.communitybbs.BB.Topic; import com.l2jmobius.gameserver.handler.CommunityBoardHandler; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -68,21 +67,8 @@ public class PostBBSManager extends BaseBBSManager st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); final int idp = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } - + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind); } else if (command.startsWith("_bbsposts;edit;")) @@ -106,7 +92,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); if ((forum == null) || (topic == null) || (p == null)) { - CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exit !


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exist!


    ", activeChar); } else { @@ -118,7 +104,7 @@ public class PostBBSManager extends BaseBBSManager { if ((forum == null) || (topic == null)) { - CommunityBoardHandler.separateAndSend("

    Error, this forum is not implemented yet


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error: This forum is not implemented yet!
    ", activeChar); } else if (forum.getType() == Forum.MEMO) { @@ -126,7 +112,7 @@ public class PostBBSManager extends BaseBBSManager } else { - CommunityBoardHandler.separateAndSend("

    the forum: " + forum.getName() + " is not implemented yet


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    The forum: " + forum.getName() + " is not implemented yet!
    ", activeChar); } } @@ -139,7 +125,6 @@ public class PostBBSManager extends BaseBBSManager private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum) { - // final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); @@ -176,8 +161,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(t); if (p != null) { - final CPost cp = p.getCPost(idp); - if (cp == null) + if (p.getCPost(idp) == null) { CommunityBoardHandler.separateAndSend("

    the post: " + idp + " does not exist !


    ", activeChar); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index db6e17a2b0..427f456b84 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -60,11 +60,7 @@ public class TopicBBSManager extends BaseBBSManager public int getMaxID(Forum f) { final Integer i = _maxId.get(f); - if (i == null) - { - return 0; - } - return i; + return i == null ? 0 : i; } public Topic getTopicByID(int idf) @@ -146,20 +142,8 @@ public class TopicBBSManager extends BaseBBSManager st.nextToken(); st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf); } else if (command.startsWith("_bbstopics;crea")) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java index d8dc164725..609f0858d5 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java @@ -170,12 +170,7 @@ public class CharNameTable public final int getAccessLevelById(int objectId) { - if (getNameById(objectId) != null) - { - return _accessLevels.get(objectId); - } - - return 0; + return getNameById(objectId) != null ? _accessLevels.get(objectId) : 0; } public synchronized boolean doesCharNameExist(String name) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java index 3f2fe830c7..c6ee79672c 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java @@ -67,7 +67,6 @@ import com.l2jmobius.gameserver.util.Util; public class ClanTable { private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName()); - private final Map _clans = new ConcurrentHashMap<>(); protected ClanTable() @@ -444,16 +443,13 @@ public class ClanTable for (L2Clan clan : _clans.values()) { final int allyId = clan.getAllyId(); - if ((allyId != 0) && (clan.getId() != allyId)) + if ((allyId != 0) && (clan.getId() != allyId) && !_clans.containsKey(allyId)) { - if (!_clans.containsKey(allyId)) - { - clan.setAllyId(0); - clan.setAllyName(null); - clan.changeAllyCrest(0, true); - clan.updateClanInDB(); - LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); - } + clan.setAllyId(0); + clan.setAllyName(null); + clan.changeAllyCrest(0, true); + clan.updateClanInDB(); + LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); } } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/EventDroplist.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/EventDroplist.java index c22e5eb0ee..ba8c26bbd8 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/EventDroplist.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/EventDroplist.java @@ -35,7 +35,7 @@ public class EventDroplist /** * The table containing all DataDrop object */ - private static final List _allNpcDateDrops = new CopyOnWriteArrayList<>(); + private static final List ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>(); public static class DateDrop { @@ -74,7 +74,7 @@ public class EventDroplist */ public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); } /** @@ -86,7 +86,7 @@ public class EventDroplist */ public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); } /** @@ -96,7 +96,7 @@ public class EventDroplist */ public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop) { - _allNpcDateDrops.add(new DateDrop(dateRange, eventDrop)); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, eventDrop)); } /** @@ -106,7 +106,7 @@ public class EventDroplist { final List list = new LinkedList<>(); final Date currentDate = new Date(); - for (DateDrop drop : _allNpcDateDrops) + for (DateDrop drop : ALL_NPC_DATE_DROPS) { if (drop._dateRange.isWithinRange(currentDate)) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/engines/DocumentBase.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/engines/DocumentBase.java index 0050c0a281..37410b0b38 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/engines/DocumentBase.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/engines/DocumentBase.java @@ -151,12 +151,11 @@ public abstract class DocumentBase protected final Logger _log = Logger.getLogger(getClass().getName()); private final File _file; - protected Map _tables; + protected final Map _tables = new HashMap<>(); protected DocumentBase(File pFile) { _file = pFile; - _tables = new HashMap<>(); } public Document parse() diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java index 0e3b945cf4..4d3be938c9 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java @@ -79,7 +79,6 @@ public final class DocumentItem extends DocumentBase implements IGameXmlReader { if ("list".equalsIgnoreCase(n.getNodeName())) { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("item".equalsIgnoreCase(d.getNodeName())) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/PlayerAction.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/PlayerAction.java index 95b3da5c8d..a9a2393db7 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/PlayerAction.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/PlayerAction.java @@ -30,7 +30,7 @@ public enum PlayerAction private PlayerAction() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/ShotType.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/ShotType.java index 2e98cb6d93..87e917b8bf 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/ShotType.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/enums/ShotType.java @@ -31,7 +31,7 @@ public enum ShotType private ShotType() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java index cb1452b64b..adf6462b78 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java @@ -34,8 +34,7 @@ public class AdminCommandHandler implements IHandler= FREE_OBJECT_ID_SIZE) { throw new NullPointerException("Ran out of valid Id's."); } + increaseBitSetCapacity(); } _nextFreeId.set(nextFree); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java index 6a3e232a26..002a6f75c3 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java @@ -316,7 +316,6 @@ public final class MapRegionManager implements IGameXmlReader return flags.stream().findAny().get().getLocation(); } } - } else if (fort != null) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java index 8f24f8dfc6..4e3abc79eb 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java @@ -191,7 +191,6 @@ public final class QuestManager { old.unload(); LOGGER.info("Replaced quest " + old.getName() + " (" + old.getId() + ") with a new version!"); - } if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java index e3235b056e..cd7118dc3b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java @@ -427,7 +427,7 @@ public final class SellBuffsManager implements IGameXmlReader } else if (player.isMounted() || player.isFlyingMounted() || player.isFlying()) { - player.sendMessage("You can't sell buffs in Mounth state!"); + player.sendMessage("You can't sell buffs in Mount state!"); return false; } else if (player.isTransformed()) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java index 70cfb5d922..5e16e5a91f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java @@ -71,9 +71,7 @@ public final class MessageDeletionTask implements Runnable final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId()); if (receiver != null) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME); - // sm.addString(msg.getReceiverName()); - receiver.sendPacket(sm); + receiver.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME)); } } catch (Exception e) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java index 43cf6815de..964757069c 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java @@ -78,7 +78,7 @@ public abstract class AbstractPlayerGroup */ public boolean isLeader(L2PcInstance player) { - return (getLeaderObjectId() == player.getObjectId()); + return getLeaderObjectId() == player.getObjectId(); } /** diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/AggroInfo.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/AggroInfo.java index 3be79b12bb..613e113b28 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/AggroInfo.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/AggroInfo.java @@ -93,4 +93,10 @@ public final class AggroInfo { return _attacker.getObjectId(); } + + @Override + public String toString() + { + return "AggroInfo [attacker=" + _attacker + ", hate=" + _hate + ", damage=" + _damage + "]"; + } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/BlockList.java index 08918cc853..627b0dbbe4 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/BlockList.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/BlockList.java @@ -33,14 +33,10 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.BlockListPacket; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -/** - * This class ... - * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $ - */ public class BlockList { private static Logger _log = Logger.getLogger(BlockList.class.getName()); - private static Map> _offlineList = new ConcurrentHashMap<>(); + private static final Map> OFFLINE_LIST = new ConcurrentHashMap<>(); private final L2PcInstance _owner; private List _blockList; @@ -48,7 +44,7 @@ public class BlockList public BlockList(L2PcInstance owner) { _owner = owner; - _blockList = _offlineList.get(owner.getObjectId()); + _blockList = OFFLINE_LIST.get(owner.getObjectId()); if (_blockList == null) { _blockList = loadList(_owner.getObjectId()); @@ -69,7 +65,7 @@ public class BlockList public void playerLogout() { - _offlineList.put(_owner.getObjectId(), _blockList); + OFFLINE_LIST.put(_owner.getObjectId(), _blockList); } private static List loadList(int ObjId) @@ -263,10 +259,10 @@ public class BlockList { return BlockList.isBlocked(player, targetId); } - if (!_offlineList.containsKey(ownerId)) + if (!OFFLINE_LIST.containsKey(ownerId)) { - _offlineList.put(ownerId, loadList(ownerId)); + OFFLINE_LIST.put(ownerId, loadList(ownerId)); } - return _offlineList.get(ownerId).contains(targetId); + return OFFLINE_LIST.get(ownerId).contains(targetId); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java index ee640a3d9c..047d3d7074 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java @@ -49,17 +49,7 @@ public final class DamageDoneInfo @Override public final boolean equals(Object obj) { - if (this == obj) - { - return true; - } - - if (obj instanceof DamageDoneInfo) - { - return (((DamageDoneInfo) obj).getAttacker() == _attacker); - } - - return false; + return (this == obj) || ((obj instanceof DamageDoneInfo) && (((DamageDoneInfo) obj).getAttacker() == _attacker)); } @Override diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2AccessLevel.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2AccessLevel.java index a050f2f872..aefc7fb15d 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2AccessLevel.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2AccessLevel.java @@ -23,29 +23,19 @@ import com.l2jmobius.gameserver.data.xml.impl.AdminData; */ public class L2AccessLevel { - /** - * The access level
    - */ + /** The access level. */ private int _accessLevel = 0; - /** - * The access level name
    - */ + /** The access level name. */ private String _name = null; - /** Child access levels */ + /** Child access levels. */ L2AccessLevel _childsAccessLevel = null; - /** Child access levels */ + /** Child access levels. */ private int _child = 0; - /** - * The name color for the access level
    - */ + /** The name color for the access level. */ private int _nameColor = 0; - /** - * The title color for the access level
    - */ + /** The title color for the access level. */ private int _titleColor = 0; - /** - * Flag to determine if the access level has gm access
    - */ + /** Flag to determine if the access level has GM access. */ private boolean _isGm = false; /** Flag for peace zone attack */ private boolean _allowPeaceAttack = false; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java index 08b62e547b..e1bbddd336 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -219,7 +219,7 @@ public class L2Clan implements IIdentifiable, INamable */ public int getLeaderId() { - return (_leader != null ? _leader.getObjectId() : 0); + return _leader != null ? _leader.getObjectId() : 0; } /** @@ -261,7 +261,6 @@ public class L2Clan implements IIdentifiable, INamable } exLeader.getClanPrivileges().clear(); exLeader.broadcastUserInfo(); - } else { @@ -378,6 +377,7 @@ public class L2Clan implements IIdentifiable, INamable player.setPledgeClass(L2ClanMember.calculatePledgeClass(player)); player.sendPacket(new PledgeShowMemberListUpdate(player)); player.sendPacket(new PledgeSkillList(this)); + addSkillEffects(player); // Notify to scripts @@ -1334,7 +1334,6 @@ public class L2Clan implements IIdentifiable, INamable Skill oldSkill = null; if (newSkill != null) { - if (subType == -2) { oldSkill = _skills.put(newSkill.getId(), newSkill); @@ -1793,12 +1792,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final SubPledge getSubPledge(int pledgeType) { - if (_subPledges == null) - { - return null; - } - - return _subPledges.get(pledgeType); + return _subPledges == null ? null : _subPledges.get(pledgeType); } /** @@ -1999,21 +1993,15 @@ public class L2Clan implements IIdentifiable, INamable public void initializePrivs() { - RankPrivs privs; for (int i = 1; i < 10; i++) { - privs = new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false)); - _privs.put(i, privs); + _privs.put(i, new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false))); } } public EnumIntBitmask getRankPrivs(int rank) { - if (_privs.get(rank) != null) - { - return _privs.get(rank).getPrivs(); - } - return new EnumIntBitmask<>(ClanPrivilege.class, false); + return _privs.get(rank) != null ? _privs.get(rank).getPrivs() : new EnumIntBitmask<>(ClanPrivilege.class, false); } public void setRankPrivs(int rank, int privs) @@ -2080,12 +2068,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final RankPrivs[] getAllRankPrivs() { - if (_privs == null) - { - return new RankPrivs[0]; - } - - return _privs.values().toArray(new RankPrivs[_privs.values().size()]); + return _privs == null ? new RankPrivs[0] : _privs.values().toArray(new RankPrivs[_privs.values().size()]); } public int getLeaderSubPledge(int leaderId) @@ -2417,13 +2400,10 @@ public class L2Clan implements IIdentifiable, INamable player.sendPacket(SystemMessageId.TO_CREATE_AN_ALLIANCE_YOUR_CLAN_MUST_BE_LEVEL_5_OR_HIGHER); return; } - if (getAllyPenaltyExpiryTime() > System.currentTimeMillis()) + if ((getAllyPenaltyExpiryTime() > System.currentTimeMillis()) && (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY)) { - if (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); - return; - } + player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); + return; } if (getDissolvingExpiryTime() > System.currentTimeMillis()) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ClanMember.java index 02d3c77259..139c302ce9 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ClanMember.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ClanMember.java @@ -151,8 +151,8 @@ public class L2ClanMember } /** - * Checks if is online. - * @return true, if is online + * Verifies if the clan member is online. + * @return {@code true} if is online */ public boolean isOnline() { @@ -263,11 +263,7 @@ public class L2ClanMember */ public int getPowerGrade() { - if (_player != null) - { - return _player.getPowerGrade(); - } - return _powerGrade; + return _player != null ? _player.getPowerGrade() : _powerGrade; } /** @@ -323,11 +319,7 @@ public class L2ClanMember */ public int getRaceOrdinal() { - if (_player != null) - { - return _player.getRace().ordinal(); - } - return _raceOrdinal; + return _player != null ? _player.getRace().ordinal() : _raceOrdinal; } /** @@ -336,11 +328,7 @@ public class L2ClanMember */ public boolean getSex() { - if (_player != null) - { - return _player.getAppearance().getSex(); - } - return _sex; + return _player != null ? _player.getAppearance().getSex() : _sex; } /** @@ -349,11 +337,7 @@ public class L2ClanMember */ public int getSponsor() { - if (_player != null) - { - return _player.getSponsor(); - } - return _sponsor; + return _player != null ? _player.getSponsor() : _sponsor; } /** @@ -362,11 +346,7 @@ public class L2ClanMember */ public int getApprentice() { - if (_player != null) - { - return _player.getApprentice(); - } - return _apprentice; + return _player != null ? _player.getApprentice() : _apprentice; } /** diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2CommandChannel.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2CommandChannel.java index bb1b4b57c4..d91e7e0554 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2CommandChannel.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2CommandChannel.java @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class L2CommandChannel extends AbstractPlayerGroup { private final List _parties = new CopyOnWriteArrayList<>(); - private L2PcInstance _commandLeader = null; + private L2PcInstance _commandLeader; private int _channelLvl; /** diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java index 09025eeed1..f485978cf6 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java @@ -68,19 +68,11 @@ public class L2GroupSpawn extends L2Spawn final L2Npc mob = new L2ControllableMobInstance(_template); mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp()); - if (getHeading() == -1) - { - mob.setHeading(Rnd.nextInt(61794)); - } - else - { - mob.setHeading(getHeading()); - } + mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading()); mob.setSpawn(this); mob.spawnMe(newlocx, newlocy, newlocz); return mob; - } catch (Exception e) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java index 7875bdbb6a..905a58c1b8 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java @@ -35,7 +35,7 @@ public class L2NpcWalkerNode extends Location _delay = delay; _runToLocation = runToLocation; _npcString = npcString; - _chatString = ((chatText == null) ? "" : chatText); + _chatString = (chatText == null) ? "" : chatText; } public int getDelay() diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Object.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Object.java index 9164db110c..171ad1e543 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Object.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Object.java @@ -782,7 +782,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared) { final double distance = Math.pow(x - getX(), 2) + Math.pow(y - getY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0); - return (squared) ? distance : Math.sqrt(distance); + return squared ? distance : Math.sqrt(distance); } /** @@ -898,12 +898,12 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab @Override public boolean equals(Object obj) { - return ((obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId())); + return (obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId()); } @Override public String toString() { - return (getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"); + return getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"; } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java index 469b9843cc..c0fad148f8 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java @@ -53,5 +53,4 @@ public class L2RecipeInstance { return _quantity; } - } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java index ae06fa8c1b..c22321462d 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java @@ -55,5 +55,4 @@ public class L2RecipeStatInstance { return _value; } - } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Territory.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Territory.java index 5152d69c0d..41cb26df2b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Territory.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Territory.java @@ -16,8 +16,8 @@ */ package com.l2jmobius.gameserver.model; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Logger; import com.l2jmobius.commons.util.Rnd; @@ -44,7 +44,7 @@ public class L2Territory } } - private final List _points = new ArrayList<>(); + private final List _points = new CopyOnWriteArrayList<>(); private final int _terr; private int _xMin; private int _xMax; @@ -96,14 +96,6 @@ public class L2Territory _procMax += proc; } - public void print() - { - for (Point p : _points) - { - _log.info("(" + p._x + "," + p._y + ")"); - } - } - public boolean isIntersect(int x, int y, Point p1, Point p2) { final double dy1 = p1._y - y; @@ -163,7 +155,6 @@ public class L2Territory return new Location(p1._x, p1._y, Rnd.get(p1._zmin, p1._zmax)); } } - } for (int i = 0; i < 100; i++) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2World.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2World.java index 805e0c0ed2..9b02364b07 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2World.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2World.java @@ -282,20 +282,20 @@ public final class L2World } /** - * Add a L2Object in the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Add a L2Object in the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Add the L2Object object in _allPlayers* of L2World
  • *
  • Add the L2Object object in _gmList** of GmListTable
  • - *
  • Add object in _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding PlayerInstance in its _knownPlayer

  • - * * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of WorldRegion (need synchronisation)
    + *
  • Add object in _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding L2PcInstance in its _knownPlayer

  • + * * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of L2WorldRegion (need synchronisation)
    * Caution : This method DOESN'T ADD the object to _allObjects and _allPlayers* of L2World (need synchronisation) Example of use : *
  • Drop an Item
  • *
  • Spawn a L2Character
  • - *
  • Apply Death Penalty of a PlayerInstance
  • + *
  • Apply Death Penalty of a L2PcInstance
  • * @param object L2object to add in the world - * @param newRegion WorldRegion in wich the object will be add (not used) + * @param newRegion L2WorldRegion in wich the object will be add (not used) */ public void addVisibleObject(L2Object object, L2WorldRegion newRegion) { @@ -371,18 +371,18 @@ public final class L2World } /** - * Remove a L2Object from the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Remove a L2Object from the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Remove the L2Object object from _allPlayers* of L2World
  • - *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of WorldRegion
  • + *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of L2WorldRegion
  • *
  • Remove the L2Object object from _gmList** of GmListTable
  • - *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all PlayerInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Example of use : + *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all L2PcInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Example of use : *
  • Pickup an Item
  • *
  • Decay a L2Character
  • * @param object L2object to remove from the world - * @param oldRegion WorldRegion in which the object was before removing + * @param oldRegion L2WorldRegion in which the object was before removing */ public void removeVisibleObject(L2Object object, L2WorldRegion oldRegion) { @@ -395,7 +395,7 @@ public final class L2World { oldRegion.removeVisibleObject(object); - // Go through all surrounding WorldRegion Creatures + // Go through all surrounding L2WorldRegion L2Characters oldRegion.forEachSurroundingRegion(w -> { for (L2Object wo : w.getVisibleObjects().values()) @@ -714,7 +714,7 @@ public final class L2World } /** - * Calculate the current WorldRegions of the object according to its position (x,y). Example of use : + * Calculate the current L2WorldRegions of the object according to its position (x,y). Example of use : *
  • Set position of a new L2Object (drop, spawn...)
  • *
  • Update position of a L2Object after a movement

  • * @param point position of the object @@ -749,12 +749,12 @@ public final class L2World } /** - * Check if the current WorldRegions of the object is valid according to its position (x,y). Example of use : - *
  • Init WorldRegions

  • + * Check if the current L2WorldRegions of the object is valid according to its position (x,y). Example of use : + *
  • Init L2WorldRegions

  • * @param x X position of the object * @param y Y position of the object * @param z Z position of the object - * @return True if the WorldRegion is valid + * @return True if the L2WorldRegion is valid */ public static boolean validRegion(int x, int y, int z) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 6bfaf3a33d..97608b326d 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -136,7 +136,6 @@ public final class L2WorldRegion } LOGGER.finer(c + " mobs were turned on"); } - } public boolean isActive() diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MobGroup.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MobGroup.java index 88cc4a5599..4eb38cf27b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MobGroup.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MobGroup.java @@ -191,8 +191,7 @@ public final class MobGroup final int y = player.getY() + Rnd.nextInt(50); mobInst.teleToLocation(new Location(x, y, player.getZ()), true); - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(player); + ((L2ControllableMobAI) mobInst.getAI()).follow(player); } } } @@ -294,8 +293,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.forceAttack(target); + ((L2ControllableMobAI) mobInst.getAI()).forceAttack(target); } } @@ -310,8 +308,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.stop(); + ((L2ControllableMobAI) mobInst.getAI()).stop(); } } @@ -347,8 +344,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(character); + ((L2ControllableMobAI) mobInst.getAI()).follow(character); } } @@ -363,8 +359,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setAlternateAI(L2ControllableMobAI.AI_CAST); + ((L2ControllableMobAI) mobInst.getAI()).setAlternateAI(L2ControllableMobAI.AI_CAST); } } @@ -379,8 +374,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setNotMoving(enabled); + ((L2ControllableMobAI) mobInst.getAI()).setNotMoving(enabled); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MobGroupTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MobGroupTable.java index db0a789765..da1b620a40 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MobGroupTable.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MobGroupTable.java @@ -75,7 +75,7 @@ public class MobGroupTable public boolean removeGroup(int groupKey) { - return (_groupMap.remove(groupKey) != null); + return _groupMap.remove(groupKey) != null; } private static class SingletonHolder diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/Petition.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/Petition.java index 8596c3ea61..cbed80441a 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/Petition.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/Petition.java @@ -98,7 +98,7 @@ public final class Petition } PetitionManager.getInstance().getCompletedPetitions().put(getId(), this); - return (PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null); + return PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null; } public String getContent() diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/ShortCuts.java index 2bbf25dee0..3f8d959ef6 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/ShortCuts.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/ShortCuts.java @@ -55,13 +55,10 @@ public class ShortCuts implements IRestorable { Shortcut sc = _shortCuts.get(slot + (page * MAX_SHORTCUTS_PER_BAR)); // Verify shortcut - if ((sc != null) && (sc.getType() == ShortcutType.ITEM)) + if ((sc != null) && (sc.getType() == ShortcutType.ITEM) && (_owner.getInventory().getItemByObjectId(sc.getId()) == null)) { - if (_owner.getInventory().getItemByObjectId(sc.getId()) == null) - { - deleteShortCut(sc.getSlot(), sc.getPage()); - sc = null; - } + deleteShortCut(sc.getSlot(), sc.getPage()); + sc = null; } return sc; } @@ -78,8 +75,7 @@ public class ShortCuts implements IRestorable } shortcut.setSharedReuseGroup(item.getSharedReuseGroup()); } - final Shortcut oldShortCut = _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut); - registerShortCutInDb(shortcut, oldShortCut); + registerShortCutInDb(shortcut, _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut)); } private void registerShortCutInDb(Shortcut shortcut, Shortcut oldShortCut) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/TradeList.java index 29362b8549..eeee7d0cae 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/TradeList.java @@ -149,11 +149,7 @@ public class TradeList { if (exclItem.getItem().getId() == item.getId()) { - if (item.getCount() <= exclItem.getCount()) - { - return null; - } - return new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice()); + return item.getCount() <= exclItem.getCount() ? null : new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice()); } } } @@ -440,11 +436,7 @@ public class TradeList { partnerList.lock(); lock(); - if (!partnerList.validate()) - { - return false; - } - if (!validate()) + if (!partnerList.validate() || !validate()) { return false; } @@ -616,12 +608,12 @@ public class TradeList boolean success = false; // check weight and slots - if ((!getOwner().getInventory().validateWeight(partnerList.calcItemsWeight())) || !(partnerList.getOwner().getInventory().validateWeight(calcItemsWeight()))) + if (!getOwner().getInventory().validateWeight(partnerList.calcItemsWeight()) || !partnerList.getOwner().getInventory().validateWeight(calcItemsWeight())) { partnerList.getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT); getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT); } - else if ((!getOwner().getInventory().validateCapacity(partnerList.countItemsSlots(getOwner()))) || (!partnerList.getOwner().getInventory().validateCapacity(countItemsSlots(partnerList.getOwner())))) + else if (!getOwner().getInventory().validateCapacity(partnerList.countItemsSlots(getOwner())) || !partnerList.getOwner().getInventory().validateCapacity(countItemsSlots(partnerList.getOwner()))) { partnerList.getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL); getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL); @@ -846,42 +838,36 @@ public class TradeList } // Send messages about the transaction to both players + SystemMessage msg; if (newItem.isStackable()) { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); + msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); msg.addString(player.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); msg.addString(_owner.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); - player.sendPacket(msg); } else { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); + msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); msg.addString(player.getName()); msg.addItemName(newItem); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); msg.addString(_owner.getName()); msg.addItemName(newItem); - player.sendPacket(msg); } + player.sendPacket(msg); } // Send inventory update packet _owner.sendInventoryUpdate(ownerIU); player.sendInventoryUpdate(playerIU); - if (ok) - { - return 0; - } - return 2; + return ok ? 0 : 2; } /** @@ -892,12 +878,7 @@ public class TradeList */ public synchronized boolean privateStoreSell(L2PcInstance player, ItemRequest[] requestedItems) { - if (_locked) - { - return false; - } - - if (!_owner.isOnline() || !player.isOnline()) + if (_locked || !_owner.isOnline() || !player.isOnline()) { return false; } @@ -1037,32 +1018,30 @@ public class TradeList } // Send messages about the transaction to both players + SystemMessage msg; if (newItem.isStackable()) { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); + msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); msg.addString(player.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); msg.addString(_owner.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); - player.sendPacket(msg); } else { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); + msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); msg.addString(player.getName()); msg.addItemName(newItem); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); msg.addString(_owner.getName()); msg.addItemName(newItem); - player.sendPacket(msg); } + player.sendPacket(msg); } if (totalPrice > 0) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java index d77bf6af86..6892d0798a 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java @@ -454,21 +454,18 @@ public final class BlockCheckerEngine switch (_round) { - case 1: + case 1: // Schedule second spawn round { - // Schedule second spawn round _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); break; } - case 2: + case 2: // Schedule third spawn round { - // Schedule third spawn round _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); break; } - case 3: + case 3: // Schedule Event End Count Down { - // Schedule Event End Count Down _task = ThreadPool.schedule(new EndEvent(), 180000); break; } @@ -572,7 +569,7 @@ public final class BlockCheckerEngine /* * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_WILL_END_IN_5_SECONDS)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } + * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } */ /** @@ -652,7 +649,7 @@ public final class BlockCheckerEngine } /** - * Reward the speicifed team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra + * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra * @param isRed */ private void rewardAsWinner(boolean isRed) @@ -714,8 +711,7 @@ public final class BlockCheckerEngine */ private void rewardAsLooser(boolean isRed) { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - for (Entry entry : tempPoints.entrySet()) + for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) { final L2PcInstance player = entry.getKey(); if ((player != null) && (entry.getValue() >= 10)) @@ -726,7 +722,7 @@ public final class BlockCheckerEngine } /** - * Telport players back, give status back and send final packet + * Teleport players back, give status back and send final packet */ private void setPlayersBack() { @@ -748,13 +744,11 @@ public final class BlockCheckerEngine final PcInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); } if (inv.getItemByItemId(13788) != null) { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); } broadcastRelationChanged(player); // Teleport Back diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Couple.java index 7901689adf..c31232e232 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Couple.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Couple.java @@ -99,7 +99,7 @@ public class Couple } catch (Exception e) { - _log.log(Level.SEVERE, "Could not create couple:", e); + _log.log(Level.SEVERE, "Could not create couple: " + e.getMessage(), e); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java index e9b3160a50..75ec9236b8 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -192,12 +192,7 @@ public final class Fort extends AbstractResidence } if ((getOwnerClan().getWarehouse().getAdena() >= _fee) || !_cwh) { - int fee = _fee; - if (getEndTime() == -1) - { - fee = _tempFee; - } - + final int fee = getEndTime() == -1 ? _tempFee : _fee; setEndTime(System.currentTimeMillis() + getRate()); dbSave(); if (_cwh) @@ -549,7 +544,6 @@ public final class Fort extends AbstractResidence if (door != null) { door.setCurrentHp(door.getMaxHp() + hp); - saveDoorUpgrade(doorId, hp, pDef, mDef); } } @@ -589,7 +583,7 @@ public final class Fort extends AbstractResidence long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis(); while (initial > (Config.FS_UPDATE_FRQ * 60000L)) { - initial -= (Config.FS_UPDATE_FRQ * 60000L); + initial -= Config.FS_UPDATE_FRQ * 60000L; } initial = (Config.FS_UPDATE_FRQ * 60000L) - initial; if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600))) @@ -609,7 +603,6 @@ public final class Fort extends AbstractResidence { setOwnerClan(null); } - } catch (Exception e) { @@ -675,12 +668,9 @@ public final class Fort extends AbstractResidence { return false; } - if (lease > 0) + if ((lease > 0) && !player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) { - if (!player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) - { - return false; - } + return false; } if (addNew) { @@ -690,20 +680,16 @@ public final class Fort extends AbstractResidence { removeFunction(type); } + else if ((lease - _function.get(type).getLease()) > 0) + { + _function.remove(type); + _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); + } else { - final int diffLease = lease - _function.get(type).getLease(); - if (diffLease > 0) - { - _function.remove(type); - _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); - } - else - { - _function.get(type).setLease(lease); - _function.get(type).setLvl(lvl); - _function.get(type).dbSave(); - } + _function.get(type).setLease(lease); + _function.get(type).setLvl(lvl); + _function.get(type).dbSave(); } return true; } @@ -934,31 +920,17 @@ public final class Fort extends AbstractResidence public final int getOwnedTime() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); } public final int getTimeTillRebelArmy() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); } public final long getTimeTillNextFortUpdate() { - if (_FortUpdater[0] == null) - { - return 0; - } - return _FortUpdater[0].getDelay(TimeUnit.SECONDS); + return _FortUpdater[0] == null ? 0 : _FortUpdater[0].getDelay(TimeUnit.SECONDS); } public void updateClansReputation(L2Clan owner, boolean removePoints) @@ -999,7 +971,6 @@ public final class Fort extends AbstractResidence _log.log(Level.WARNING, "Exception in endFortressSiege " + e.getMessage(), e); } } - } /** diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/L2Event.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/L2Event.java index ad93bd97a4..be28d47897 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/L2Event.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/L2Event.java @@ -46,7 +46,8 @@ import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse; import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; /** - * @since $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $ This ancient thingie got reworked by Nik at $Date: 2011/05/17 21:51:39 $ Yeah, for 6 years no one bothered reworking this buggy event engine. + * @author Nik + * @Since 2011/05/17 21:51:39 */ public class L2Event { @@ -164,7 +165,6 @@ public class L2Event try { final L2Spawn spawn = new L2Spawn(_npcId); - spawn.setX(target.getX() + 50); spawn.setY(target.getY() + 50); spawn.setZ(target.getZ()); @@ -184,13 +184,11 @@ public class L2Event spawn.getLastSpawn().broadcastPacket(new MagicSkillUse(spawn.getLastSpawn(), spawn.getLastSpawn(), 1034, 1, 1, 1)); // _npcs.add(spawn.getLastSpawn()); - } catch (Exception e) { _log.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e); } - } /** @@ -274,7 +272,6 @@ public class L2Event */ public static void removeAndResetPlayer(L2PcInstance player) { - try { if (isParticipant(player)) @@ -475,7 +472,6 @@ public class L2Event biggestLvlPlayer.setEventStatus(); i = (i + 1) % _teamsNumber; } - } catch (Exception e) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java index 64f1bd2117..08f8d8f701 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java @@ -30,7 +30,7 @@ public final class InstanceReenterTimeHolder private int _minute = -1; private long _time = -1; - public InstanceReenterTimeHolder(int time) + public InstanceReenterTimeHolder(long time) { _time = TimeUnit.MINUTES.toMillis(time); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java index ee59be43a2..03514cc06f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java @@ -45,5 +45,4 @@ public interface IParserAdvUtils extends IParserUtils Duration getDuration(String key); > T getEnum(String key, Class clazz); - } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java index 3930368188..f97917af4f 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java @@ -62,7 +62,7 @@ public final class ClanWarehouse extends Warehouse @Override public boolean validateCapacity(long slots) { - return ((_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN); + return (_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN; } @Override diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index a3e5358978..076cfe435a 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -1806,7 +1806,7 @@ public final class L2ItemInstance extends L2Object public boolean isTimeLimitedItem() { - return (_time > 0); + return _time > 0; } /** diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java index a4d6c7d9db..2d9fc312b0 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java @@ -49,5 +49,5 @@ public enum MaterialType FISH, RUNE_XP, RUNE_SP, - RUNE_REMOVE_PENALTY + RUNE_REMOVE_PENALTY; } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java index fa5b5c1ecc..6add6b73be 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java @@ -156,7 +156,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ protected void onLoad() { - } /** @@ -167,7 +166,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onSave() { - } /** @@ -1057,7 +1055,7 @@ public class Quest extends AbstractScript implements IIdentifiable */ public String onDeath(L2Character killer, L2Character victim, QuestState qs) { - return onAdvEvent("", ((killer instanceof L2Npc) ? ((L2Npc) killer) : null), qs.getPlayer()); + return onAdvEvent("", (killer instanceof L2Npc) ? (L2Npc) killer : null, qs.getPlayer()); } /** @@ -1390,7 +1388,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) { - } /** @@ -1400,7 +1397,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadLose(L2PcInstance loser, CompetitionType type) { - } /** @@ -1409,7 +1405,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onMoveFinished(L2Npc npc) { - } /** @@ -1418,7 +1413,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onNodeArrived(L2Npc npc) { - } /** @@ -1427,7 +1421,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onRouteFinished(L2Npc npc) { - } /** @@ -2625,11 +2618,7 @@ public class Quest extends AbstractScript implements IIdentifiable } } } - if ((luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc)) - { - return luckyPlayer; - } - return null; + return (luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc) ? luckyPlayer : null; } /** @@ -2664,15 +2653,7 @@ public class Quest extends AbstractScript implements IIdentifiable QuestState qs = player.getQuestState(getName()); if (!player.isInParty()) { - if (!checkPartyMemberConditions(qs, condition, target)) - { - return null; - } - if (!checkDistanceToTarget(player, target)) - { - return null; - } - return qs; + return !checkPartyMemberConditions(qs, condition, target) || !checkDistanceToTarget(player, target) ? null : qs; } final List candidates = new ArrayList<>(); @@ -2704,21 +2685,17 @@ public class Quest extends AbstractScript implements IIdentifiable } qs = candidates.get(getRandom(candidates.size())); - if (!checkDistanceToTarget(qs.getPlayer(), target)) - { - return null; - } - return qs; + return !checkDistanceToTarget(qs.getPlayer(), target) ? null : qs; } private boolean checkPartyMemberConditions(QuestState qs, int condition, L2Npc npc) { - return ((qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc)); + return (qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc); } private static boolean checkDistanceToTarget(L2PcInstance player, L2Npc target) { - return ((target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true)); + return (target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true); } /** @@ -2826,7 +2803,7 @@ public class Quest extends AbstractScript implements IIdentifiable { for (int id : items) { - if (ItemTable.getInstance().getTemplate(id) == null) + if ((id != 0) && (ItemTable.getInstance().getTemplate(id) == null)) { _log.severe(super.getClass().getSimpleName() + ": Found registerQuestItems for non existing item: " + id + "!"); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/QuestState.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/QuestState.java index abf9825d8e..23c0acc8d1 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/QuestState.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/QuestState.java @@ -114,7 +114,7 @@ public final class QuestState */ public boolean isCreated() { - return (_state == State.CREATED); + return _state == State.CREATED; } /** @@ -123,7 +123,7 @@ public final class QuestState */ public boolean isStarted() { - return (_state == State.STARTED); + return _state == State.STARTED; } /** @@ -132,7 +132,7 @@ public final class QuestState */ public boolean isCompleted() { - return (_state == State.COMPLETED); + return _state == State.COMPLETED; } /** @@ -340,10 +340,10 @@ public final class QuestState // since no flag had been skipped until now, the least significant bits must all // be set to 1, up until "old" number of bits. - completedStateFlags |= ((1 << old) - 1); + completedStateFlags |= (1 << old) - 1; // now, just set the bit corresponding to the passed cond to 1 (current step) - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } } @@ -352,7 +352,7 @@ public final class QuestState else if (cond < old) { // note, this also unsets the flag indicating that there exist skips - completedStateFlags &= ((1 << cond) - 1); + completedStateFlags &= (1 << cond) - 1; // now, check if this resulted in no steps being skipped any more if (completedStateFlags == ((1 << cond) - 1)) @@ -372,7 +372,7 @@ public final class QuestState // Just mark this state and we are done. else { - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } @@ -463,7 +463,7 @@ public final class QuestState */ public boolean isCond(int condition) { - return (getInt("cond") == condition); + return getInt("cond") == condition; } /** @@ -523,7 +523,7 @@ public final class QuestState */ public boolean isSet(String variable) { - return (get(variable) != null); + return get(variable) != null; } /** @@ -578,7 +578,7 @@ public final class QuestState public boolean isMemoState(int memoState) { - return (getInt("memoState") == memoState); + return getInt("memoState") == memoState; } /** @@ -823,7 +823,7 @@ public final class QuestState public boolean isNowAvailable() { final String val = get("restartTime"); - return (val != null) && (!Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis())); + return (val == null) || !Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis()); } public void setSimulated(boolean simulated) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/TraitType.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/TraitType.java index e7a799703d..890e7b48b8 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/TraitType.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/stats/TraitType.java @@ -83,7 +83,7 @@ public enum TraitType { _type = type; } - + public int getType() { return _type; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java index 4433e97b28..f431bdab71 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java @@ -49,13 +49,13 @@ public class ZoneCuboid extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_r.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _r.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -65,9 +65,9 @@ public class ZoneCuboid extends L2ZoneForm final int _x2 = _r.x + _r.width; final int _y1 = _r.y; final int _y2 = _r.y + _r.height; - double test, shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); + double test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); + double shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); - test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); if (test < shortestDist) { shortestDist = test; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java index afdfd3fade..5f3b143379 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java @@ -43,11 +43,7 @@ public class ZoneCylinder extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - if (((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) > _radS) || (z < _z1) || (z > _z2)) - { - return false; - } - return true; + return ((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) <= _radS) && (z >= _z1) && (z <= _z2); } @Override @@ -130,9 +126,7 @@ public class ZoneCylinder extends L2ZoneForm final double angle = (2 * Math.PI) / count; for (int i = 0; i < count; i++) { - final int x = (int) (Math.cos(angle * i) * _rad); - final int y = (int) (Math.sin(angle * i) * _rad); - dropDebugItem(Inventory.ADENA_ID, 1, _x + x, _y + y, z); + dropDebugItem(Inventory.ADENA_ID, 1, _x + (int) (Math.cos(angle * i) * _rad), _y + (int) (Math.sin(angle * i) * _rad), z); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java index 2340c1b218..d1ef507961 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java @@ -51,13 +51,13 @@ public class ZoneNPoly extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_p.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _p.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -95,25 +95,15 @@ public class ZoneNPoly extends L2ZoneForm @Override public void visualizeZone(int z) { - final int[] _x = _p.xpoints; - final int[] _y = _p.ypoints; - for (int i = 0; i < _p.npoints; i++) { - int nextIndex = i + 1; - // ending point to first one - if (nextIndex == _x.length) - { - nextIndex = 0; - } - final int vx = _x[nextIndex] - _x[i]; - final int vy = _y[nextIndex] - _y[i]; - float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)); - lenght /= STEP; + final int nextIndex = (i + 1) == _p.xpoints.length ? 0 : i + 1; + final int vx = _p.xpoints[nextIndex] - _p.xpoints[i]; + final int vy = _p.ypoints[nextIndex] - _p.ypoints[i]; + final float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)) / STEP; for (int o = 1; o <= lenght; o++) { - final float k = o / lenght; - dropDebugItem(Inventory.ADENA_ID, 1, (int) (_x[i] + (k * vx)), (int) (_y[i] + (k * vy)), z); + dropDebugItem(Inventory.ADENA_ID, 1, (int) (_p.xpoints[i] + ((o / lenght) * vx)), (int) (_p.ypoints[i] + ((o / lenght) * vy)), z); } } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java index 09ea4b531a..904a7f2919 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public final class L2CastleZone extends L2ResidenceZone { - public L2CastleZone(int id) { super(id); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java index ec9a75b975..a1a99b7051 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java @@ -99,7 +99,7 @@ public class L2NoRestartZone extends L2ZoneType return; } - if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.getInstance().getStartedTime()) > getRestartAllowedTime())) + if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis()) > getRestartAllowedTime())) { player.teleToLocation(TeleportWhereType.TOWN); } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java index 45e377e22a..b3b1c77f42 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java @@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public class L2NoSummonFriendZone extends L2ZoneType { - public L2NoSummonFriendZone(int id) { super(id); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java index cb7760aee0..9ab43dd1cd 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java @@ -71,12 +71,7 @@ public class L2ResidenceHallTeleportZone extends L2ResidenceTeleportZone @Override public void run() { - int index = 0; - if (getSpawns().size() > 1) - { - index = Rnd.get(getSpawns().size()); - } - + final int index = getSpawns().size() > 1 ? Rnd.get(getSpawns().size()) : 0; final Location loc = getSpawns().get(index); if (loc == null) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java index e63f1883f1..46037463d5 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java @@ -26,7 +26,6 @@ public class BlowFishKeygen { private static final int CRYPT_KEYS_SIZE = 20; private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16]; - static { // init the GS encryption keys on class load @@ -54,7 +53,6 @@ public class BlowFishKeygen // block instantiation private BlowFishKeygen() { - } /** diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/IncomingPackets.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/IncomingPackets.java index 98362130f8..85b3fad9fd 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/IncomingPackets.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/IncomingPackets.java @@ -208,7 +208,6 @@ public enum IncomingPackets implements IIncomingPackets EX_PACKET(0xD0, ExPacket::new, ConnectionState.values()); // This packet has its own connection state checking so we allow all of them public static final IncomingPackets[] PACKET_ARRAY; - static { final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java index 8681078d71..cf476ab880 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java @@ -56,5 +56,4 @@ public class AuthRequest extends BaseSendablePacket { return getBytes(); } - } \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java index 69264263b4..2603512fdf 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java @@ -25,7 +25,6 @@ import com.l2jmobius.commons.network.BaseSendablePacket; */ public class ReplyCharacters extends BaseSendablePacket { - public ReplyCharacters(String account, int chars, List timeToDel) { writeC(0x08); @@ -43,5 +42,4 @@ public class ReplyCharacters extends BaseSendablePacket { return getBytes(); } - } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java index 113caaea70..ed3375e8d2 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class AuthResponse extends BaseRecievePacket { - private final int _serverId; private final String _serverName; @@ -52,5 +51,4 @@ public class AuthResponse extends BaseRecievePacket { return _serverName; } - } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java index 6945db648c..721ff58f8e 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java @@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; public class ChangePasswordResponse extends BaseRecievePacket { - public ChangePasswordResponse(byte[] decrypt) { super(decrypt); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java index d937c4762e..6f43b2976d 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java @@ -43,5 +43,4 @@ public class InitLS extends BaseRecievePacket final int size = readD(); _key = readB(size); } - } \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java index fe2c0b2d88..bbf888d495 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class KickPlayer extends BaseRecievePacket { - private final String _account; /** @@ -39,5 +38,4 @@ public class KickPlayer extends BaseRecievePacket { return _account; } - } \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java index f50e7a95e6..ae76f77fb7 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class LoginServerFail extends BaseRecievePacket { - private static final String[] REASONS = { "None", @@ -52,5 +51,4 @@ public class LoginServerFail extends BaseRecievePacket { return _reason; } - } \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java index a87742fab7..c747b9bb56 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class PlayerAuthResponse extends BaseRecievePacket { - private final String _account; private final boolean _authed; @@ -35,7 +34,7 @@ public class PlayerAuthResponse extends BaseRecievePacket super(decrypt); _account = readS(); - _authed = (readC() != 0); + _authed = readC() != 0; } /** @@ -53,5 +52,4 @@ public class PlayerAuthResponse extends BaseRecievePacket { return _authed; } - } \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/DateRange.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/DateRange.java index e825d08b90..3b8acae352 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/DateRange.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/DateRange.java @@ -43,10 +43,7 @@ public class DateRange { try { - final Date start = format.parse(date[0]); - final Date end = format.parse(date[1]); - - return new DateRange(start, end); + return new DateRange(format.parse(date[0]), format.parse(date[1])); } catch (ParseException e) { @@ -63,7 +60,8 @@ public class DateRange public boolean isWithinRange(Date date) { - return date.after(_startDate) && date.before(_endDate); + return (date.equals(_startDate) || date.after(_startDate)) // + && (date.equals(_endDate) || date.before(_endDate)); } public Date getEndDate() diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/ScriptDocument.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/ScriptDocument.java index 00b292822c..eacfe5baf8 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/ScriptDocument.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/ScriptDocument.java @@ -63,7 +63,6 @@ public class ScriptDocument { // Parser with specified options can't be built _log.log(Level.WARNING, "", pce); - } catch (IOException ioe) { @@ -90,5 +89,4 @@ public class ScriptDocument { return _name; } - } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/ScriptEngine.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/ScriptEngine.java index 41525b111f..bdef90d7b6 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/ScriptEngine.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/script/ScriptEngine.java @@ -41,16 +41,16 @@ public class ScriptEngine s = parserFactories.get(name); if (s == null) // if the shape factory is not there even now { - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } catch (ClassNotFoundException e) { // We'll throw an exception to indicate that // the shape could not be created - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } - return (s.create()); + return s.create(); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/Task.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/Task.java index ecbef18add..d76a02c101 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/Task.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/Task.java @@ -43,6 +43,5 @@ public abstract class Task public void onDestroy() { - } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java index 7f86a2bfb3..6b73502977 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java @@ -104,7 +104,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.warning("Cannot updated the Global Task " + id + ": " + e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Cannot updated the Global Task " + id + ": " + e.getMessage(), e); } if ((type == TYPE_SHEDULED) || (type == TYPE_TIME)) @@ -116,15 +116,7 @@ public final class TaskManager @Override public boolean equals(Object object) { - if (this == object) - { - return true; - } - if (!(object instanceof ExecutedTask)) - { - return false; - } - return id == ((ExecutedTask) object).id; + return (this == object) || ((object instanceof ExecutedTask) && (id == ((ExecutedTask) object).id)); } @Override @@ -169,7 +161,6 @@ public final class TaskManager _currentTasks.remove(this); } - } private void initializate() @@ -182,8 +173,7 @@ public final class TaskManager public void registerTask(Task task) { - final int key = task.getName().hashCode(); - _tasks.computeIfAbsent(key, k -> + _tasks.computeIfAbsent(task.getName().hashCode(), k -> { task.initializate(); return task; @@ -217,7 +207,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.SEVERE, "Error while loading Global Task table: ", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error while loading Global Task table: " + e.getMessage(), e); } } @@ -256,7 +246,7 @@ public final class TaskManager task.scheduled = ThreadPool.schedule(task, diff); return true; } - LOGGER.info("Task " + task.getId() + " is obsoleted."); + LOGGER.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted."); } catch (Exception e) { @@ -280,7 +270,7 @@ public final class TaskManager if (hour.length != 3) { - LOGGER.warning("Task " + task.getId() + " has incorrect parameters"); + LOGGER.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters"); return false; } @@ -296,7 +286,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.WARNING, "Bad parameter on task " + task.getId() + ": ", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Bad parameter on task " + task.getId() + ": " + e.getMessage(), e); return false; } @@ -348,7 +338,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the unique task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the unique task: " + e.getMessage(), e); } return false; } @@ -374,7 +364,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the task: " + e.getMessage(), e); } return false; } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java index e23716eba1..f005fca2ea 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java @@ -94,7 +94,7 @@ public final class FloodProtectorAction if ((curTick < _nextGameTick) || _punishmentInProgress) { - if (_config.LOG_FLOODING && !_logged && (_log.getLevel() == Level.WARNING)) + if (_config.LOG_FLOODING && !_logged && _log.isLoggable(Level.WARNING)) { log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeController.MILLIS_IN_TICK), " ms after previous command"); _logged = true; @@ -124,12 +124,9 @@ public final class FloodProtectorAction return false; } - if (_count.get() > 0) + if ((_count.get() > 0) && _config.LOG_FLOODING && _log.isLoggable(Level.WARNING)) { - if (_config.LOG_FLOODING && (_log.getLevel() == Level.WARNING)) - { - log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); - } + log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); } _nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL; @@ -145,7 +142,7 @@ public final class FloodProtectorAction { Disconnection.of(_client).defaultSequence(false); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log("kicked for flooding"); } @@ -157,7 +154,7 @@ public final class FloodProtectorAction private void banAccount() { PunishmentManager.getInstance().startPunishment(new PunishmentTask(_client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log(" banned for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } @@ -168,18 +165,20 @@ public final class FloodProtectorAction */ private void jailChar() { - if (_client.getActiveChar() != null) + if (_client.getActiveChar() == null) { - final int charId = _client.getActiveChar().getObjectId(); - if (charId > 0) - { - PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - } - - if (_log.getLevel() == Level.WARNING) - { - log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); - } + return; + } + + final int charId = _client.getActiveChar().getObjectId(); + if (charId > 0) + { + PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); + } + + if (_log.isLoggable(Level.WARNING)) + { + log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/GMAudit.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/GMAudit.java index ab7aa87ed6..c2ee25069b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/GMAudit.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/GMAudit.java @@ -32,7 +32,6 @@ import com.l2jmobius.Config; public class GMAudit { private static final Logger _log = Logger.getLogger(GMAudit.class.getName()); - static { new File("log/GMAudit").mkdirs(); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/LinePointIterator.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/LinePointIterator.java index 2208c5092d..168255fafd 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/LinePointIterator.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/LinePointIterator.java @@ -65,7 +65,7 @@ public final class LinePointIterator _first = false; return true; } - else if (_dx >= _dy) + if (_dx >= _dy) { if (_srcX != _dstX) { @@ -81,21 +81,18 @@ public final class LinePointIterator return true; } } - else + else if (_srcY != _dstY) { - if (_srcY != _dstY) + _srcY += _sy; + + _error += _dx; + if (_error >= _dy) { - _srcY += _sy; - - _error += _dx; - if (_error >= _dy) - { - _srcX += _sx; - _error -= _dy; - } - - return true; + _srcX += _sx; + _error -= _dy; } + + return true; } return false; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java index 771bbb5fc7..c9dd0c3840 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java @@ -75,7 +75,7 @@ public final class LinePointIterator3D _first = false; return true; } - else if ((_dx >= _dy) && (_dx >= _dz)) + if ((_dx >= _dy) && (_dx >= _dz)) { if (_srcX != _dstX) { @@ -121,28 +121,25 @@ public final class LinePointIterator3D return true; } } - else + else if (_srcZ != _dstZ) { - if (_srcZ != _dstZ) + _srcZ += _sz; + + _error += _dx; + if (_error >= _dz) { - _srcZ += _sz; - - _error += _dx; - if (_error >= _dz) - { - _srcX += _sx; - _error -= _dz; - } - - _error2 += _dy; - if (_error2 >= _dz) - { - _srcY += _sy; - _error2 -= _dz; - } - - return true; + _srcX += _sx; + _error -= _dz; } + + _error2 += _dy; + if (_error2 >= _dz) + { + _srcY += _sy; + _error2 -= _dz; + } + + return true; } return false; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/PrimeFinder.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/PrimeFinder.java index a454fd5289..e032195067 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/PrimeFinder.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/PrimeFinder.java @@ -1,18 +1,13 @@ /* - * This file is part of the L2J Mobius project. + * Copyright (c) 1999 CERN - European Organization for Nuclear Research. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear in + * supporting documentation. CERN makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without expressed or implied warranty. */ package com.l2jmobius.gameserver.util; @@ -331,7 +326,6 @@ public final class PrimeFinder 800076929, 1600153859 }; - static { // initializer // The above prime numbers are formatted for human readability. diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/commons/util/DeadLockDetector.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/commons/util/DeadLockDetector.java index e9f16e2ccc..ad202531e4 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/commons/util/DeadLockDetector.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/commons/util/DeadLockDetector.java @@ -114,7 +114,7 @@ public class DeadLockDetector extends Thread } catch (Exception e) { - LOGGER.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "DeadLockDetector: ", e); } } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java index 2e11e61e48..192a0fa72a 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java @@ -184,7 +184,7 @@ public class GameServer if (!IdFactory.getInstance().isInitialized()) { LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration."); - throw new Exception("Could not initialize the ID factory"); + throw new Exception("Could not initialize the ID factory!"); } // load script engines @@ -272,6 +272,7 @@ public class GameServer if (Config.PREMIUM_SYSTEM_ENABLED) { + LOGGER.info("PremiumManager: Premium system is enabled."); PremiumManager.getInstance(); } @@ -466,7 +467,7 @@ public class GameServer /*** Main ***/ // Create log folder - final File logFolder = new File(".", LOG_FOLDER); + final File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER); logFolder.mkdir(); // Create input stream for log file -- or store file data into memory diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java index a4fc1b00a2..75089ff0f6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java @@ -87,7 +87,6 @@ public final class ItemsAutoDestroy ItemsOnGroundManager.getInstance().removeObject(item); } } - } } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/MonsterRace.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/MonsterRace.java index 6387c1c3c6..2cf628c10f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/MonsterRace.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/MonsterRace.java @@ -16,7 +16,6 @@ */ package com.l2jmobius.gameserver; -import java.lang.reflect.Constructor; import java.util.logging.Level; import java.util.logging.Logger; @@ -64,14 +63,12 @@ public class MonsterRace try { final L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random); - final Constructor constructor = Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0]; - _monsters[i] = (L2Npc) constructor.newInstance(template); + _monsters[i] = (L2Npc) Class.forName("com.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0].newInstance(template); } catch (Exception e) { - LOGGER.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "Unable to create monster!", e); } - // LOGGER.info("Monster "+i+" is id: "+(id+random)); } newSpeeds(); } @@ -87,14 +84,7 @@ public class MonsterRace total = 0; for (int j = 0; j < 20; j++) { - if (j == 19) - { - _speeds[i][j] = 100; - } - else - { - _speeds[i][j] = Rnd.get(60) + 65; - } + _speeds[i][j] = j == 19 ? 100 : Rnd.get(60) + 65; total += _speeds[i][j]; } if (total >= _first[1]) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java index 2e99f8f99f..547750542b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java @@ -263,11 +263,10 @@ public class Shutdown extends Thread try { DatabaseFactory.getInstance().close(); - LOGGER.info("L2Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); + LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); } catch (Throwable t) { - } // server will quit, when this function ends. @@ -536,9 +535,6 @@ public class Shutdown extends Thread } } - /* - * if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true); - */ final TimeCounter tc = new TimeCounter(); // Save all raidboss and GrandBoss status ^_^ @@ -590,7 +586,7 @@ public class Shutdown extends Thread if (Config.BOTREPORT_ENABLE) { BotReportTable.getInstance().saveReportedCharData(); - LOGGER.info("Bot Report Table: Sucessfully saved reports to database!"); + LOGGER.info("Bot Report Table: Successfully saved reports to database!"); } try diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/cache/HtmCache.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/cache/HtmCache.java index fec436d1fa..2da85f99ff 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/cache/HtmCache.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/cache/HtmCache.java @@ -43,7 +43,7 @@ public class HtmCache private static final Pattern ABSTRACT_BLOCK_PATTERN = Pattern.compile("", Pattern.DOTALL); private static final Pattern BLOCK_PATTERN = Pattern.compile("(.*?)", Pattern.DOTALL); - private final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); + private static final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); private int _loadedFiles; private long _bytesBuffLen; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java index 6a19cc7d31..3f98953c02 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java @@ -204,14 +204,7 @@ public class Forum public Forum getChildByName(String name) { vload(); - for (Forum f : _children) - { - if (f.getName().equals(name)) - { - return f; - } - } - return null; + return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null); } /** @@ -220,7 +213,6 @@ public class Forum public void rmTopicByID(int id) { _topic.remove(id); - } public void insertIntoDb() diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java index bc05a8ff5c..a4df772cc3 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java @@ -46,9 +46,7 @@ public class ForumsBBSManager extends BaseBBSManager { while (rs.next()) { - final int forumId = rs.getInt("forum_id"); - final Forum f = new Forum(forumId, null); - addForum(f); + addForum(new Forum(rs.getInt("forum_id"), null)); } } catch (Exception e) @@ -62,10 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager */ public void initRoot() { - for (Forum f : _table) - { - f.vload(); - } + _table.forEach(f -> f.vload()); _log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index 188d99945c..7d74ef6eb4 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import com.l2jmobius.gameserver.communitybbs.BB.Forum; import com.l2jmobius.gameserver.communitybbs.BB.Post; -import com.l2jmobius.gameserver.communitybbs.BB.Post.CPost; import com.l2jmobius.gameserver.communitybbs.BB.Topic; import com.l2jmobius.gameserver.handler.CommunityBoardHandler; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -68,21 +67,8 @@ public class PostBBSManager extends BaseBBSManager st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); final int idp = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } - + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind); } else if (command.startsWith("_bbsposts;edit;")) @@ -106,7 +92,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); if ((forum == null) || (topic == null) || (p == null)) { - CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exit !


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exist!


    ", activeChar); } else { @@ -118,7 +104,7 @@ public class PostBBSManager extends BaseBBSManager { if ((forum == null) || (topic == null)) { - CommunityBoardHandler.separateAndSend("

    Error, this forum is not implemented yet


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error: This forum is not implemented yet!
    ", activeChar); } else if (forum.getType() == Forum.MEMO) { @@ -126,7 +112,7 @@ public class PostBBSManager extends BaseBBSManager } else { - CommunityBoardHandler.separateAndSend("

    the forum: " + forum.getName() + " is not implemented yet


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    The forum: " + forum.getName() + " is not implemented yet!
    ", activeChar); } } @@ -139,7 +125,6 @@ public class PostBBSManager extends BaseBBSManager private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum) { - // final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); @@ -176,8 +161,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(t); if (p != null) { - final CPost cp = p.getCPost(idp); - if (cp == null) + if (p.getCPost(idp) == null) { CommunityBoardHandler.separateAndSend("

    the post: " + idp + " does not exist !


    ", activeChar); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index db6e17a2b0..427f456b84 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -60,11 +60,7 @@ public class TopicBBSManager extends BaseBBSManager public int getMaxID(Forum f) { final Integer i = _maxId.get(f); - if (i == null) - { - return 0; - } - return i; + return i == null ? 0 : i; } public Topic getTopicByID(int idf) @@ -146,20 +142,8 @@ public class TopicBBSManager extends BaseBBSManager st.nextToken(); st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf); } else if (command.startsWith("_bbstopics;crea")) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java index d8dc164725..609f0858d5 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java @@ -170,12 +170,7 @@ public class CharNameTable public final int getAccessLevelById(int objectId) { - if (getNameById(objectId) != null) - { - return _accessLevels.get(objectId); - } - - return 0; + return getNameById(objectId) != null ? _accessLevels.get(objectId) : 0; } public synchronized boolean doesCharNameExist(String name) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java index 3f2fe830c7..c6ee79672c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java @@ -67,7 +67,6 @@ import com.l2jmobius.gameserver.util.Util; public class ClanTable { private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName()); - private final Map _clans = new ConcurrentHashMap<>(); protected ClanTable() @@ -444,16 +443,13 @@ public class ClanTable for (L2Clan clan : _clans.values()) { final int allyId = clan.getAllyId(); - if ((allyId != 0) && (clan.getId() != allyId)) + if ((allyId != 0) && (clan.getId() != allyId) && !_clans.containsKey(allyId)) { - if (!_clans.containsKey(allyId)) - { - clan.setAllyId(0); - clan.setAllyName(null); - clan.changeAllyCrest(0, true); - clan.updateClanInDB(); - LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); - } + clan.setAllyId(0); + clan.setAllyName(null); + clan.changeAllyCrest(0, true); + clan.updateClanInDB(); + LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); } } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/EventDroplist.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/EventDroplist.java index c22e5eb0ee..ba8c26bbd8 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/EventDroplist.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/EventDroplist.java @@ -35,7 +35,7 @@ public class EventDroplist /** * The table containing all DataDrop object */ - private static final List _allNpcDateDrops = new CopyOnWriteArrayList<>(); + private static final List ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>(); public static class DateDrop { @@ -74,7 +74,7 @@ public class EventDroplist */ public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); } /** @@ -86,7 +86,7 @@ public class EventDroplist */ public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); } /** @@ -96,7 +96,7 @@ public class EventDroplist */ public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop) { - _allNpcDateDrops.add(new DateDrop(dateRange, eventDrop)); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, eventDrop)); } /** @@ -106,7 +106,7 @@ public class EventDroplist { final List list = new LinkedList<>(); final Date currentDate = new Date(); - for (DateDrop drop : _allNpcDateDrops) + for (DateDrop drop : ALL_NPC_DATE_DROPS) { if (drop._dateRange.isWithinRange(currentDate)) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/engines/DocumentBase.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/engines/DocumentBase.java index 6f7ebc5cf9..ed572cb74e 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/engines/DocumentBase.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/engines/DocumentBase.java @@ -150,12 +150,11 @@ public abstract class DocumentBase protected final Logger _log = Logger.getLogger(getClass().getName()); private final File _file; - protected Map _tables; + protected final Map _tables = new HashMap<>(); protected DocumentBase(File pFile) { _file = pFile; - _tables = new HashMap<>(); } public Document parse() diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java index 0e3b945cf4..4d3be938c9 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java @@ -79,7 +79,6 @@ public final class DocumentItem extends DocumentBase implements IGameXmlReader { if ("list".equalsIgnoreCase(n.getNodeName())) { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("item".equalsIgnoreCase(d.getNodeName())) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/PlayerAction.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/PlayerAction.java index 95b3da5c8d..a9a2393db7 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/PlayerAction.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/PlayerAction.java @@ -30,7 +30,7 @@ public enum PlayerAction private PlayerAction() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/ShotType.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/ShotType.java index 2e98cb6d93..87e917b8bf 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/ShotType.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/enums/ShotType.java @@ -31,7 +31,7 @@ public enum ShotType private ShotType() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java index cb1452b64b..adf6462b78 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java @@ -34,8 +34,7 @@ public class AdminCommandHandler implements IHandler= FREE_OBJECT_ID_SIZE) { throw new NullPointerException("Ran out of valid Id's."); } + increaseBitSetCapacity(); } _nextFreeId.set(nextFree); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java index 6a3e232a26..002a6f75c3 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java @@ -316,7 +316,6 @@ public final class MapRegionManager implements IGameXmlReader return flags.stream().findAny().get().getLocation(); } } - } else if (fort != null) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java index 8f24f8dfc6..4e3abc79eb 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java @@ -191,7 +191,6 @@ public final class QuestManager { old.unload(); LOGGER.info("Replaced quest " + old.getName() + " (" + old.getId() + ") with a new version!"); - } if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java index e3235b056e..cd7118dc3b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java @@ -427,7 +427,7 @@ public final class SellBuffsManager implements IGameXmlReader } else if (player.isMounted() || player.isFlyingMounted() || player.isFlying()) { - player.sendMessage("You can't sell buffs in Mounth state!"); + player.sendMessage("You can't sell buffs in Mount state!"); return false; } else if (player.isTransformed()) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java index 70cfb5d922..5e16e5a91f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java @@ -71,9 +71,7 @@ public final class MessageDeletionTask implements Runnable final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId()); if (receiver != null) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME); - // sm.addString(msg.getReceiverName()); - receiver.sendPacket(sm); + receiver.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME)); } } catch (Exception e) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java index 43cf6815de..964757069c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java @@ -78,7 +78,7 @@ public abstract class AbstractPlayerGroup */ public boolean isLeader(L2PcInstance player) { - return (getLeaderObjectId() == player.getObjectId()); + return getLeaderObjectId() == player.getObjectId(); } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/AggroInfo.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/AggroInfo.java index 3be79b12bb..613e113b28 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/AggroInfo.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/AggroInfo.java @@ -93,4 +93,10 @@ public final class AggroInfo { return _attacker.getObjectId(); } + + @Override + public String toString() + { + return "AggroInfo [attacker=" + _attacker + ", hate=" + _hate + ", damage=" + _damage + "]"; + } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/BlockList.java index 08918cc853..627b0dbbe4 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/BlockList.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/BlockList.java @@ -33,14 +33,10 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.BlockListPacket; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -/** - * This class ... - * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $ - */ public class BlockList { private static Logger _log = Logger.getLogger(BlockList.class.getName()); - private static Map> _offlineList = new ConcurrentHashMap<>(); + private static final Map> OFFLINE_LIST = new ConcurrentHashMap<>(); private final L2PcInstance _owner; private List _blockList; @@ -48,7 +44,7 @@ public class BlockList public BlockList(L2PcInstance owner) { _owner = owner; - _blockList = _offlineList.get(owner.getObjectId()); + _blockList = OFFLINE_LIST.get(owner.getObjectId()); if (_blockList == null) { _blockList = loadList(_owner.getObjectId()); @@ -69,7 +65,7 @@ public class BlockList public void playerLogout() { - _offlineList.put(_owner.getObjectId(), _blockList); + OFFLINE_LIST.put(_owner.getObjectId(), _blockList); } private static List loadList(int ObjId) @@ -263,10 +259,10 @@ public class BlockList { return BlockList.isBlocked(player, targetId); } - if (!_offlineList.containsKey(ownerId)) + if (!OFFLINE_LIST.containsKey(ownerId)) { - _offlineList.put(ownerId, loadList(ownerId)); + OFFLINE_LIST.put(ownerId, loadList(ownerId)); } - return _offlineList.get(ownerId).contains(targetId); + return OFFLINE_LIST.get(ownerId).contains(targetId); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java index ee640a3d9c..047d3d7074 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java @@ -49,17 +49,7 @@ public final class DamageDoneInfo @Override public final boolean equals(Object obj) { - if (this == obj) - { - return true; - } - - if (obj instanceof DamageDoneInfo) - { - return (((DamageDoneInfo) obj).getAttacker() == _attacker); - } - - return false; + return (this == obj) || ((obj instanceof DamageDoneInfo) && (((DamageDoneInfo) obj).getAttacker() == _attacker)); } @Override diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2AccessLevel.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2AccessLevel.java index a050f2f872..aefc7fb15d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2AccessLevel.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2AccessLevel.java @@ -23,29 +23,19 @@ import com.l2jmobius.gameserver.data.xml.impl.AdminData; */ public class L2AccessLevel { - /** - * The access level
    - */ + /** The access level. */ private int _accessLevel = 0; - /** - * The access level name
    - */ + /** The access level name. */ private String _name = null; - /** Child access levels */ + /** Child access levels. */ L2AccessLevel _childsAccessLevel = null; - /** Child access levels */ + /** Child access levels. */ private int _child = 0; - /** - * The name color for the access level
    - */ + /** The name color for the access level. */ private int _nameColor = 0; - /** - * The title color for the access level
    - */ + /** The title color for the access level. */ private int _titleColor = 0; - /** - * Flag to determine if the access level has gm access
    - */ + /** Flag to determine if the access level has GM access. */ private boolean _isGm = false; /** Flag for peace zone attack */ private boolean _allowPeaceAttack = false; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java index 08b62e547b..e1bbddd336 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -219,7 +219,7 @@ public class L2Clan implements IIdentifiable, INamable */ public int getLeaderId() { - return (_leader != null ? _leader.getObjectId() : 0); + return _leader != null ? _leader.getObjectId() : 0; } /** @@ -261,7 +261,6 @@ public class L2Clan implements IIdentifiable, INamable } exLeader.getClanPrivileges().clear(); exLeader.broadcastUserInfo(); - } else { @@ -378,6 +377,7 @@ public class L2Clan implements IIdentifiable, INamable player.setPledgeClass(L2ClanMember.calculatePledgeClass(player)); player.sendPacket(new PledgeShowMemberListUpdate(player)); player.sendPacket(new PledgeSkillList(this)); + addSkillEffects(player); // Notify to scripts @@ -1334,7 +1334,6 @@ public class L2Clan implements IIdentifiable, INamable Skill oldSkill = null; if (newSkill != null) { - if (subType == -2) { oldSkill = _skills.put(newSkill.getId(), newSkill); @@ -1793,12 +1792,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final SubPledge getSubPledge(int pledgeType) { - if (_subPledges == null) - { - return null; - } - - return _subPledges.get(pledgeType); + return _subPledges == null ? null : _subPledges.get(pledgeType); } /** @@ -1999,21 +1993,15 @@ public class L2Clan implements IIdentifiable, INamable public void initializePrivs() { - RankPrivs privs; for (int i = 1; i < 10; i++) { - privs = new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false)); - _privs.put(i, privs); + _privs.put(i, new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false))); } } public EnumIntBitmask getRankPrivs(int rank) { - if (_privs.get(rank) != null) - { - return _privs.get(rank).getPrivs(); - } - return new EnumIntBitmask<>(ClanPrivilege.class, false); + return _privs.get(rank) != null ? _privs.get(rank).getPrivs() : new EnumIntBitmask<>(ClanPrivilege.class, false); } public void setRankPrivs(int rank, int privs) @@ -2080,12 +2068,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final RankPrivs[] getAllRankPrivs() { - if (_privs == null) - { - return new RankPrivs[0]; - } - - return _privs.values().toArray(new RankPrivs[_privs.values().size()]); + return _privs == null ? new RankPrivs[0] : _privs.values().toArray(new RankPrivs[_privs.values().size()]); } public int getLeaderSubPledge(int leaderId) @@ -2417,13 +2400,10 @@ public class L2Clan implements IIdentifiable, INamable player.sendPacket(SystemMessageId.TO_CREATE_AN_ALLIANCE_YOUR_CLAN_MUST_BE_LEVEL_5_OR_HIGHER); return; } - if (getAllyPenaltyExpiryTime() > System.currentTimeMillis()) + if ((getAllyPenaltyExpiryTime() > System.currentTimeMillis()) && (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY)) { - if (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); - return; - } + player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); + return; } if (getDissolvingExpiryTime() > System.currentTimeMillis()) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ClanMember.java index 02d3c77259..139c302ce9 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ClanMember.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ClanMember.java @@ -151,8 +151,8 @@ public class L2ClanMember } /** - * Checks if is online. - * @return true, if is online + * Verifies if the clan member is online. + * @return {@code true} if is online */ public boolean isOnline() { @@ -263,11 +263,7 @@ public class L2ClanMember */ public int getPowerGrade() { - if (_player != null) - { - return _player.getPowerGrade(); - } - return _powerGrade; + return _player != null ? _player.getPowerGrade() : _powerGrade; } /** @@ -323,11 +319,7 @@ public class L2ClanMember */ public int getRaceOrdinal() { - if (_player != null) - { - return _player.getRace().ordinal(); - } - return _raceOrdinal; + return _player != null ? _player.getRace().ordinal() : _raceOrdinal; } /** @@ -336,11 +328,7 @@ public class L2ClanMember */ public boolean getSex() { - if (_player != null) - { - return _player.getAppearance().getSex(); - } - return _sex; + return _player != null ? _player.getAppearance().getSex() : _sex; } /** @@ -349,11 +337,7 @@ public class L2ClanMember */ public int getSponsor() { - if (_player != null) - { - return _player.getSponsor(); - } - return _sponsor; + return _player != null ? _player.getSponsor() : _sponsor; } /** @@ -362,11 +346,7 @@ public class L2ClanMember */ public int getApprentice() { - if (_player != null) - { - return _player.getApprentice(); - } - return _apprentice; + return _player != null ? _player.getApprentice() : _apprentice; } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2CommandChannel.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2CommandChannel.java index bb1b4b57c4..d91e7e0554 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2CommandChannel.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2CommandChannel.java @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class L2CommandChannel extends AbstractPlayerGroup { private final List _parties = new CopyOnWriteArrayList<>(); - private L2PcInstance _commandLeader = null; + private L2PcInstance _commandLeader; private int _channelLvl; /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java index 09025eeed1..f485978cf6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java @@ -68,19 +68,11 @@ public class L2GroupSpawn extends L2Spawn final L2Npc mob = new L2ControllableMobInstance(_template); mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp()); - if (getHeading() == -1) - { - mob.setHeading(Rnd.nextInt(61794)); - } - else - { - mob.setHeading(getHeading()); - } + mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading()); mob.setSpawn(this); mob.spawnMe(newlocx, newlocy, newlocz); return mob; - } catch (Exception e) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java index 7875bdbb6a..905a58c1b8 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java @@ -35,7 +35,7 @@ public class L2NpcWalkerNode extends Location _delay = delay; _runToLocation = runToLocation; _npcString = npcString; - _chatString = ((chatText == null) ? "" : chatText); + _chatString = (chatText == null) ? "" : chatText; } public int getDelay() diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Object.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Object.java index 9164db110c..171ad1e543 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Object.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Object.java @@ -782,7 +782,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared) { final double distance = Math.pow(x - getX(), 2) + Math.pow(y - getY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0); - return (squared) ? distance : Math.sqrt(distance); + return squared ? distance : Math.sqrt(distance); } /** @@ -898,12 +898,12 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab @Override public boolean equals(Object obj) { - return ((obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId())); + return (obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId()); } @Override public String toString() { - return (getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"); + return getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"; } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Territory.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Territory.java index 5152d69c0d..41cb26df2b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Territory.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Territory.java @@ -16,8 +16,8 @@ */ package com.l2jmobius.gameserver.model; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Logger; import com.l2jmobius.commons.util.Rnd; @@ -44,7 +44,7 @@ public class L2Territory } } - private final List _points = new ArrayList<>(); + private final List _points = new CopyOnWriteArrayList<>(); private final int _terr; private int _xMin; private int _xMax; @@ -96,14 +96,6 @@ public class L2Territory _procMax += proc; } - public void print() - { - for (Point p : _points) - { - _log.info("(" + p._x + "," + p._y + ")"); - } - } - public boolean isIntersect(int x, int y, Point p1, Point p2) { final double dy1 = p1._y - y; @@ -163,7 +155,6 @@ public class L2Territory return new Location(p1._x, p1._y, Rnd.get(p1._zmin, p1._zmax)); } } - } for (int i = 0; i < 100; i++) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2World.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2World.java index 805e0c0ed2..9b02364b07 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2World.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2World.java @@ -282,20 +282,20 @@ public final class L2World } /** - * Add a L2Object in the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Add a L2Object in the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Add the L2Object object in _allPlayers* of L2World
  • *
  • Add the L2Object object in _gmList** of GmListTable
  • - *
  • Add object in _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding PlayerInstance in its _knownPlayer

  • - * * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of WorldRegion (need synchronisation)
    + *
  • Add object in _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding L2PcInstance in its _knownPlayer

  • + * * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of L2WorldRegion (need synchronisation)
    * Caution : This method DOESN'T ADD the object to _allObjects and _allPlayers* of L2World (need synchronisation) Example of use : *
  • Drop an Item
  • *
  • Spawn a L2Character
  • - *
  • Apply Death Penalty of a PlayerInstance
  • + *
  • Apply Death Penalty of a L2PcInstance
  • * @param object L2object to add in the world - * @param newRegion WorldRegion in wich the object will be add (not used) + * @param newRegion L2WorldRegion in wich the object will be add (not used) */ public void addVisibleObject(L2Object object, L2WorldRegion newRegion) { @@ -371,18 +371,18 @@ public final class L2World } /** - * Remove a L2Object from the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Remove a L2Object from the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Remove the L2Object object from _allPlayers* of L2World
  • - *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of WorldRegion
  • + *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of L2WorldRegion
  • *
  • Remove the L2Object object from _gmList** of GmListTable
  • - *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all PlayerInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Example of use : + *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all L2PcInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Example of use : *
  • Pickup an Item
  • *
  • Decay a L2Character
  • * @param object L2object to remove from the world - * @param oldRegion WorldRegion in which the object was before removing + * @param oldRegion L2WorldRegion in which the object was before removing */ public void removeVisibleObject(L2Object object, L2WorldRegion oldRegion) { @@ -395,7 +395,7 @@ public final class L2World { oldRegion.removeVisibleObject(object); - // Go through all surrounding WorldRegion Creatures + // Go through all surrounding L2WorldRegion L2Characters oldRegion.forEachSurroundingRegion(w -> { for (L2Object wo : w.getVisibleObjects().values()) @@ -714,7 +714,7 @@ public final class L2World } /** - * Calculate the current WorldRegions of the object according to its position (x,y). Example of use : + * Calculate the current L2WorldRegions of the object according to its position (x,y). Example of use : *
  • Set position of a new L2Object (drop, spawn...)
  • *
  • Update position of a L2Object after a movement

  • * @param point position of the object @@ -749,12 +749,12 @@ public final class L2World } /** - * Check if the current WorldRegions of the object is valid according to its position (x,y). Example of use : - *
  • Init WorldRegions

  • + * Check if the current L2WorldRegions of the object is valid according to its position (x,y). Example of use : + *
  • Init L2WorldRegions

  • * @param x X position of the object * @param y Y position of the object * @param z Z position of the object - * @return True if the WorldRegion is valid + * @return True if the L2WorldRegion is valid */ public static boolean validRegion(int x, int y, int z) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 6bfaf3a33d..97608b326d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -136,7 +136,6 @@ public final class L2WorldRegion } LOGGER.finer(c + " mobs were turned on"); } - } public boolean isActive() diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MobGroup.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MobGroup.java index 88cc4a5599..4eb38cf27b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MobGroup.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MobGroup.java @@ -191,8 +191,7 @@ public final class MobGroup final int y = player.getY() + Rnd.nextInt(50); mobInst.teleToLocation(new Location(x, y, player.getZ()), true); - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(player); + ((L2ControllableMobAI) mobInst.getAI()).follow(player); } } } @@ -294,8 +293,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.forceAttack(target); + ((L2ControllableMobAI) mobInst.getAI()).forceAttack(target); } } @@ -310,8 +308,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.stop(); + ((L2ControllableMobAI) mobInst.getAI()).stop(); } } @@ -347,8 +344,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(character); + ((L2ControllableMobAI) mobInst.getAI()).follow(character); } } @@ -363,8 +359,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setAlternateAI(L2ControllableMobAI.AI_CAST); + ((L2ControllableMobAI) mobInst.getAI()).setAlternateAI(L2ControllableMobAI.AI_CAST); } } @@ -379,8 +374,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setNotMoving(enabled); + ((L2ControllableMobAI) mobInst.getAI()).setNotMoving(enabled); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MobGroupTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MobGroupTable.java index db0a789765..da1b620a40 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MobGroupTable.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MobGroupTable.java @@ -75,7 +75,7 @@ public class MobGroupTable public boolean removeGroup(int groupKey) { - return (_groupMap.remove(groupKey) != null); + return _groupMap.remove(groupKey) != null; } private static class SingletonHolder diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/Petition.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/Petition.java index 8596c3ea61..cbed80441a 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/Petition.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/Petition.java @@ -98,7 +98,7 @@ public final class Petition } PetitionManager.getInstance().getCompletedPetitions().put(getId(), this); - return (PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null); + return PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null; } public String getContent() diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/ShortCuts.java index 2bbf25dee0..3f8d959ef6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/ShortCuts.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/ShortCuts.java @@ -55,13 +55,10 @@ public class ShortCuts implements IRestorable { Shortcut sc = _shortCuts.get(slot + (page * MAX_SHORTCUTS_PER_BAR)); // Verify shortcut - if ((sc != null) && (sc.getType() == ShortcutType.ITEM)) + if ((sc != null) && (sc.getType() == ShortcutType.ITEM) && (_owner.getInventory().getItemByObjectId(sc.getId()) == null)) { - if (_owner.getInventory().getItemByObjectId(sc.getId()) == null) - { - deleteShortCut(sc.getSlot(), sc.getPage()); - sc = null; - } + deleteShortCut(sc.getSlot(), sc.getPage()); + sc = null; } return sc; } @@ -78,8 +75,7 @@ public class ShortCuts implements IRestorable } shortcut.setSharedReuseGroup(item.getSharedReuseGroup()); } - final Shortcut oldShortCut = _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut); - registerShortCutInDb(shortcut, oldShortCut); + registerShortCutInDb(shortcut, _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut)); } private void registerShortCutInDb(Shortcut shortcut, Shortcut oldShortCut) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java index d77bf6af86..6892d0798a 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java @@ -454,21 +454,18 @@ public final class BlockCheckerEngine switch (_round) { - case 1: + case 1: // Schedule second spawn round { - // Schedule second spawn round _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); break; } - case 2: + case 2: // Schedule third spawn round { - // Schedule third spawn round _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); break; } - case 3: + case 3: // Schedule Event End Count Down { - // Schedule Event End Count Down _task = ThreadPool.schedule(new EndEvent(), 180000); break; } @@ -572,7 +569,7 @@ public final class BlockCheckerEngine /* * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_WILL_END_IN_5_SECONDS)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } + * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } */ /** @@ -652,7 +649,7 @@ public final class BlockCheckerEngine } /** - * Reward the speicifed team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra + * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra * @param isRed */ private void rewardAsWinner(boolean isRed) @@ -714,8 +711,7 @@ public final class BlockCheckerEngine */ private void rewardAsLooser(boolean isRed) { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - for (Entry entry : tempPoints.entrySet()) + for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) { final L2PcInstance player = entry.getKey(); if ((player != null) && (entry.getValue() >= 10)) @@ -726,7 +722,7 @@ public final class BlockCheckerEngine } /** - * Telport players back, give status back and send final packet + * Teleport players back, give status back and send final packet */ private void setPlayersBack() { @@ -748,13 +744,11 @@ public final class BlockCheckerEngine final PcInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); } if (inv.getItemByItemId(13788) != null) { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); } broadcastRelationChanged(player); // Teleport Back diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Couple.java index 7901689adf..c31232e232 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Couple.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Couple.java @@ -99,7 +99,7 @@ public class Couple } catch (Exception e) { - _log.log(Level.SEVERE, "Could not create couple:", e); + _log.log(Level.SEVERE, "Could not create couple: " + e.getMessage(), e); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java index e9b3160a50..75ec9236b8 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -192,12 +192,7 @@ public final class Fort extends AbstractResidence } if ((getOwnerClan().getWarehouse().getAdena() >= _fee) || !_cwh) { - int fee = _fee; - if (getEndTime() == -1) - { - fee = _tempFee; - } - + final int fee = getEndTime() == -1 ? _tempFee : _fee; setEndTime(System.currentTimeMillis() + getRate()); dbSave(); if (_cwh) @@ -549,7 +544,6 @@ public final class Fort extends AbstractResidence if (door != null) { door.setCurrentHp(door.getMaxHp() + hp); - saveDoorUpgrade(doorId, hp, pDef, mDef); } } @@ -589,7 +583,7 @@ public final class Fort extends AbstractResidence long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis(); while (initial > (Config.FS_UPDATE_FRQ * 60000L)) { - initial -= (Config.FS_UPDATE_FRQ * 60000L); + initial -= Config.FS_UPDATE_FRQ * 60000L; } initial = (Config.FS_UPDATE_FRQ * 60000L) - initial; if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600))) @@ -609,7 +603,6 @@ public final class Fort extends AbstractResidence { setOwnerClan(null); } - } catch (Exception e) { @@ -675,12 +668,9 @@ public final class Fort extends AbstractResidence { return false; } - if (lease > 0) + if ((lease > 0) && !player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) { - if (!player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) - { - return false; - } + return false; } if (addNew) { @@ -690,20 +680,16 @@ public final class Fort extends AbstractResidence { removeFunction(type); } + else if ((lease - _function.get(type).getLease()) > 0) + { + _function.remove(type); + _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); + } else { - final int diffLease = lease - _function.get(type).getLease(); - if (diffLease > 0) - { - _function.remove(type); - _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); - } - else - { - _function.get(type).setLease(lease); - _function.get(type).setLvl(lvl); - _function.get(type).dbSave(); - } + _function.get(type).setLease(lease); + _function.get(type).setLvl(lvl); + _function.get(type).dbSave(); } return true; } @@ -934,31 +920,17 @@ public final class Fort extends AbstractResidence public final int getOwnedTime() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); } public final int getTimeTillRebelArmy() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); } public final long getTimeTillNextFortUpdate() { - if (_FortUpdater[0] == null) - { - return 0; - } - return _FortUpdater[0].getDelay(TimeUnit.SECONDS); + return _FortUpdater[0] == null ? 0 : _FortUpdater[0].getDelay(TimeUnit.SECONDS); } public void updateClansReputation(L2Clan owner, boolean removePoints) @@ -999,7 +971,6 @@ public final class Fort extends AbstractResidence _log.log(Level.WARNING, "Exception in endFortressSiege " + e.getMessage(), e); } } - } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/L2Event.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/L2Event.java index ad93bd97a4..be28d47897 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/L2Event.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/L2Event.java @@ -46,7 +46,8 @@ import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse; import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; /** - * @since $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $ This ancient thingie got reworked by Nik at $Date: 2011/05/17 21:51:39 $ Yeah, for 6 years no one bothered reworking this buggy event engine. + * @author Nik + * @Since 2011/05/17 21:51:39 */ public class L2Event { @@ -164,7 +165,6 @@ public class L2Event try { final L2Spawn spawn = new L2Spawn(_npcId); - spawn.setX(target.getX() + 50); spawn.setY(target.getY() + 50); spawn.setZ(target.getZ()); @@ -184,13 +184,11 @@ public class L2Event spawn.getLastSpawn().broadcastPacket(new MagicSkillUse(spawn.getLastSpawn(), spawn.getLastSpawn(), 1034, 1, 1, 1)); // _npcs.add(spawn.getLastSpawn()); - } catch (Exception e) { _log.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e); } - } /** @@ -274,7 +272,6 @@ public class L2Event */ public static void removeAndResetPlayer(L2PcInstance player) { - try { if (isParticipant(player)) @@ -475,7 +472,6 @@ public class L2Event biggestLvlPlayer.setEventStatus(); i = (i + 1) % _teamsNumber; } - } catch (Exception e) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java index 64f1bd2117..08f8d8f701 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java @@ -30,7 +30,7 @@ public final class InstanceReenterTimeHolder private int _minute = -1; private long _time = -1; - public InstanceReenterTimeHolder(int time) + public InstanceReenterTimeHolder(long time) { _time = TimeUnit.MINUTES.toMillis(time); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java index ee59be43a2..03514cc06f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java @@ -45,5 +45,4 @@ public interface IParserAdvUtils extends IParserUtils Duration getDuration(String key); > T getEnum(String key, Class clazz); - } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java index 3930368188..f97917af4f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java @@ -62,7 +62,7 @@ public final class ClanWarehouse extends Warehouse @Override public boolean validateCapacity(long slots) { - return ((_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN); + return (_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN; } @Override diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index 51fbe026b7..f4525fdaaa 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -1806,7 +1806,7 @@ public final class L2ItemInstance extends L2Object public boolean isTimeLimitedItem() { - return (_time > 0); + return _time > 0; } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java index a4d6c7d9db..2d9fc312b0 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java @@ -49,5 +49,5 @@ public enum MaterialType FISH, RUNE_XP, RUNE_SP, - RUNE_REMOVE_PENALTY + RUNE_REMOVE_PENALTY; } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/Quest.java index 57c729e13d..511c4c829a 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/Quest.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/Quest.java @@ -156,7 +156,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ protected void onLoad() { - } /** @@ -167,7 +166,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onSave() { - } /** @@ -1057,7 +1055,7 @@ public class Quest extends AbstractScript implements IIdentifiable */ public String onDeath(L2Character killer, L2Character victim, QuestState qs) { - return onAdvEvent("", ((killer instanceof L2Npc) ? ((L2Npc) killer) : null), qs.getPlayer()); + return onAdvEvent("", (killer instanceof L2Npc) ? (L2Npc) killer : null, qs.getPlayer()); } /** @@ -1390,7 +1388,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) { - } /** @@ -1400,7 +1397,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadLose(L2PcInstance loser, CompetitionType type) { - } /** @@ -1409,7 +1405,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onMoveFinished(L2Npc npc) { - } /** @@ -1418,7 +1413,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onNodeArrived(L2Npc npc) { - } /** @@ -1427,7 +1421,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onRouteFinished(L2Npc npc) { - } /** @@ -2625,11 +2618,7 @@ public class Quest extends AbstractScript implements IIdentifiable } } } - if ((luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc)) - { - return luckyPlayer; - } - return null; + return (luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc) ? luckyPlayer : null; } /** @@ -2664,15 +2653,7 @@ public class Quest extends AbstractScript implements IIdentifiable QuestState qs = player.getQuestState(getName()); if (!player.isInParty()) { - if (!checkPartyMemberConditions(qs, condition, target)) - { - return null; - } - if (!checkDistanceToTarget(player, target)) - { - return null; - } - return qs; + return !checkPartyMemberConditions(qs, condition, target) || !checkDistanceToTarget(player, target) ? null : qs; } final List candidates = new ArrayList<>(); @@ -2704,21 +2685,17 @@ public class Quest extends AbstractScript implements IIdentifiable } qs = candidates.get(getRandom(candidates.size())); - if (!checkDistanceToTarget(qs.getPlayer(), target)) - { - return null; - } - return qs; + return !checkDistanceToTarget(qs.getPlayer(), target) ? null : qs; } private boolean checkPartyMemberConditions(QuestState qs, int condition, L2Npc npc) { - return ((qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc)); + return (qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc); } private static boolean checkDistanceToTarget(L2PcInstance player, L2Npc target) { - return ((target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true)); + return (target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true); } /** @@ -2826,7 +2803,7 @@ public class Quest extends AbstractScript implements IIdentifiable { for (int id : items) { - if (ItemTable.getInstance().getTemplate(id) == null) + if ((id != 0) && (ItemTable.getInstance().getTemplate(id) == null)) { _log.severe(super.getClass().getSimpleName() + ": Found registerQuestItems for non existing item: " + id + "!"); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/QuestState.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/QuestState.java index abf9825d8e..23c0acc8d1 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/QuestState.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/QuestState.java @@ -114,7 +114,7 @@ public final class QuestState */ public boolean isCreated() { - return (_state == State.CREATED); + return _state == State.CREATED; } /** @@ -123,7 +123,7 @@ public final class QuestState */ public boolean isStarted() { - return (_state == State.STARTED); + return _state == State.STARTED; } /** @@ -132,7 +132,7 @@ public final class QuestState */ public boolean isCompleted() { - return (_state == State.COMPLETED); + return _state == State.COMPLETED; } /** @@ -340,10 +340,10 @@ public final class QuestState // since no flag had been skipped until now, the least significant bits must all // be set to 1, up until "old" number of bits. - completedStateFlags |= ((1 << old) - 1); + completedStateFlags |= (1 << old) - 1; // now, just set the bit corresponding to the passed cond to 1 (current step) - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } } @@ -352,7 +352,7 @@ public final class QuestState else if (cond < old) { // note, this also unsets the flag indicating that there exist skips - completedStateFlags &= ((1 << cond) - 1); + completedStateFlags &= (1 << cond) - 1; // now, check if this resulted in no steps being skipped any more if (completedStateFlags == ((1 << cond) - 1)) @@ -372,7 +372,7 @@ public final class QuestState // Just mark this state and we are done. else { - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } @@ -463,7 +463,7 @@ public final class QuestState */ public boolean isCond(int condition) { - return (getInt("cond") == condition); + return getInt("cond") == condition; } /** @@ -523,7 +523,7 @@ public final class QuestState */ public boolean isSet(String variable) { - return (get(variable) != null); + return get(variable) != null; } /** @@ -578,7 +578,7 @@ public final class QuestState public boolean isMemoState(int memoState) { - return (getInt("memoState") == memoState); + return getInt("memoState") == memoState; } /** @@ -823,7 +823,7 @@ public final class QuestState public boolean isNowAvailable() { final String val = get("restartTime"); - return (val != null) && (!Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis())); + return (val == null) || !Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis()); } public void setSimulated(boolean simulated) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/TraitType.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/TraitType.java index e7a799703d..890e7b48b8 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/TraitType.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/stats/TraitType.java @@ -83,7 +83,7 @@ public enum TraitType { _type = type; } - + public int getType() { return _type; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java index 4433e97b28..f431bdab71 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java @@ -49,13 +49,13 @@ public class ZoneCuboid extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_r.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _r.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -65,9 +65,9 @@ public class ZoneCuboid extends L2ZoneForm final int _x2 = _r.x + _r.width; final int _y1 = _r.y; final int _y2 = _r.y + _r.height; - double test, shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); + double test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); + double shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); - test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); if (test < shortestDist) { shortestDist = test; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java index afdfd3fade..5f3b143379 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java @@ -43,11 +43,7 @@ public class ZoneCylinder extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - if (((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) > _radS) || (z < _z1) || (z > _z2)) - { - return false; - } - return true; + return ((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) <= _radS) && (z >= _z1) && (z <= _z2); } @Override @@ -130,9 +126,7 @@ public class ZoneCylinder extends L2ZoneForm final double angle = (2 * Math.PI) / count; for (int i = 0; i < count; i++) { - final int x = (int) (Math.cos(angle * i) * _rad); - final int y = (int) (Math.sin(angle * i) * _rad); - dropDebugItem(Inventory.ADENA_ID, 1, _x + x, _y + y, z); + dropDebugItem(Inventory.ADENA_ID, 1, _x + (int) (Math.cos(angle * i) * _rad), _y + (int) (Math.sin(angle * i) * _rad), z); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java index 2340c1b218..d1ef507961 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java @@ -51,13 +51,13 @@ public class ZoneNPoly extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_p.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _p.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -95,25 +95,15 @@ public class ZoneNPoly extends L2ZoneForm @Override public void visualizeZone(int z) { - final int[] _x = _p.xpoints; - final int[] _y = _p.ypoints; - for (int i = 0; i < _p.npoints; i++) { - int nextIndex = i + 1; - // ending point to first one - if (nextIndex == _x.length) - { - nextIndex = 0; - } - final int vx = _x[nextIndex] - _x[i]; - final int vy = _y[nextIndex] - _y[i]; - float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)); - lenght /= STEP; + final int nextIndex = (i + 1) == _p.xpoints.length ? 0 : i + 1; + final int vx = _p.xpoints[nextIndex] - _p.xpoints[i]; + final int vy = _p.ypoints[nextIndex] - _p.ypoints[i]; + final float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)) / STEP; for (int o = 1; o <= lenght; o++) { - final float k = o / lenght; - dropDebugItem(Inventory.ADENA_ID, 1, (int) (_x[i] + (k * vx)), (int) (_y[i] + (k * vy)), z); + dropDebugItem(Inventory.ADENA_ID, 1, (int) (_p.xpoints[i] + ((o / lenght) * vx)), (int) (_p.ypoints[i] + ((o / lenght) * vy)), z); } } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java index 09ea4b531a..904a7f2919 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public final class L2CastleZone extends L2ResidenceZone { - public L2CastleZone(int id) { super(id); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java index ec9a75b975..a1a99b7051 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java @@ -99,7 +99,7 @@ public class L2NoRestartZone extends L2ZoneType return; } - if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.getInstance().getStartedTime()) > getRestartAllowedTime())) + if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis()) > getRestartAllowedTime())) { player.teleToLocation(TeleportWhereType.TOWN); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java index 45e377e22a..b3b1c77f42 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java @@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public class L2NoSummonFriendZone extends L2ZoneType { - public L2NoSummonFriendZone(int id) { super(id); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java index cb7760aee0..9ab43dd1cd 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java @@ -71,12 +71,7 @@ public class L2ResidenceHallTeleportZone extends L2ResidenceTeleportZone @Override public void run() { - int index = 0; - if (getSpawns().size() > 1) - { - index = Rnd.get(getSpawns().size()); - } - + final int index = getSpawns().size() > 1 ? Rnd.get(getSpawns().size()) : 0; final Location loc = getSpawns().get(index); if (loc == null) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java index e63f1883f1..46037463d5 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java @@ -26,7 +26,6 @@ public class BlowFishKeygen { private static final int CRYPT_KEYS_SIZE = 20; private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16]; - static { // init the GS encryption keys on class load @@ -54,7 +53,6 @@ public class BlowFishKeygen // block instantiation private BlowFishKeygen() { - } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/IncomingPackets.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/IncomingPackets.java index 98362130f8..85b3fad9fd 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/IncomingPackets.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/IncomingPackets.java @@ -208,7 +208,6 @@ public enum IncomingPackets implements IIncomingPackets EX_PACKET(0xD0, ExPacket::new, ConnectionState.values()); // This packet has its own connection state checking so we allow all of them public static final IncomingPackets[] PACKET_ARRAY; - static { final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java index 8681078d71..cf476ab880 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java @@ -56,5 +56,4 @@ public class AuthRequest extends BaseSendablePacket { return getBytes(); } - } \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java index 69264263b4..2603512fdf 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java @@ -25,7 +25,6 @@ import com.l2jmobius.commons.network.BaseSendablePacket; */ public class ReplyCharacters extends BaseSendablePacket { - public ReplyCharacters(String account, int chars, List timeToDel) { writeC(0x08); @@ -43,5 +42,4 @@ public class ReplyCharacters extends BaseSendablePacket { return getBytes(); } - } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java index 113caaea70..ed3375e8d2 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class AuthResponse extends BaseRecievePacket { - private final int _serverId; private final String _serverName; @@ -52,5 +51,4 @@ public class AuthResponse extends BaseRecievePacket { return _serverName; } - } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java index 6945db648c..721ff58f8e 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java @@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; public class ChangePasswordResponse extends BaseRecievePacket { - public ChangePasswordResponse(byte[] decrypt) { super(decrypt); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java index d937c4762e..6f43b2976d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java @@ -43,5 +43,4 @@ public class InitLS extends BaseRecievePacket final int size = readD(); _key = readB(size); } - } \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java index fe2c0b2d88..bbf888d495 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class KickPlayer extends BaseRecievePacket { - private final String _account; /** @@ -39,5 +38,4 @@ public class KickPlayer extends BaseRecievePacket { return _account; } - } \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java index f50e7a95e6..ae76f77fb7 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class LoginServerFail extends BaseRecievePacket { - private static final String[] REASONS = { "None", @@ -52,5 +51,4 @@ public class LoginServerFail extends BaseRecievePacket { return _reason; } - } \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java index a87742fab7..c747b9bb56 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class PlayerAuthResponse extends BaseRecievePacket { - private final String _account; private final boolean _authed; @@ -35,7 +34,7 @@ public class PlayerAuthResponse extends BaseRecievePacket super(decrypt); _account = readS(); - _authed = (readC() != 0); + _authed = readC() != 0; } /** @@ -53,5 +52,4 @@ public class PlayerAuthResponse extends BaseRecievePacket { return _authed; } - } \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/DateRange.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/DateRange.java index e825d08b90..3b8acae352 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/DateRange.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/DateRange.java @@ -43,10 +43,7 @@ public class DateRange { try { - final Date start = format.parse(date[0]); - final Date end = format.parse(date[1]); - - return new DateRange(start, end); + return new DateRange(format.parse(date[0]), format.parse(date[1])); } catch (ParseException e) { @@ -63,7 +60,8 @@ public class DateRange public boolean isWithinRange(Date date) { - return date.after(_startDate) && date.before(_endDate); + return (date.equals(_startDate) || date.after(_startDate)) // + && (date.equals(_endDate) || date.before(_endDate)); } public Date getEndDate() diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/ScriptDocument.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/ScriptDocument.java index 00b292822c..eacfe5baf8 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/ScriptDocument.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/ScriptDocument.java @@ -63,7 +63,6 @@ public class ScriptDocument { // Parser with specified options can't be built _log.log(Level.WARNING, "", pce); - } catch (IOException ioe) { @@ -90,5 +89,4 @@ public class ScriptDocument { return _name; } - } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/ScriptEngine.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/ScriptEngine.java index 41525b111f..bdef90d7b6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/ScriptEngine.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/script/ScriptEngine.java @@ -41,16 +41,16 @@ public class ScriptEngine s = parserFactories.get(name); if (s == null) // if the shape factory is not there even now { - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } catch (ClassNotFoundException e) { // We'll throw an exception to indicate that // the shape could not be created - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } - return (s.create()); + return s.create(); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/Task.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/Task.java index ecbef18add..d76a02c101 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/Task.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/Task.java @@ -43,6 +43,5 @@ public abstract class Task public void onDestroy() { - } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java index 7f86a2bfb3..6b73502977 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java @@ -104,7 +104,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.warning("Cannot updated the Global Task " + id + ": " + e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Cannot updated the Global Task " + id + ": " + e.getMessage(), e); } if ((type == TYPE_SHEDULED) || (type == TYPE_TIME)) @@ -116,15 +116,7 @@ public final class TaskManager @Override public boolean equals(Object object) { - if (this == object) - { - return true; - } - if (!(object instanceof ExecutedTask)) - { - return false; - } - return id == ((ExecutedTask) object).id; + return (this == object) || ((object instanceof ExecutedTask) && (id == ((ExecutedTask) object).id)); } @Override @@ -169,7 +161,6 @@ public final class TaskManager _currentTasks.remove(this); } - } private void initializate() @@ -182,8 +173,7 @@ public final class TaskManager public void registerTask(Task task) { - final int key = task.getName().hashCode(); - _tasks.computeIfAbsent(key, k -> + _tasks.computeIfAbsent(task.getName().hashCode(), k -> { task.initializate(); return task; @@ -217,7 +207,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.SEVERE, "Error while loading Global Task table: ", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error while loading Global Task table: " + e.getMessage(), e); } } @@ -256,7 +246,7 @@ public final class TaskManager task.scheduled = ThreadPool.schedule(task, diff); return true; } - LOGGER.info("Task " + task.getId() + " is obsoleted."); + LOGGER.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted."); } catch (Exception e) { @@ -280,7 +270,7 @@ public final class TaskManager if (hour.length != 3) { - LOGGER.warning("Task " + task.getId() + " has incorrect parameters"); + LOGGER.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters"); return false; } @@ -296,7 +286,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.WARNING, "Bad parameter on task " + task.getId() + ": ", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Bad parameter on task " + task.getId() + ": " + e.getMessage(), e); return false; } @@ -348,7 +338,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the unique task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the unique task: " + e.getMessage(), e); } return false; } @@ -374,7 +364,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the task: " + e.getMessage(), e); } return false; } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java index e23716eba1..f005fca2ea 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java @@ -94,7 +94,7 @@ public final class FloodProtectorAction if ((curTick < _nextGameTick) || _punishmentInProgress) { - if (_config.LOG_FLOODING && !_logged && (_log.getLevel() == Level.WARNING)) + if (_config.LOG_FLOODING && !_logged && _log.isLoggable(Level.WARNING)) { log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeController.MILLIS_IN_TICK), " ms after previous command"); _logged = true; @@ -124,12 +124,9 @@ public final class FloodProtectorAction return false; } - if (_count.get() > 0) + if ((_count.get() > 0) && _config.LOG_FLOODING && _log.isLoggable(Level.WARNING)) { - if (_config.LOG_FLOODING && (_log.getLevel() == Level.WARNING)) - { - log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); - } + log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); } _nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL; @@ -145,7 +142,7 @@ public final class FloodProtectorAction { Disconnection.of(_client).defaultSequence(false); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log("kicked for flooding"); } @@ -157,7 +154,7 @@ public final class FloodProtectorAction private void banAccount() { PunishmentManager.getInstance().startPunishment(new PunishmentTask(_client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log(" banned for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } @@ -168,18 +165,20 @@ public final class FloodProtectorAction */ private void jailChar() { - if (_client.getActiveChar() != null) + if (_client.getActiveChar() == null) { - final int charId = _client.getActiveChar().getObjectId(); - if (charId > 0) - { - PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - } - - if (_log.getLevel() == Level.WARNING) - { - log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); - } + return; + } + + final int charId = _client.getActiveChar().getObjectId(); + if (charId > 0) + { + PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); + } + + if (_log.isLoggable(Level.WARNING)) + { + log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/GMAudit.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/GMAudit.java index ab7aa87ed6..c2ee25069b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/GMAudit.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/GMAudit.java @@ -32,7 +32,6 @@ import com.l2jmobius.Config; public class GMAudit { private static final Logger _log = Logger.getLogger(GMAudit.class.getName()); - static { new File("log/GMAudit").mkdirs(); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/LinePointIterator.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/LinePointIterator.java index 2208c5092d..168255fafd 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/LinePointIterator.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/LinePointIterator.java @@ -65,7 +65,7 @@ public final class LinePointIterator _first = false; return true; } - else if (_dx >= _dy) + if (_dx >= _dy) { if (_srcX != _dstX) { @@ -81,21 +81,18 @@ public final class LinePointIterator return true; } } - else + else if (_srcY != _dstY) { - if (_srcY != _dstY) + _srcY += _sy; + + _error += _dx; + if (_error >= _dy) { - _srcY += _sy; - - _error += _dx; - if (_error >= _dy) - { - _srcX += _sx; - _error -= _dy; - } - - return true; + _srcX += _sx; + _error -= _dy; } + + return true; } return false; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java index 771bbb5fc7..c9dd0c3840 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java @@ -75,7 +75,7 @@ public final class LinePointIterator3D _first = false; return true; } - else if ((_dx >= _dy) && (_dx >= _dz)) + if ((_dx >= _dy) && (_dx >= _dz)) { if (_srcX != _dstX) { @@ -121,28 +121,25 @@ public final class LinePointIterator3D return true; } } - else + else if (_srcZ != _dstZ) { - if (_srcZ != _dstZ) + _srcZ += _sz; + + _error += _dx; + if (_error >= _dz) { - _srcZ += _sz; - - _error += _dx; - if (_error >= _dz) - { - _srcX += _sx; - _error -= _dz; - } - - _error2 += _dy; - if (_error2 >= _dz) - { - _srcY += _sy; - _error2 -= _dz; - } - - return true; + _srcX += _sx; + _error -= _dz; } + + _error2 += _dy; + if (_error2 >= _dz) + { + _srcY += _sy; + _error2 -= _dz; + } + + return true; } return false; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/PrimeFinder.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/PrimeFinder.java index a454fd5289..e032195067 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/PrimeFinder.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/PrimeFinder.java @@ -1,18 +1,13 @@ /* - * This file is part of the L2J Mobius project. + * Copyright (c) 1999 CERN - European Organization for Nuclear Research. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear in + * supporting documentation. CERN makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without expressed or implied warranty. */ package com.l2jmobius.gameserver.util; @@ -331,7 +326,6 @@ public final class PrimeFinder 800076929, 1600153859 }; - static { // initializer // The above prime numbers are formatted for human readability. diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CastleDungeon.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CastleDungeon.xml index 3469b2719b..e432b1c556 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CastleDungeon.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CastleDungeon.xml @@ -3,7 +3,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml index 9f25444a61..09d1e17f98 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml @@ -4,7 +4,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml index 306c45067d..4acce1b81e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml @@ -4,7 +4,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldNight60.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldNight60.xml index 4b95626f80..1a233f90cb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldNight60.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CavernOfThePirateCaptainWorldNight60.xml @@ -4,7 +4,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CrystalCaverns.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CrystalCaverns.xml index 8cb787ede3..b196777bd1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CrystalCaverns.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/CrystalCaverns.xml @@ -4,7 +4,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/DemonPrince.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/DemonPrince.xml index d08ba88a64..c18ec01b8e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/DemonPrince.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/DemonPrince.xml @@ -4,7 +4,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattle.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattle.xml index 43c66f7c3c..99f046eb4f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattle.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattle.xml @@ -4,7 +4,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattleEasy.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattleEasy.xml index f7d43e6f30..fc731236d0 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattleEasy.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattleEasy.xml @@ -4,7 +4,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattleHardcore.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattleHardcore.xml index 3eca532809..68e771340a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattleHardcore.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/IceQueensCastleNormalBattleHardcore.xml @@ -4,7 +4,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/Ranku.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/Ranku.xml index 068d84b6b6..ca2f709df3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/Ranku.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/Ranku.xml @@ -4,7 +4,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/SeedOfDestructionStage1.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/SeedOfDestructionStage1.xml index 5fed878275..d5ef7a89a4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/SeedOfDestructionStage1.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/instances/SeedOfDestructionStage1.xml @@ -4,7 +4,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/BeastFarm/BeastFarm.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/BeastFarm/BeastFarm.java index 56ea52ea0e..a0a386b8cb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/BeastFarm/BeastFarm.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/BeastFarm/BeastFarm.java @@ -23,7 +23,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Npc; @@ -283,7 +283,7 @@ public final class BeastFarm extends AbstractNpcAI final SkillData st = SkillData.getInstance(); for (SkillHolder sh : beast.getSkills()) { - nextNpc.addBeastSkill(st.getSkill(sh.getSkillId(), sh.getSkillLvl())); + nextNpc.addBeastSkill(st.getSkill(sh.getSkillId(), sh.getSkillLevel())); } Q00020_BringUpWithLove.checkJewelOfInnocence(player); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/DenOfEvil/DenOfEvil.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/DenOfEvil/DenOfEvil.java index 2cbd64d4c2..bdf4d1063c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/DenOfEvil/DenOfEvil.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/DenOfEvil/DenOfEvil.java @@ -17,7 +17,7 @@ package ai.areas.DenOfEvil; import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Character; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java index e374b60602..929b03874f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/AI/SeedOfAnnihilation/SeedOfAnnihilation.java @@ -20,7 +20,7 @@ import java.util.Calendar; import java.util.HashMap; import java.util.Map; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.Location; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HallOfSufferingAttack/HallOfSufferingAttack.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HallOfSufferingAttack/HallOfSufferingAttack.java index 196f202dc2..6eb6fca422 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HallOfSufferingAttack/HallOfSufferingAttack.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HallOfSufferingAttack/HallOfSufferingAttack.java @@ -21,7 +21,7 @@ import java.util.HashMap; import java.util.Map; import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.InstanceManager; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HallOfSufferingDefence/HallOfSufferingDefence.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HallOfSufferingDefence/HallOfSufferingDefence.java index 3b04b94264..0286fb7abc 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HallOfSufferingDefence/HallOfSufferingDefence.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/HallOfSufferingDefence/HallOfSufferingDefence.java @@ -21,7 +21,7 @@ import java.util.HashMap; import java.util.Map; import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.InstanceManager; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/SeedOfDestruction/SeedOfDestruction.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/SeedOfDestruction/SeedOfDestruction.java index 1253e0a0a2..c1eaaf4f2f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/SeedOfDestruction/SeedOfDestruction.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Gracia/instances/SeedOfDestruction/SeedOfDestruction.java @@ -25,7 +25,7 @@ import java.util.Map; import com.l2jmobius.Config; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.InstanceManager; import com.l2jmobius.gameserver.instancemanager.SoDManager; import com.l2jmobius.gameserver.model.L2CommandChannel; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java index 9e952df27f..f085846f9c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java @@ -29,7 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger; import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.data.xml.impl.DoorData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java index d9ef4226a7..3d69976bab 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/Hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java @@ -29,7 +29,7 @@ import java.util.concurrent.ScheduledFuture; import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.data.xml.impl.DoorData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.instancemanager.RaidBossSpawnManager; import com.l2jmobius.gameserver.instancemanager.RaidBossSpawnManager.StatusEnum; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/HotSprings/HotSprings.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/HotSprings/HotSprings.java index 016b50e41c..e292edd8dc 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/HotSprings/HotSprings.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/HotSprings/HotSprings.java @@ -16,7 +16,7 @@ */ package ai.areas.HotSprings; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/KetraOrcOutpust/KetraOrcSupport/KetraOrcSupport.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/KetraOrcOutpust/KetraOrcSupport/KetraOrcSupport.java index 7718d8621f..464656d050 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/KetraOrcOutpust/KetraOrcSupport/KetraOrcSupport.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/KetraOrcOutpust/KetraOrcSupport/KetraOrcSupport.java @@ -19,7 +19,7 @@ package ai.areas.KetraOrcOutpust.KetraOrcSupport; import java.util.HashMap; import java.util.Map; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.skills.Skill; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/SelMahumTrainingGrounds/SelMahumSquad.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/SelMahumTrainingGrounds/SelMahumSquad.java index 77ea669400..220ed12409 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/SelMahumTrainingGrounds/SelMahumSquad.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/SelMahumTrainingGrounds/SelMahumSquad.java @@ -18,7 +18,7 @@ package ai.areas.SelMahumTrainingGrounds; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.Location; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/StakatoNest/StakatoNest.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/StakatoNest/StakatoNest.java index 5345ecd231..e9cec627f3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/StakatoNest/StakatoNest.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/StakatoNest/StakatoNest.java @@ -18,7 +18,7 @@ package ai.areas.StakatoNest; import java.util.List; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/VarkaSilenosBarracks/VarkaSilenosSupport/VarkaSilenosSupport.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/VarkaSilenosBarracks/VarkaSilenosSupport/VarkaSilenosSupport.java index 81a9509e17..8ef0d61daa 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/VarkaSilenosBarracks/VarkaSilenosSupport/VarkaSilenosSupport.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/areas/VarkaSilenosBarracks/VarkaSilenosSupport/VarkaSilenosSupport.java @@ -19,7 +19,7 @@ package ai.areas.VarkaSilenosBarracks.VarkaSilenosSupport; import java.util.HashMap; import java.util.Map; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.skills.Skill; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Orfen/Orfen.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Orfen/Orfen.java index 01ea27455a..5ba88bdf7e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Orfen/Orfen.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Orfen/Orfen.java @@ -21,7 +21,7 @@ import java.util.concurrent.CopyOnWriteArrayList; import com.l2jmobius.Config; import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.instancemanager.GrandBossManager; import com.l2jmobius.gameserver.model.L2Object; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Valakas/Valakas.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Valakas/Valakas.java index 21aaba0dc3..00ecbf9a75 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Valakas/Valakas.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Valakas/Valakas.java @@ -21,7 +21,7 @@ import java.util.List; import com.l2jmobius.Config; import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.MountType; import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.instancemanager.GrandBossManager; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/AvantGarde/AvantGarde.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/AvantGarde/AvantGarde.java index 46d72fea57..9dafe98ff4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/AvantGarde/AvantGarde.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/AvantGarde/AvantGarde.java @@ -20,8 +20,8 @@ import java.util.List; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.MultisellData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.instancemanager.QuestManager; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.L2Npc; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/HealerTrainer/HealerTrainer.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/HealerTrainer/HealerTrainer.java index f709f0340c..ec965087ba 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/HealerTrainer/HealerTrainer.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/HealerTrainer/HealerTrainer.java @@ -19,8 +19,8 @@ package ai.others.HealerTrainer; import java.util.Collection; import com.l2jmobius.Config; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/NpcBuffers/impl/CabaleBuffer.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/NpcBuffers/impl/CabaleBuffer.java index cce5bb9f04..bc4b1573fb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/NpcBuffers/impl/CabaleBuffer.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/NpcBuffers/impl/CabaleBuffer.java @@ -18,7 +18,7 @@ package ai.others.NpcBuffers.impl; import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.gameserver.SevenSigns; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.actor.L2Npc; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/DevastatedCastle/DevastatedCastle.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/DevastatedCastle/DevastatedCastle.java index 5502371819..f633691cb0 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/DevastatedCastle/DevastatedCastle.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/DevastatedCastle/DevastatedCastle.java @@ -23,7 +23,7 @@ import java.util.Map.Entry; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.xml.impl.NpcData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.actor.L2Npc; 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 26856c92b8..e24f31d198 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 @@ -28,7 +28,7 @@ import java.util.List; import com.l2jmobius.Config; import com.l2jmobius.commons.database.DatabaseFactory; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.QuestManager; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Summon; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/custom/events/Race/Race.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/custom/events/Race/Race.java index fce85107f1..bb07dddbf8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/custom/events/Race/Race.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/custom/events/Race/Race.java @@ -22,7 +22,7 @@ import java.util.concurrent.ScheduledFuture; import com.l2jmobius.Config; import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java index 4abed8e208..8a92c7628e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java @@ -18,7 +18,7 @@ package handlers.admincommandhandlers; import java.util.StringTokenizer; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; import com.l2jmobius.gameserver.model.L2Object; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminReload.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminReload.java index a1f3ab8ba3..e6cd78bfa6 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminReload.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminReload.java @@ -33,9 +33,9 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemGroupsData; import com.l2jmobius.gameserver.data.xml.impl.MultisellData; import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.data.xml.impl.PrimeShopData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.TransformData; import com.l2jmobius.gameserver.datatables.ItemTable; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import com.l2jmobius.gameserver.instancemanager.QuestManager; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminSkill.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminSkill.java index 90578fea82..f236f673bf 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminSkill.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminSkill.java @@ -22,8 +22,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.l2jmobius.gameserver.data.xml.impl.ClassListData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Object; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminTest.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminTest.java index e9a4f17e03..55caeee18b 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminTest.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminTest.java @@ -21,7 +21,7 @@ import java.util.StringTokenizer; import com.l2jmobius.Config; import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.actor.L2Character; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/HomeBoard.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/HomeBoard.java index 7639ad339a..9ab2ad2f42 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/HomeBoard.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/HomeBoard.java @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.xml.impl.BuyListData; import com.l2jmobius.gameserver.data.xml.impl.MultisellData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.handler.CommunityBoardHandler; import com.l2jmobius.gameserver.handler.IParseBoardHandler; import com.l2jmobius.gameserver.instancemanager.PremiumManager; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/CallPc.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/CallPc.java index 2808bb91aa..bcd25a5619 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/CallPc.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/CallPc.java @@ -85,7 +85,7 @@ public final class CallPc extends AbstractEffect target.addScript(new SummonRequestHolder(activeChar, info.getSkill())); final ConfirmDlg confirm = new ConfirmDlg(SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId()); - confirm.addCharName(activeChar); + confirm.addString(activeChar.getName()); confirm.addZoneName(activeChar.getX(), activeChar.getY(), activeChar.getZ()); confirm.addTime(30000); confirm.addRequesterId(activeChar.getObjectId()); @@ -139,7 +139,7 @@ public final class CallPc extends AbstractEffect if (target.inObserverMode()) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_STATE_WHICH_PREVENTS_SUMMONING); - sm.addCharName(target); + sm.addString(target.getName()); activeChar.sendPacket(sm); return false; } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/HealPercent.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/HealPercent.java index cd568f0dbe..fc4cf2228f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/HealPercent.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/HealPercent.java @@ -76,7 +76,7 @@ public final class HealPercent extends AbstractEffect if (info.getEffector().getObjectId() != target.getObjectId()) { sm = SystemMessage.getSystemMessage(SystemMessageId.S2_HP_HAS_BEEN_RESTORED_BY_C1); - sm.addCharName(info.getEffector()); + sm.addString(info.getEffector().getName()); } else { diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/MagicalAttackMp.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/MagicalAttackMp.java index e5ea753e10..fedbb59f98 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/MagicalAttackMp.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/MagicalAttackMp.java @@ -54,8 +54,8 @@ public final class MagicalAttackMp extends AbstractEffect if (info.getEffected().isPlayer()) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_RESISTED_C2_S_MAGIC); - sm.addCharName(info.getEffected()); - sm.addCharName(info.getEffector()); + sm.addString(info.getEffected().getName()); + sm.addString(info.getEffector().getName()); info.getEffected().sendPacket(sm); } return false; @@ -102,7 +102,7 @@ public final class MagicalAttackMp extends AbstractEffect if (target.isPlayer()) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_S_MP_HAS_BEEN_DRAINED_BY_C1); - sm.addCharName(activeChar); + sm.addString(activeChar.getName()); sm.addInt((int) mp); target.sendPacket(sm); } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHeal.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHeal.java index 45b28f32db..e417d45643 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHeal.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHeal.java @@ -72,7 +72,7 @@ public final class ManaHeal extends AbstractEffect if (info.getEffector().getObjectId() != target.getObjectId()) { sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MP_HAS_BEEN_RESTORED_BY_C1); - sm.addCharName(info.getEffector()); + sm.addString(info.getEffector().getName()); } else { diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHealByLevel.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHealByLevel.java index 4606117931..8e8b9f0008 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHealByLevel.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHealByLevel.java @@ -123,7 +123,7 @@ public final class ManaHealByLevel extends AbstractEffect final SystemMessage sm = SystemMessage.getSystemMessage(info.getEffector().getObjectId() != target.getObjectId() ? SystemMessageId.S2_MP_HAS_BEEN_RESTORED_BY_C1 : SystemMessageId.S1_MP_HAS_BEEN_RESTORED); if (info.getEffector().getObjectId() != target.getObjectId()) { - sm.addCharName(info.getEffector()); + sm.addString(info.getEffector().getName()); } sm.addInt((int) amount); target.sendPacket(sm); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHealPercent.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHealPercent.java index 6b0cf1c951..783b0b23a2 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHealPercent.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/ManaHealPercent.java @@ -76,7 +76,7 @@ public final class ManaHealPercent extends AbstractEffect if (info.getEffector().getObjectId() != target.getObjectId()) { sm = SystemMessage.getSystemMessage(SystemMessageId.S2_MP_HAS_BEEN_RESTORED_BY_C1); - sm.addCharName(info.getEffector()); + sm.addString(info.getEffector().getName()); } else { diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/SetSkill.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/SetSkill.java index 10aaf82aec..a13968bd19 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/SetSkill.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/SetSkill.java @@ -16,7 +16,7 @@ */ package handlers.effecthandlers; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.conditions.Condition; import com.l2jmobius.gameserver.model.effects.AbstractEffect; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByAttack.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByAttack.java index 22f6edbef3..e82b4bae11 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByAttack.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByAttack.java @@ -85,7 +85,7 @@ public final class TriggerSkillByAttack extends AbstractEffect public void onAttackEvent(OnCreatureDamageDealt event) { - if (event.isDamageOverTime() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0))) + if (event.isDamageOverTime() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLevel() == 0))) { return; } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByAvoid.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByAvoid.java index 5c5973fd87..10370014a6 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByAvoid.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByAvoid.java @@ -60,7 +60,7 @@ public final class TriggerSkillByAvoid extends AbstractEffect public void onAvoidEvent(OnCreatureAttackAvoid event) { - if (event.isDamageOverTime() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0))) + if (event.isDamageOverTime() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLevel() == 0))) { return; } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByDamage.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByDamage.java index ae949e0946..a72aeb40e8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByDamage.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillByDamage.java @@ -62,7 +62,7 @@ public final class TriggerSkillByDamage extends AbstractEffect public void onDamageReceivedEvent(OnCreatureDamageReceived event) { - if (event.isDamageOverTime() || (_chance == 0) || (_skill.getSkillLvl() == 0)) + if (event.isDamageOverTime() || (_chance == 0) || (_skill.getSkillLevel() == 0)) { return; } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillBySkill.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillBySkill.java index bc55eeb766..d7905bf48c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillBySkill.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/TriggerSkillBySkill.java @@ -62,7 +62,7 @@ public final class TriggerSkillBySkill extends AbstractEffect public void onSkillUseEvent(OnCreatureSkillUse event) { - if ((_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLvl() == 0) || (_castSkillId == 0))) + if ((_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLevel() == 0) || (_castSkillId == 0))) { return; } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java index 9cb7c010f3..570785ef0d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BeastSoulShot.java @@ -97,7 +97,7 @@ public class BeastSoulShot implements IItemHandler activeOwner.sendPacket(SystemMessageId.YOUR_PET_USES_SPIRITSHOT); activeOwner.getSummon().setChargedShot(ShotType.SOULSHOTS, true); - Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(activeOwner.getSummon(), activeOwner.getSummon(), skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600); + Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(activeOwner.getSummon(), activeOwner.getSummon(), skills[0].getSkillId(), skills[0].getSkillLevel(), 0, 0), 600); return true; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java index 3ae7a68b2d..6e6b8b36bf 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BeastSpiritShot.java @@ -97,7 +97,7 @@ public class BeastSpiritShot implements IItemHandler activeOwner.sendPacket(SystemMessageId.YOUR_PET_USES_SPIRITSHOT); activeOwner.getSummon().setChargedShot(isBlessed ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, true); - Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(activeOwner.getSummon(), activeOwner.getSummon(), skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600); + Broadcast.toSelfAndKnownPlayersInRadius(activeOwner, new MagicSkillUse(activeOwner.getSummon(), activeOwner.getSummon(), skills[0].getSkillId(), skills[0].getSkillLevel(), 0, 0), 600); return true; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java index ae28b93d4c..078b447706 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/BlessedSpiritShot.java @@ -97,7 +97,7 @@ public class BlessedSpiritShot implements IItemHandler activeChar.sendPacket(SystemMessageId.YOUR_SPIRITSHOT_HAS_BEEN_ENABLED); activeChar.setChargedShot(ShotType.BLESSED_SPIRITSHOTS, true); - Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600); + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLevel(), 0, 0), 600); return true; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/FishShots.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/FishShots.java index b6a990f7af..650708b795 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/FishShots.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/FishShots.java @@ -87,7 +87,7 @@ public class FishShots implements IItemHandler final L2Object oldTarget = activeChar.getTarget(); activeChar.setTarget(activeChar); - Broadcast.toSelfAndKnownPlayers(activeChar, new MagicSkillUse(activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0)); + Broadcast.toSelfAndKnownPlayers(activeChar, new MagicSkillUse(activeChar, skills[0].getSkillId(), skills[0].getSkillLevel(), 0, 0)); activeChar.setTarget(oldTarget); return true; } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/PetFood.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/PetFood.java index 65b64869b0..683dcad3f8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/PetFood.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/PetFood.java @@ -20,7 +20,7 @@ import java.util.List; import com.l2jmobius.Config; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -51,7 +51,7 @@ public class PetFood implements IItemHandler { for (SkillHolder sk : skills) { - useFood(playable, sk.getSkillId(), sk.getSkillLvl(), item); + useFood(playable, sk.getSkillId(), sk.getSkillLevel(), item); } } return true; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java index e17633990b..a707c3ecb0 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/SoulShots.java @@ -110,7 +110,7 @@ public class SoulShots implements IItemHandler // Send message to client activeChar.sendPacket(SystemMessageId.YOUR_SOULSHOTS_ARE_ENABLED); - Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600); + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLevel(), 0, 0), 600); return true; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java index 9f907d66d4..51b4cf3467 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/itemhandlers/SpiritShot.java @@ -97,7 +97,7 @@ public class SpiritShot implements IItemHandler // Send message to client activeChar.sendPacket(SystemMessageId.YOUR_SPIRITSHOT_HAS_BEEN_ENABLED); - Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLvl(), 0, 0), 600); + Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getSkillId(), skills[0].getSkillLevel(), 0, 0), 600); return true; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/Reload.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/Reload.java index 2e5a4596ea..2fa6db5bf8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/Reload.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/Reload.java @@ -32,9 +32,9 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemData; import com.l2jmobius.gameserver.data.xml.impl.EnchantItemGroupsData; import com.l2jmobius.gameserver.data.xml.impl.MultisellData; import com.l2jmobius.gameserver.data.xml.impl.NpcData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.TransformData; import com.l2jmobius.gameserver.datatables.ItemTable; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.instancemanager.QuestManager; import com.l2jmobius.gameserver.instancemanager.WalkingManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java index a0d66e8d16..ed00d25931 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/usercommandhandlers/Unstuck.java @@ -20,7 +20,7 @@ import com.l2jmobius.Config; import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.handler.IUserCommandHandler; import com.l2jmobius.gameserver.model.TeleportWhereType; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java index a346d52b4a..113fc2a0cb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java @@ -28,7 +28,7 @@ import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.SevenSigns; import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.PlayerAction; import com.l2jmobius.gameserver.handler.IVoicedCommandHandler; import com.l2jmobius.gameserver.instancemanager.CoupleManager; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/AbstractInstance.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/AbstractInstance.java index 3748dcb4cf..0c09224dc8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/AbstractInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/AbstractInstance.java @@ -82,7 +82,7 @@ public abstract class AbstractInstance extends AbstractNpcAI onEnterInstance(player, instance, true); final Instance inst = InstanceManager.getInstance().getInstance(instance.getInstanceId()); - if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_ENTER) + if (inst.getReenterType() == InstanceReenterType.ON_ENTER) { handleReenterTime(instance); } @@ -103,7 +103,7 @@ public abstract class AbstractInstance extends AbstractNpcAI { final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_FINISH) + if (inst.getReenterType() == InstanceReenterType.ON_FINISH) { handleReenterTime(world); } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java index 5159adc02a..7fba4370b1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java @@ -24,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap; import com.l2jmobius.Config; import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.TrapAction; import com.l2jmobius.gameserver.geoengine.GeoEngine; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java index 60a70b79a2..9fa4e4c66e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java @@ -815,7 +815,7 @@ public final class FinalEmperialTomb extends AbstractInstance implements IGameXm { _world.OnSong = element; broadCastPacket(_world, new ExShowScreenMessage(2, -1, 2, 0, 0, 0, 0, true, 4000, false, null, element.songName, null)); - broadCastPacket(_world, new MagicSkillUse(_world.frintezza, _world.frintezza, element.skill.getSkillId(), element.skill.getSkillLvl(), element.skill.getSkill().getHitTime(), 0)); + broadCastPacket(_world, new MagicSkillUse(_world.frintezza, _world.frintezza, element.skill.getSkillId(), element.skill.getSkillLevel(), element.skill.getSkill().getHitTime(), 0)); _world.songEffectTask = ThreadPool.schedule(new SongTask(_world, 1), element.skill.getSkill().getHitTime() - 10000); _world.songTask = ThreadPool.schedule(new SongTask(_world, 0), element.skill.getSkill().getHitTime()); break; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/ScarletVanHalisha.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/ScarletVanHalisha.java index 2803227e27..44eb9ea0b3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/ScarletVanHalisha.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/ScarletVanHalisha.java @@ -23,7 +23,7 @@ import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE; import java.util.ArrayList; import com.l2jmobius.commons.util.Rnd; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2World; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java index 0c4acd340d..8c5401230d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java @@ -24,7 +24,7 @@ import java.util.Map; import java.util.function.Function; import java.util.logging.Level; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.InstanceManager; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2Spawn; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index a6d9c89225..898366e04c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -16,7 +16,7 @@ */ package instances.NornilsGarden; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.InstanceManager; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.Location; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java index e89924cc2c..443f8796de 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java @@ -25,7 +25,7 @@ import java.util.Map; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.InstanceManager; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.Location; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00242_PossessorOfAPreciousSoul2/Q00242_PossessorOfAPreciousSoul2.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00242_PossessorOfAPreciousSoul2/Q00242_PossessorOfAPreciousSoul2.java index 3b13f7e56c..9cb8078733 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00242_PossessorOfAPreciousSoul2/Q00242_PossessorOfAPreciousSoul2.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00242_PossessorOfAPreciousSoul2/Q00242_PossessorOfAPreciousSoul2.java @@ -16,7 +16,7 @@ */ package quests.Q00242_PossessorOfAPreciousSoul2; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.QuestSound; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/xsd/instance.xsd b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/xsd/instance.xsd index 1f6338bf11..306bf72115 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/xsd/instance.xsd +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/xsd/instance.xsd @@ -89,8 +89,8 @@ - - + + diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/DeadLockDetector.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/DeadLockDetector.java index 5a1dd3cec6..0dce124fe8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/DeadLockDetector.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/DeadLockDetector.java @@ -21,12 +21,11 @@ import java.lang.management.ManagementFactory; import java.lang.management.MonitorInfo; import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean; +import java.time.Duration; import java.util.logging.Level; import java.util.logging.Logger; import com.l2jmobius.Config; -import com.l2jmobius.gameserver.Shutdown; -import com.l2jmobius.gameserver.util.Broadcast; /** * Thread to check for deadlocked threads. @@ -34,16 +33,17 @@ import com.l2jmobius.gameserver.util.Broadcast; */ public class DeadLockDetector extends Thread { - private static Logger _log = Logger.getLogger(DeadLockDetector.class.getName()); - - /** Interval to check for deadlocked threads */ - private static final int _sleepTime = Config.DEADLOCK_CHECK_INTERVAL * 1000; + private static Logger LOGGER = Logger.getLogger(DeadLockDetector.class.getName()); + private final Duration _checkInterval; + private final Runnable _deadLockCallback; private final ThreadMXBean tmx; - public DeadLockDetector() + public DeadLockDetector(Duration checkInterval, Runnable deadLockCallback) { super("DeadLockDetector"); + _checkInterval = checkInterval; + _deadLockCallback = deadLockCallback; tmx = ManagementFactory.getThreadMXBean(); } @@ -102,19 +102,19 @@ public class DeadLockDetector extends Thread info.append(Config.EOL); } } - _log.warning(info.toString()); - if (Config.RESTART_ON_DEADLOCK) + LOGGER.warning(info.toString()); + + if (_deadLockCallback != null) { - Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now."); - Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true); + _deadLockCallback.run(); } } - Thread.sleep(_sleepTime); + Thread.sleep(_checkInterval.toMillis()); } catch (Exception e) { - _log.log(Level.WARNING, "DeadLockDetector: ", e); + LOGGER.log(Level.WARNING, "DeadLockDetector: ", e); } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/PropertiesParser.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/PropertiesParser.java index 351dc11b14..844ba24efe 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/PropertiesParser.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/PropertiesParser.java @@ -29,7 +29,7 @@ import java.util.logging.Logger; */ public final class PropertiesParser { - private static final Logger _log = Logger.getLogger(PropertiesParser.class.getName()); + private static final Logger LOGGER = Logger.getLogger(PropertiesParser.class.getName()); private final Properties _properties = new Properties(); private final File _file; @@ -51,7 +51,7 @@ public final class PropertiesParser } catch (Exception e) { - _log.warning("[" + _file.getName() + "] There was an error loading config reason: " + e.getMessage()); + LOGGER.warning("[" + _file.getName() + "] There was an error loading config reason: " + e.getMessage()); } } @@ -71,7 +71,7 @@ public final class PropertiesParser final String value = getValue(key); if (value == null) { - _log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); return defaultValue; } @@ -85,7 +85,7 @@ public final class PropertiesParser } else { - _log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"boolean\" using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"boolean\" using default value: " + defaultValue); return defaultValue; } } @@ -95,7 +95,7 @@ public final class PropertiesParser final String value = getValue(key); if (value == null) { - _log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); return defaultValue; } @@ -105,7 +105,7 @@ public final class PropertiesParser } catch (NumberFormatException e) { - _log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"byte\" using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"byte\" using default value: " + defaultValue); return defaultValue; } } @@ -115,7 +115,7 @@ public final class PropertiesParser final String value = getValue(key); if (value == null) { - _log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); return defaultValue; } @@ -125,7 +125,7 @@ public final class PropertiesParser } catch (NumberFormatException e) { - _log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"short\" using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"short\" using default value: " + defaultValue); return defaultValue; } } @@ -135,7 +135,7 @@ public final class PropertiesParser final String value = getValue(key); if (value == null) { - _log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); return defaultValue; } @@ -145,7 +145,7 @@ public final class PropertiesParser } catch (NumberFormatException e) { - _log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"int\" using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"int\" using default value: " + defaultValue); return defaultValue; } } @@ -155,7 +155,7 @@ public final class PropertiesParser final String value = getValue(key); if (value == null) { - _log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); return defaultValue; } @@ -165,7 +165,7 @@ public final class PropertiesParser } catch (NumberFormatException e) { - _log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"long\" using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"long\" using default value: " + defaultValue); return defaultValue; } } @@ -175,7 +175,7 @@ public final class PropertiesParser final String value = getValue(key); if (value == null) { - _log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); return defaultValue; } @@ -185,7 +185,7 @@ public final class PropertiesParser } catch (NumberFormatException e) { - _log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"float\" using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"float\" using default value: " + defaultValue); return defaultValue; } } @@ -195,7 +195,7 @@ public final class PropertiesParser final String value = getValue(key); if (value == null) { - _log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); return defaultValue; } @@ -205,7 +205,7 @@ public final class PropertiesParser } catch (NumberFormatException e) { - _log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"double\" using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be \"double\" using default value: " + defaultValue); return defaultValue; } } @@ -213,12 +213,12 @@ public final class PropertiesParser public String getString(String key, String defaultValue) { final String value = getValue(key); - if (value != null) + if (value == null) { - return value; + LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); + return defaultValue; } - _log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); - return defaultValue; + return value; } public > T getEnum(String key, Class clazz, T defaultValue) @@ -226,7 +226,7 @@ public final class PropertiesParser final String value = getValue(key); if (value == null) { - _log.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] missing property for key: " + key + " using default value: " + defaultValue); return defaultValue; } @@ -236,7 +236,7 @@ public final class PropertiesParser } catch (IllegalArgumentException e) { - _log.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be enum value of \"" + clazz.getSimpleName() + "\" using default value: " + defaultValue); + LOGGER.warning("[" + _file.getName() + "] Invalid value specified for key: " + key + " specified value: " + value + " should be enum value of \"" + clazz.getSimpleName() + "\" using default value: " + defaultValue); return defaultValue; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/FortUpdater.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/FortUpdater.java index f575bc8bd2..735a8fac42 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/FortUpdater.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/FortUpdater.java @@ -30,7 +30,7 @@ import com.l2jmobius.gameserver.model.itemcontainer.Inventory; */ public class FortUpdater implements Runnable { - protected static Logger _log = Logger.getLogger(FortUpdater.class.getName()); + protected static Logger LOGGER = Logger.getLogger(FortUpdater.class.getName()); private final L2Clan _clan; private final Fort _fort; private int _runCount; @@ -100,7 +100,7 @@ public class FortUpdater implements Runnable } catch (Exception e) { - _log.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "", e); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java index 75d4a5d897..6911b8fdab 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java @@ -21,6 +21,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.lang.management.ManagementFactory; +import java.time.Duration; import java.util.Calendar; import java.util.logging.Level; import java.util.logging.LogManager; @@ -71,6 +72,7 @@ import com.l2jmobius.gameserver.data.xml.impl.PrimeShopData; import com.l2jmobius.gameserver.data.xml.impl.RecipeData; import com.l2jmobius.gameserver.data.xml.impl.SecondaryAuthData; import com.l2jmobius.gameserver.data.xml.impl.SiegeScheduleData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillLearnData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.data.xml.impl.StaticObjectData; @@ -81,7 +83,6 @@ import com.l2jmobius.gameserver.datatables.BotReportTable; import com.l2jmobius.gameserver.datatables.EventDroplist; import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.datatables.MerchantPriceConfigTable; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.datatables.SpawnTable; import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.EffectHandler; @@ -138,8 +139,9 @@ import com.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import com.l2jmobius.gameserver.network.telnet.TelnetServer; import com.l2jmobius.gameserver.scripting.ScriptEngineManager; import com.l2jmobius.gameserver.taskmanager.TaskManager; +import com.l2jmobius.gameserver.util.Broadcast; -public final class GameServer +public class GameServer { private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName()); @@ -175,8 +177,6 @@ public final class GameServer throw new Exception("Could not initialize the ID factory!"); } - new File("log/game").mkdirs(); - // load script engines printSection("Scripting Engines"); EventDispatcher.getInstance(); @@ -398,7 +398,14 @@ public final class GameServer if (Config.DEADLOCK_DETECTOR) { - _deadDetectThread = new DeadLockDetector(); + _deadDetectThread = new DeadLockDetector(Duration.ofSeconds(Config.DEADLOCK_CHECK_INTERVAL), () -> + { + if (Config.RESTART_ON_DEADLOCK) + { + Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now."); + Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true); + } + }); _deadDetectThread.setDaemon(true); _deadDetectThread.start(); } @@ -460,6 +467,8 @@ public final class GameServer LogManager.getLogManager().readConfiguration(is); } + new File("log/game").mkdirs(); + // Initialize config Config.load(); printSection("Database"); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameTimeController.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameTimeController.java index 75200941af..ebefb16876 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameTimeController.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameTimeController.java @@ -32,7 +32,7 @@ import com.l2jmobius.gameserver.model.actor.L2Character; */ public final class GameTimeController extends Thread { - private static final Logger _log = Logger.getLogger(GameTimeController.class.getName()); + private static final Logger LOGGER = Logger.getLogger(GameTimeController.class.getName()); public static final int TICKS_PER_SECOND = 10; // not able to change this without checking through code public static final int MILLIS_IN_TICK = 1000 / TICKS_PER_SECOND; @@ -131,13 +131,13 @@ public final class GameTimeController extends Thread public final void stopTimer() { super.interrupt(); - _log.log(Level.INFO, "Stopping " + getClass().getSimpleName()); + LOGGER.info(getClass().getSimpleName() + ": Stopped."); } @Override public final void run() { - _log.log(Level.CONFIG, getClass().getSimpleName() + ": Started."); + LOGGER.info(getClass().getSimpleName() + ": Started."); long nextTickTime, sleepTime; boolean isNight = isNight(); @@ -157,7 +157,7 @@ public final class GameTimeController extends Thread } catch (Throwable e) { - _log.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName(), e); } sleepTime = nextTickTime - System.currentTimeMillis(); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/MonsterRace.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/MonsterRace.java index a35bca83a6..2c4a84b132 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/MonsterRace.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/MonsterRace.java @@ -26,7 +26,7 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; public class MonsterRace { - protected static final Logger _log = Logger.getLogger(MonsterRace.class.getName()); + protected static final Logger LOGGER = Logger.getLogger(MonsterRace.class.getName()); private final L2Npc[] _monsters; private int[][] _speeds; @@ -40,11 +40,6 @@ public class MonsterRace _second = new int[2]; } - public static MonsterRace getInstance() - { - return SingletonHolder._instance; - } - public void newRace() { int random = 0; @@ -72,7 +67,7 @@ public class MonsterRace } catch (Exception e) { - _log.log(Level.WARNING, "Unable to create monster!", e); + LOGGER.log(Level.WARNING, "Unable to create monster!", e); } } newSpeeds(); @@ -133,6 +128,11 @@ public class MonsterRace return _second[0]; } + public static MonsterRace getInstance() + { + return SingletonHolder._instance; + } + private static class SingletonHolder { protected static final MonsterRace _instance = new MonsterRace(); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/RecipeController.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/RecipeController.java index d918755424..e6f2e43434 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/RecipeController.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/RecipeController.java @@ -170,7 +170,7 @@ public class RecipeController private static class RecipeItemMaker implements Runnable { - private static final Logger _log = Logger.getLogger(RecipeItemMaker.class.getName()); + private static final Logger LOGGER = Logger.getLogger(RecipeItemMaker.class.getName()); protected boolean _isValid; protected List _items = null; protected final L2RecipeList _recipeList; @@ -306,14 +306,14 @@ public class RecipeController if ((_player == null) || (_target == null)) { - _log.warning("player or target == null (disconnected?), aborting" + _target + _player); + LOGGER.warning("player or target == null (disconnected?), aborting" + _target + _player); abort(); return; } if (!_player.isOnline() || !_target.isOnline()) { - _log.warning("player or target is not online, aborting " + _target + _player); + LOGGER.warning("player or target is not online, aborting " + _target + _player); abort(); return; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java index 7970487eb7..e2c38225e5 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java @@ -561,7 +561,7 @@ public class Shutdown extends Thread LOGGER.info("Olympiad System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); Hero.getInstance().shutdown(); LOGGER.info("Hero System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); - ClanTable.getInstance().storeClanScore(); + ClanTable.getInstance().shutdown(); LOGGER.info("Clan System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); // Save Cursed Weapons data before closing. diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/AbstractAI.java index 3c348aaa6d..785e52a4fe 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/AbstractAI.java @@ -48,7 +48,7 @@ import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager; */ public abstract class AbstractAI implements Ctrl { - protected final Logger _log = Logger.getLogger(getClass().getName()); + protected final Logger LOGGER = Logger.getLogger(getClass().getName()); private NextAction _nextAction; @@ -121,7 +121,7 @@ public abstract class AbstractAI implements Ctrl } catch (Exception e) { - _log.warning(getClass().getSimpleName() + ": Error: " + e.getMessage()); + LOGGER.warning(getClass().getSimpleName() + ": Error: " + e.getMessage()); } } } @@ -159,10 +159,6 @@ public abstract class AbstractAI implements Ctrl private static final int FOLLOW_INTERVAL = 1000; private static final int ATTACK_FOLLOW_INTERVAL = 500; - /** - * Constructor of AbstractAI. - * @param creature the creature - */ protected AbstractAI(L2Character creature) { _actor = creature; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index cbb7eb0703..cec73ae6de 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -30,7 +30,7 @@ import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.data.sql.impl.TerritoryTable; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.AISkillScope; import com.l2jmobius.gameserver.enums.AIType; import com.l2jmobius.gameserver.geoengine.GeoEngine; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2BoatAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2BoatAI.java index b0b0a3e55e..3fd8969bf4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2BoatAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2BoatAI.java @@ -28,27 +28,25 @@ import com.l2jmobius.gameserver.network.serverpackets.VehicleStarted; */ public class L2BoatAI extends L2VehicleAI { - public L2BoatAI(L2BoatInstance creature) + public L2BoatAI(L2BoatInstance boat) { - super(creature); + super(boat); } @Override protected void moveTo(int x, int y, int z) { - if (_actor.isMovementDisabled()) + if (!_actor.isMovementDisabled()) { - return; + if (!_clientMoving) + { + _actor.broadcastPacket(new VehicleStarted(getActor(), 1)); + } + + _clientMoving = true; + _actor.moveToLocation(x, y, z, 0); + _actor.broadcastPacket(new VehicleDeparture(getActor())); } - - if (!_clientMoving) - { - _actor.broadcastPacket(new VehicleStarted(getActor(), 1)); - } - - _clientMoving = true; - _actor.moveToLocation(x, y, z, 0); - _actor.broadcastPacket(new VehicleDeparture(getActor())); } @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java index 5a79ea736a..04e14b0410 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2CharacterAI.java @@ -427,7 +427,7 @@ public class L2CharacterAI extends AbstractAI setTarget(object); if ((object.getX() == 0) && (object.getY() == 0)) { - _log.warning("Object in coords 0,0 - using a temporary fix"); + LOGGER.warning("Object in coords 0,0 - using a temporary fix"); object.setXYZ(getActor().getX(), getActor().getY(), getActor().getZ() + 5); } @@ -919,7 +919,7 @@ public class L2CharacterAI extends AbstractAI { if (worldPosition == null) { - _log.warning("maybeMoveToPosition: worldPosition == NULL!"); + LOGGER.warning("maybeMoveToPosition: worldPosition == NULL!"); return false; } @@ -991,7 +991,7 @@ public class L2CharacterAI extends AbstractAI // Get the distance between the current position of the L2Character and the target (x,y) if (target == null) { - _log.warning("maybeMoveToPawn: target == NULL!"); + LOGGER.warning("maybeMoveToPawn: target == NULL!"); return false; } if (offset < 0) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2DoorAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2DoorAI.java index 3e003f256c..e0e8271597 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2DoorAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2DoorAI.java @@ -30,9 +30,9 @@ import com.l2jmobius.gameserver.model.skills.Skill; */ public class L2DoorAI extends L2CharacterAI { - public L2DoorAI(L2DoorInstance creature) + public L2DoorAI(L2DoorInstance door) { - super(creature); + super(door); } @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2PlayableAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2PlayableAI.java index f62b897204..4dff60a8a6 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2PlayableAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2PlayableAI.java @@ -32,12 +32,9 @@ import com.l2jmobius.gameserver.network.SystemMessageId; */ public abstract class L2PlayableAI extends L2CharacterAI { - /** - * @param creature the creature - */ - public L2PlayableAI(L2Playable creature) + public L2PlayableAI(L2Playable playable) { - super(creature); + super(playable); } @Override @@ -84,7 +81,7 @@ public abstract class L2PlayableAI extends L2CharacterAI @Override protected void onIntentionCast(Skill skill, L2Object target) { - if ((target instanceof L2Playable) && skill.isBad()) + if ((target.isPlayable()) && skill.isBad()) { if (target.getActingPlayer().isProtectionBlessingAffected() && ((_actor.getActingPlayer().getLevel() - target.getActingPlayer().getLevel()) >= 10) && (_actor.getActingPlayer().getKarma() > 0) && !target.isInsideZone(ZoneId.PVP)) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java index eb7c48120a..654bb1d654 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2PlayerAI.java @@ -39,11 +39,11 @@ public class L2PlayerAI extends L2PlayableAI { private boolean _thinking; // to prevent recursive thinking - private IntentionCommand _nextIntention = null; + IntentionCommand _nextIntention = null; - public L2PlayerAI(L2PcInstance creature) + public L2PlayerAI(L2PcInstance player) { - super(creature); + super(player); } void saveNextIntention(CtrlIntention intention, Object arg0, Object arg1) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2VehicleAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2VehicleAI.java index ba3ab2bd5e..ebc2ca8c04 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2VehicleAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2VehicleAI.java @@ -28,11 +28,11 @@ public abstract class L2VehicleAI extends L2CharacterAI { /** * Simple AI for vehicles - * @param creature + * @param vehicle */ - public L2VehicleAI(L2Vehicle creature) + public L2VehicleAI(L2Vehicle vehicle) { - super(creature); + super(vehicle); } @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/cache/HtmCache.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/cache/HtmCache.java index e7c85bcab9..d5e2aa16bd 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/cache/HtmCache.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/cache/HtmCache.java @@ -34,7 +34,7 @@ import com.l2jmobius.gameserver.util.Util; */ public class HtmCache { - private static final Logger _log = Logger.getLogger(HtmCache.class.getName()); + private static final Logger LOGGER = Logger.getLogger(HtmCache.class.getName()); private static final HTMLFilter HTML_FILTER = new HTMLFilter(); @@ -57,23 +57,23 @@ public class HtmCache { if (!Config.LAZY_CACHE) { - _log.info("Html cache start..."); + LOGGER.info("Html cache start..."); parseDir(f); - _log.info("Cache[HTML]: " + String.format("%.3f", getMemoryUsage()) + " megabytes on " + getLoadedFiles() + " files loaded"); + LOGGER.info("Cache[HTML]: " + String.format("%.3f", getMemoryUsage()) + " megabytes on " + getLoadedFiles() + " files loaded"); } else { _cache.clear(); _loadedFiles = 0; _bytesBuffLen = 0; - _log.info("Cache[HTML]: Running lazy cache"); + LOGGER.info("Cache[HTML]: Running lazy cache"); } } public void reloadPath(File f) { parseDir(f); - _log.info("Cache[HTML]: Reloaded specified path."); + LOGGER.info("Cache[HTML]: Reloaded specified path."); } public double getMemoryUsage() @@ -137,7 +137,7 @@ public class HtmCache } catch (Exception e) { - _log.log(Level.WARNING, "Problem with htm file " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Problem with htm file " + e.getMessage(), e); } return content; } @@ -148,7 +148,7 @@ public class HtmCache if (content == null) { content = "My text is missing:
    " + path + ""; - _log.warning("Cache[HTML]: Missing HTML page: " + path); + LOGGER.warning("Cache[HTML]: Missing HTML page: " + path); } return content; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java index 453b2d0f59..22b3179644 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java @@ -19,10 +19,10 @@ package com.l2jmobius.gameserver.communitybbs.BB; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Level; import java.util.logging.Logger; @@ -30,9 +30,9 @@ import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager; import com.l2jmobius.gameserver.communitybbs.Manager.TopicBBSManager; -public final class Forum +public class Forum { - private static final Logger _log = Logger.getLogger(Forum.class.getName()); + private static final Logger LOGGER = Logger.getLogger(Forum.class.getName()); // type public static final int ROOT = 0; @@ -46,7 +46,7 @@ public final class Forum public static final int CLANMEMBERONLY = 2; public static final int OWNERONLY = 3; - private final List _children = new ArrayList<>(); + private final List _children; private final Map _topic = new ConcurrentHashMap<>(); private final int _forumId; private String _forumName; @@ -66,6 +66,7 @@ public final class Forum { _forumId = Forumid; _fParent = FParent; + _children = new CopyOnWriteArrayList<>(); } /** @@ -84,6 +85,7 @@ public final class Forum _forumPerm = perm; _fParent = parent; _ownerID = OwnerID; + _children = new CopyOnWriteArrayList<>(); parent._children.add(this); ForumsBBSManager.getInstance().addForum(this); _loaded = true; @@ -109,7 +111,7 @@ public final class Forum } catch (Exception e) { - _log.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e); } try (Connection con = DatabaseFactory.getInstance().getConnection(); @@ -131,7 +133,7 @@ public final class Forum } catch (Exception e) { - _log.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e); } } @@ -153,7 +155,7 @@ public final class Forum } catch (Exception e) { - _log.log(Level.WARNING, "Data error on Forum (children): " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Data error on Forum (children): " + e.getMessage(), e); } } @@ -229,18 +231,17 @@ public final class Forum } catch (Exception e) { - _log.log(Level.WARNING, "Error while saving new Forum to db " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Error while saving new Forum to db " + e.getMessage(), e); } } public void vload() { - if (_loaded) + if (!_loaded) { - return; + load(); + getChildren(); + _loaded = true; } - load(); - getChildren(); - _loaded = true; } } \ No newline at end of file diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java index 23d8a135c2..14d720d07c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java @@ -19,8 +19,8 @@ package com.l2jmobius.gameserver.communitybbs.BB; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Level; import java.util.logging.Logger; @@ -32,7 +32,7 @@ import com.l2jmobius.gameserver.communitybbs.Manager.PostBBSManager; */ public class Post { - private static final Logger _log = Logger.getLogger(Post.class.getName()); + private static Logger LOGGER = Logger.getLogger(Post.class.getName()); public static class CPost { @@ -45,7 +45,7 @@ public class Post public String postTxt; } - private final List _post = new ArrayList<>(); + private final List _post; /** * @param _PostOwner @@ -57,6 +57,7 @@ public class Post */ public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt) { + _post = new CopyOnWriteArrayList<>(); final CPost cp = new CPost(); cp.postId = 0; cp.postOwner = _PostOwner; @@ -69,11 +70,6 @@ public class Post insertindb(cp); } - public Post(Topic t) - { - load(t); - } - public void insertindb(CPost cp) { try (Connection con = DatabaseFactory.getInstance().getConnection(); @@ -90,13 +86,27 @@ public class Post } catch (Exception e) { - _log.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e); } } + public Post(Topic t) + { + _post = new CopyOnWriteArrayList<>(); + load(t); + } + public CPost getCPost(int id) { - return _post.get(id); + int i = 0; + for (CPost cp : _post) + { + if (i++ == id) + { + return cp; + } + } + return null; } public void deleteme(Topic t) @@ -111,7 +121,7 @@ public class Post } catch (Exception e) { - _log.log(Level.WARNING, "Error while deleting post: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Error while deleting post: " + e.getMessage(), e); } } @@ -143,7 +153,7 @@ public class Post } catch (Exception e) { - _log.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Data error on Post " + t.getForumID() + "/" + t.getID() + " : " + e.getMessage(), e); } } @@ -152,10 +162,10 @@ public class Post */ public void updatetxt(int i) { - final CPost cp = getCPost(i); try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?")) { + final CPost cp = getCPost(i); ps.setString(1, cp.postTxt); ps.setInt(2, cp.postId); ps.setInt(3, cp.postTopicId); @@ -164,7 +174,7 @@ public class Post } catch (Exception e) { - _log.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Error while saving new Post to db " + e.getMessage(), e); } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java index 89f1804db6..dfad9ffa60 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java @@ -26,7 +26,7 @@ import com.l2jmobius.gameserver.communitybbs.Manager.TopicBBSManager; public class Topic { - private static final Logger _log = Logger.getLogger(Topic.class.getName()); + private static final Logger LOGGER = Logger.getLogger(Topic.class.getName()); public static final int MORMAL = 0; public static final int MEMO = 1; @@ -86,7 +86,7 @@ public class Topic } catch (Exception e) { - _log.log(Level.WARNING, "Error while saving new Topic to db " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Error while saving new Topic to db " + e.getMessage(), e); } } @@ -138,7 +138,7 @@ public class Topic } catch (Exception e) { - _log.log(Level.WARNING, "Error while deleting topic: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Error while deleting topic: " + e.getMessage(), e); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/BaseBBSManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/BaseBBSManager.java index f917f8acd2..9d8c5d3cd0 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/BaseBBSManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/BaseBBSManager.java @@ -56,7 +56,7 @@ public abstract class BaseBBSManager */ protected void send1002(L2PcInstance activeChar, String string, String string2, String string3) { - final List _arg = new ArrayList<>(); + final List _arg = new ArrayList<>(20); _arg.add("0"); _arg.add("0"); _arg.add("0"); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java index 0fc57d3976..c9652ac83e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java @@ -31,7 +31,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; public class ForumsBBSManager extends BaseBBSManager { private static Logger _log = Logger.getLogger(ForumsBBSManager.class.getName()); - private final List _table = new CopyOnWriteArrayList<>(); + private final List _table; private int _lastid = 1; /** @@ -39,6 +39,7 @@ public class ForumsBBSManager extends BaseBBSManager */ protected ForumsBBSManager() { + _table = new CopyOnWriteArrayList<>(); try (Connection con = DatabaseFactory.getInstance().getConnection(); Statement s = con.createStatement(); ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0")) @@ -50,7 +51,7 @@ public class ForumsBBSManager extends BaseBBSManager } catch (Exception e) { - _log.log(Level.WARNING, "Data error on Forum (root): " + e.getMessage(), e); + _log.log(Level.WARNING, getClass().getSimpleName() + ": Data error on Forum (root): " + e.getMessage(), e); } } @@ -60,7 +61,7 @@ public class ForumsBBSManager extends BaseBBSManager public void initRoot() { _table.forEach(f -> f.vload()); - _log.info("Loaded " + _table.size() + " forums. Last forum id used: " + _lastid); + _log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid); } /** @@ -94,7 +95,14 @@ public class ForumsBBSManager extends BaseBBSManager */ public Forum getForumByName(String name) { - return _table.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null); + for (Forum f : _table) + { + if (f.getName().equals(name)) + { + return f; + } + } + return null; } /** @@ -129,7 +137,14 @@ public class ForumsBBSManager extends BaseBBSManager */ public Forum getForumByID(int idf) { - return _table.stream().filter(f -> f.getID() == idf).findFirst().orElse(null); + for (Forum f : _table) + { + if (f.getID() == idf) + { + return f; + } + } + return null; } @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index c483740b34..927186139c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -89,21 +89,14 @@ public class PostBBSManager extends BaseBBSManager private void showEditPost(Topic topic, Forum forum, L2PcInstance activeChar, int idp) { - if (topic == null) + final Post p = getGPosttByTopic(topic); + if ((forum == null) || (topic == null) || (p == null)) { - CommunityBoardHandler.separateAndSend("

    Error: This topic does not exist!
    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exist!


    ", activeChar); } else { - final Post p = getGPosttByTopic(topic); - if ((forum == null) || (p == null)) - { - CommunityBoardHandler.separateAndSend("

    Error: This forum or post does not exist!
    ", activeChar); - } - else - { - showHtmlEditPost(topic, activeChar, forum, p); - } + showHtmlEditPost(topic, activeChar, forum, p); } } @@ -132,10 +125,9 @@ public class PostBBSManager extends BaseBBSManager private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum) { - // - Post p = getGPosttByTopic(topic); - Locale locale = Locale.getDefault(); - DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); + final Post p = getGPosttByTopic(topic); + final Locale locale = Locale.getDefault(); + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); String mes = p.getCPost(0).postTxt.replace(">", ">"); mes = mes.replace("<", "<"); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index d758d27c41..0ba930c1b3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -19,10 +19,10 @@ package com.l2jmobius.gameserver.communitybbs.Manager; import java.text.DateFormat; import java.util.Calendar; import java.util.Date; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import com.l2jmobius.gameserver.communitybbs.BB.Forum; @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; public class TopicBBSManager extends BaseBBSManager { private final List _table = new CopyOnWriteArrayList<>(); - private final Map _maxId = new HashMap<>(); + private final Map _maxId = new ConcurrentHashMap<>(); protected TopicBBSManager() { @@ -244,7 +244,7 @@ public class TopicBBSManager extends BaseBBSManager { break; } - Topic t = forum.getTopic(j); + final Topic t = forum.getTopic(j); if (t != null) { if (i++ >= (12 * (index - 1))) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java index 0c3ebdfc34..35a00703eb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java @@ -52,19 +52,21 @@ public class CharNameTable public final void addName(L2PcInstance player) { - if (player == null) + if (player != null) { - return; + addName(player.getObjectId(), player.getName()); + _accessLevels.put(player.getObjectId(), player.getAccessLevel().getLevel()); } - addName(player.getObjectId(), player.getName()); - _accessLevels.put(player.getObjectId(), player.getAccessLevel().getLevel()); } private final void addName(int objectId, String name) { - if ((name != null) && !name.equals(_chars.get(objectId))) + if (name != null) { - _chars.put(objectId, name); + if (!name.equals(_chars.get(objectId))) + { + _chars.put(objectId, name); + } } } @@ -105,8 +107,8 @@ public class CharNameTable { while (rs.next()) { - id = rs.getInt(1); - accessLevel = rs.getInt(2); + id = rs.getInt("charId"); + accessLevel = rs.getInt("accesslevel"); } } } @@ -115,14 +117,14 @@ public class CharNameTable _log.log(Level.WARNING, getClass().getSimpleName() + ": Could not check existing char name: " + e.getMessage(), e); } - if (id <= 0) + if (id > 0) { - return -1; // not found + _chars.put(id, name); + _accessLevels.put(id, accessLevel); + return id; } - _chars.put(id, name); - _accessLevels.put(id, accessLevel); - return id; + return -1; // not found } public final String getNameById(int id) @@ -151,9 +153,9 @@ public class CharNameTable { if (rset.next()) { - name = rset.getString(1); + name = rset.getString("char_name"); _chars.put(id, name); - _accessLevels.put(id, rset.getInt(2)); + _accessLevels.put(id, rset.getInt("accesslevel")); return name; } } @@ -173,14 +175,17 @@ public class CharNameTable public synchronized boolean doesCharNameExist(String name) { - boolean result = true; + boolean result = false; try (Connection con = DatabaseFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement("SELECT account_name FROM characters WHERE char_name=?")) + PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) as count FROM characters WHERE char_name=?")) { ps.setString(1, name); try (ResultSet rs = ps.executeQuery()) { - result = rs.next(); + if (rs.next()) + { + result = rs.getInt("count") > 0; + } } } catch (SQLException e) @@ -193,20 +198,20 @@ public class CharNameTable public int getAccountCharacterCount(String account) { try (Connection con = DatabaseFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) FROM characters WHERE account_name=?")) + PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) as count FROM characters WHERE account_name=?")) { ps.setString(1, account); try (ResultSet rset = ps.executeQuery()) { - while (rset.next()) + if (rset.next()) { - return rset.getInt(1); + return rset.getInt("count"); } } } catch (SQLException e) { - _log.log(Level.WARNING, getClass().getSimpleName() + ": Could not check existing char count: " + e.getMessage(), e); + _log.log(Level.WARNING, "Couldn't retrieve account for id: " + e.getMessage(), e); } return 0; } @@ -219,14 +224,14 @@ public class CharNameTable { while (rs.next()) { - final int id = rs.getInt(1); - _chars.put(id, rs.getString(2)); - _accessLevels.put(id, rs.getInt(3)); + final int id = rs.getInt("charId"); + _chars.put(id, rs.getString("char_name")); + _accessLevels.put(id, rs.getInt("accesslevel")); } } catch (SQLException e) { - _log.log(Level.WARNING, getClass().getSimpleName() + ": Could not load char name: " + e.getMessage(), e); + _log.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't retrieve all char id/name/access: " + e.getMessage(), e); } _log.info(getClass().getSimpleName() + ": Loaded " + _chars.size() + " char names."); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java index c0f1dd55fb..46f0d1c427 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java @@ -29,7 +29,7 @@ import com.l2jmobius.Config; import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.L2PetData; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java index 22dce7a07d..f8c52d4f1b 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java @@ -67,7 +67,7 @@ import com.l2jmobius.gameserver.util.Util; */ public class ClanTable { - private static final Logger _log = Logger.getLogger(ClanTable.class.getName()); + private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName()); private final Map _clans = new ConcurrentHashMap<>(); protected ClanTable() @@ -99,9 +99,9 @@ public class ClanTable } catch (Exception e) { - _log.log(Level.SEVERE, "Error restoring ClanTable.", e); + LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e); } - _log.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database."); + LOGGER.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database."); allianceCheck(); restorewars(); } @@ -331,7 +331,7 @@ public class ClanTable } catch (Exception e) { - _log.log(Level.SEVERE, getClass().getSimpleName() + ": Error removing clan from DB.", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error removing clan from DB.", e); } // Notify to scripts @@ -387,7 +387,7 @@ public class ClanTable } catch (Exception e) { - _log.log(Level.SEVERE, getClass().getSimpleName() + ": Error storing clan wars data.", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error storing clan wars data.", e); } // SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.WAR_WITH_THE_S1_CLAN_HAS_BEGUN); @@ -425,7 +425,7 @@ public class ClanTable } catch (Exception e) { - _log.log(Level.SEVERE, getClass().getSimpleName() + ": Error removing clan wars data.", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error removing clan wars data.", e); } // SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.WAR_WITH_THE_S1_CLAN_HAS_ENDED); @@ -473,13 +473,13 @@ public class ClanTable } else { - _log.log(Level.WARNING, getClass().getSimpleName() + ": restorewars one of clans is null clan1:" + clan1 + " clan2:" + clan2); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": restorewars one of clans is null clan1:" + clan1 + " clan2:" + clan2); } } } catch (Exception e) { - _log.log(Level.SEVERE, getClass().getSimpleName() + ": Error restoring clan wars data.", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error restoring clan wars data.", e); } } @@ -497,7 +497,7 @@ public class ClanTable clan.setAllyName(null); clan.changeAllyCrest(0, true); clan.updateClanInDB(); - _log.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); + LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); } } } @@ -518,11 +518,11 @@ public class ClanTable return clanAllies; } - public void storeClanScore() + public void shutdown() { for (L2Clan clan : _clans.values()) { - clan.updateClanScoreInDB(); + clan.updateInDB(); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java index f328080f8e..c4300e0062 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java @@ -36,7 +36,6 @@ import org.w3c.dom.Node; import com.l2jmobius.Config; import com.l2jmobius.commons.util.IGameXmlReader; import com.l2jmobius.gameserver.datatables.ItemTable; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.AISkillScope; import com.l2jmobius.gameserver.enums.DropType; import com.l2jmobius.gameserver.model.StatsSet; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/PetSkillData.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/PetSkillData.java index cdfc1f2201..edd58ef0cb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/PetSkillData.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/PetSkillData.java @@ -28,7 +28,6 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import com.l2jmobius.commons.util.IGameXmlReader; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.holders.SkillHolder; @@ -106,7 +105,7 @@ public class PetSkillData implements IGameXmlReader { continue; } - if (skillHolder.getSkillLvl() == 0) + if (skillHolder.getSkillLevel() == 0) { if (pet.getLevel() < 70) { @@ -131,9 +130,9 @@ public class PetSkillData implements IGameXmlReader } else if (1 <= pet.getLevel()) { - if (skillHolder.getSkillLvl() > lvl) + if (skillHolder.getSkillLevel() > lvl) { - lvl = skillHolder.getSkillLvl(); + lvl = skillHolder.getSkillLevel(); } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/SkillData.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/SkillData.java similarity index 94% rename from L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/SkillData.java rename to L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/SkillData.java index 2e8db0f6e9..cf8c130a05 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/SkillData.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/SkillData.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.l2jmobius.gameserver.datatables; +package com.l2jmobius.gameserver.data.xml.impl; import java.util.HashMap; import java.util.HashSet; @@ -22,7 +22,6 @@ import java.util.Map; import java.util.Set; import java.util.logging.Logger; -import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.engines.DocumentEngine; import com.l2jmobius.gameserver.model.skills.Skill; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java index 726061340f..d046fcfbed 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/SkillTreesData.java @@ -34,7 +34,6 @@ import org.w3c.dom.Node; import com.l2jmobius.Config; import com.l2jmobius.commons.util.IGameXmlReader; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SkillLearn; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/BotReportTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/BotReportTable.java index 08dfb6452e..4a92ced237 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/BotReportTable.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/BotReportTable.java @@ -38,6 +38,7 @@ import org.xml.sax.helpers.DefaultHandler; import com.l2jmobius.Config; import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.database.DatabaseFactory; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -95,7 +96,7 @@ public final class BotReportTable } catch (Exception e) { - LOGGER.log(Level.WARNING, "BotReportTable: Could not load punishments from /config/BotReportPunishments.xml", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not load punishments from /config/BotReportPunishments.xml", e); } loadReportedCharData(); @@ -130,7 +131,6 @@ public final class BotReportTable } catch (Exception e) { - } while (rset.next()) @@ -165,11 +165,11 @@ public final class BotReportTable } } - LOGGER.info("BotReportTable: Loaded " + _reports.size() + " bot reports"); + LOGGER.info(getClass().getSimpleName() + ": Loaded " + _reports.size() + " bot reports"); } catch (Exception e) { - LOGGER.log(Level.WARNING, "BotReportTable: Could not load reported char data!", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not load reported char data!", e); } } @@ -187,19 +187,18 @@ public final class BotReportTable for (Map.Entry entrySet : _reports.entrySet()) { - final Map reportTable = entrySet.getValue()._reporters; - for (int reporterId : reportTable.keySet()) + for (int reporterId : entrySet.getValue()._reporters.keySet()) { ps.setInt(1, entrySet.getKey()); ps.setInt(2, reporterId); - ps.setLong(3, reportTable.get(reporterId)); + ps.setLong(3, entrySet.getValue()._reporters.get(reporterId)); ps.execute(); } } } catch (Exception e) { - LOGGER.log(Level.SEVERE, "BotReportTable: Could not update reported char data in database!", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Could not update reported char data in database!", e); } } @@ -211,7 +210,6 @@ public final class BotReportTable public boolean reportBot(L2PcInstance reporter) { final L2Object target = reporter.getTarget(); - if (target == null) { return false; @@ -321,11 +319,11 @@ public final class BotReportTable } SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_WAS_REPORTED_AS_A_BOT); - sm.addCharName(bot); + sm.addString(bot.getName()); reporter.sendPacket(sm); sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_USED_A_REPORT_POINT_ON_C1_YOU_HAVE_S2_POINTS_REMAINING_ON_THIS_ACCOUNT); - sm.addCharName(bot); + sm.addString(bot.getName()); sm.addInt(rcdRep.getPointsLeft()); reporter.sendPacket(sm); @@ -391,7 +389,7 @@ public final class BotReportTable } else { - LOGGER.warning("BotReportTable: Could not add punishment for " + neededReports + " report(s): Skill " + skillId + "-" + skillLevel + " does not exist!"); + LOGGER.warning(getClass().getSimpleName() + ": Could not add punishment for " + neededReports + " report(s): Skill " + skillId + "-" + skillLevel + " does not exist!"); } } @@ -427,7 +425,7 @@ public final class BotReportTable catch (Exception e) { ThreadPool.schedule(new ResetPointTask(), 24 * 3600 * 1000); - LOGGER.log(Level.WARNING, "BotReportTable: Could not properly schedule bot report points reset task. Scheduled in 24 hours.", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not properly schedule bot report points reset task. Scheduled in 24 hours.", e); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/EventDroplist.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/EventDroplist.java index fbff0b00c8..9fbb08668c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/EventDroplist.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/EventDroplist.java @@ -16,9 +16,10 @@ */ package com.l2jmobius.gameserver.datatables; -import java.util.ArrayList; import java.util.Date; +import java.util.LinkedList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import com.l2jmobius.gameserver.script.DateRange; import com.l2jmobius.gameserver.script.EventDrop; @@ -34,7 +35,7 @@ public class EventDroplist /** * The table containing all DataDrop object */ - private static final List ALL_NPC_DATE_DROPS = new ArrayList<>(); + private static final List ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>(); public static class DateDrop { @@ -103,7 +104,7 @@ public class EventDroplist */ public List getAllDrops() { - final List list = new ArrayList<>(); + final List list = new LinkedList<>(); final Date currentDate = new Date(); for (DateDrop drop : ALL_NPC_DATE_DROPS) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/ItemTable.java index 2e21fb6abe..89b3c159e1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/ItemTable.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/ItemTable.java @@ -63,7 +63,6 @@ public class ItemTable private final Map _etcItems = new HashMap<>(); private final Map _armors = new HashMap<>(); private final Map _weapons = new HashMap<>(); - static { SLOTS.put("shirt", L2Item.SLOT_UNDERWEAR); @@ -143,10 +142,10 @@ public class ItemTable } } buildFastLookupTable(highest); - LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _etcItems.size() + " Etc Items"); - LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _armors.size() + " Armor Items"); - LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _weapons.size() + " Weapon Items"); - LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + (_etcItems.size() + _armors.size() + _weapons.size()) + " Items in total."); + LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _etcItems.size() + " Etc Items"); + LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _armors.size() + " Armor Items"); + LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _weapons.size() + " Weapon Items"); + LOGGER.info(getClass().getSimpleName() + ": Loaded: " + (_etcItems.size() + _armors.size() + _weapons.size()) + " Items in total."); } /** @@ -156,7 +155,7 @@ public class ItemTable private void buildFastLookupTable(int size) { // Create a FastLookUp Table called _allTemplates of size : value of the highest item ID - LOGGER.info(getClass().getSimpleName() + ": Highest item id used:" + size); + LOGGER.info(getClass().getSimpleName() + ": Highest item id used: " + size); _allTemplates = new L2Item[size + 1]; // Insert armor item in Fast Look Up Table @@ -364,7 +363,7 @@ public class ItemTable } catch (Exception e) { - LOGGER.log(Level.WARNING, "could not delete pet objectid:", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not delete pet objectid:", e); } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/engines/DocumentEngine.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/engines/DocumentEngine.java index 2f24589f24..55efdea499 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/engines/DocumentEngine.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/engines/DocumentEngine.java @@ -17,14 +17,14 @@ package com.l2jmobius.gameserver.engines; import java.io.File; -import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.logging.Logger; import com.l2jmobius.Config; import com.l2jmobius.commons.util.file.filter.XMLFilter; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.engines.items.DocumentItem; import com.l2jmobius.gameserver.engines.skills.DocumentSkill; import com.l2jmobius.gameserver.model.items.L2Item; @@ -35,10 +35,10 @@ import com.l2jmobius.gameserver.model.skills.Skill; */ public class DocumentEngine { - private static final Logger _log = Logger.getLogger(DocumentEngine.class.getName()); + private static final Logger LOGGER = Logger.getLogger(DocumentEngine.class.getName()); - private final List _itemFiles = new ArrayList<>(); - private final List _skillFiles = new ArrayList<>(); + private final List _itemFiles = new LinkedList<>(); + private final List _skillFiles = new LinkedList<>(); public static DocumentEngine getInstance() { @@ -64,17 +64,13 @@ public class DocumentEngine final File dir = new File(Config.DATAPACK_ROOT, dirname); if (!dir.exists()) { - _log.warning("Dir " + dir.getAbsolutePath() + " not exists"); + LOGGER.warning("Dir " + dir.getAbsolutePath() + " not exists"); return; } - final File[] files = dir.listFiles(new XMLFilter()); - if (files != null) + for (File f : files) { - for (File f : files) - { - hash.add(f); - } + hash.add(f); } } @@ -82,7 +78,7 @@ public class DocumentEngine { if (file == null) { - _log.warning("Skill file not found."); + LOGGER.warning("Skill file not found."); return null; } final DocumentSkill doc = new DocumentSkill(file); @@ -106,7 +102,7 @@ public class DocumentEngine count++; } } - _log.info(getClass().getSimpleName() + ": Loaded " + count + " Skill templates from XML files."); + LOGGER.info(getClass().getSimpleName() + ": Loaded " + count + " Skill templates from XML files."); } /** @@ -115,7 +111,7 @@ public class DocumentEngine */ public List loadItems() { - final List list = new ArrayList<>(); + final List list = new LinkedList<>(); for (File f : _itemFiles) { final DocumentItem document = new DocumentItem(f); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/enums/InstanceReenterType.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/enums/InstanceReenterType.java index 1420f94500..bb949c8c38 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/enums/InstanceReenterType.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/enums/InstanceReenterType.java @@ -22,6 +22,6 @@ package com.l2jmobius.gameserver.enums; public enum InstanceReenterType { NONE, - ON_INSTANCE_ENTER, - ON_INSTANCE_FINISH, + ON_ENTER, + ON_FINISH, } \ No newline at end of file diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java index 32c3728de3..b4a9846eb5 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java @@ -297,7 +297,7 @@ public class GeoEngine final ABlock block = getBlock(geoX, geoY); if (block == null) // null block check { - // TODO: Find when this can be null. + // TODO: Find when this can be null. (Bad geodata? Check L2World getRegion method.) // _log.warning("Could not find geodata block at " + getWorldX(geoX) + ", " + getWorldY(geoY) + "."); return false; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java index c181a0a483..426d311149 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/HandysBlockCheckerManager.java @@ -158,7 +158,7 @@ public final class HandysBlockCheckerManager if (_arenaPlayers[i].getAllPlayers().contains(player)) { final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST); - msg.addCharName(player); + msg.addString(player.getName()); player.sendPacket(msg); return false; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java index 2b1c54fa5b..ce2e3b4168 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java @@ -28,8 +28,8 @@ import org.w3c.dom.NodeList; import com.l2jmobius.Config; import com.l2jmobius.commons.util.IGameXmlReader; import com.l2jmobius.gameserver.cache.HtmCache; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.datatables.ItemTable; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.PrivateStoreType; import com.l2jmobius.gameserver.handler.CommunityBoardHandler; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -422,7 +422,7 @@ public final class SellBuffsManager implements IGameXmlReader } else if (player.isMounted() || player.isFlyingMounted() || player.isFlying()) { - player.sendMessage("You can't sell buffs in Mounth state!"); + player.sendMessage("You can't sell buffs in Mount state!"); return false; } else if (player.isTransformed()) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java index d89bea7b03..adf509358f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java @@ -30,7 +30,7 @@ import java.util.logging.Logger; import com.l2jmobius.Config; import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.util.PropertiesParser; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.Location; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java index 634177f8ea..711f49e623 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java @@ -36,8 +36,8 @@ import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.util.PropertiesParser; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2SiegeClan; import com.l2jmobius.gameserver.model.L2SkillLearn; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CombatFlag.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CombatFlag.java index 87c7fd5ec9..e6f67ffc18 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CombatFlag.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CombatFlag.java @@ -27,7 +27,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class CombatFlag { - // private static final Logger _log = Logger.getLogger(CombatFlag.class.getName()); + // private static final Logger LOGGER = Logger.getLogger(CombatFlag.class.getName()); private L2PcInstance _player = null; private int _playerId = 0; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CursedWeapon.java index 403b02cfb8..16171c7e74 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CursedWeapon.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CursedWeapon.java @@ -27,8 +27,8 @@ import com.l2jmobius.Config; import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.TransformData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import com.l2jmobius.gameserver.model.L2Party.MessageType; import com.l2jmobius.gameserver.model.actor.L2Attackable; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2AccessLevel.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2AccessLevel.java index e10df56b61..95874bca7b 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2AccessLevel.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2AccessLevel.java @@ -28,7 +28,7 @@ public class L2AccessLevel /** The access level name. */ private String _name = null; /** Child access levels. */ - private L2AccessLevel _childsAccessLevel = null; + L2AccessLevel _childsAccessLevel = null; /** Child access levels. */ private int _child = 0; /** The name color for the access level. */ @@ -87,8 +87,9 @@ public class L2AccessLevel } /** - * Gets the access level. - * @return the access level + * Returns the access level
    + *
    + * @return int: access level
    */ public int getLevel() { @@ -96,8 +97,9 @@ public class L2AccessLevel } /** - * Gets the access level name. - * @return the access level name + * Returns the access level name
    + *
    + * @return String: access level name
    */ public String getName() { @@ -105,8 +107,9 @@ public class L2AccessLevel } /** - * Gets the name color of the access level. - * @return the name color for the access level + * Returns the name color of the access level
    + *
    + * @return int: the name color for the access level
    */ public int getNameColor() { @@ -114,8 +117,9 @@ public class L2AccessLevel } /** - * Gets the title color color of the access level. - * @return the title color for the access level + * Returns the title color color of the access level
    + *
    + * @return int: the title color for the access level
    */ public int getTitleColor() { @@ -123,8 +127,9 @@ public class L2AccessLevel } /** - * Verifies if the access level has GM access or not. - * @return {@code true} if access level have GM access, otherwise {@code false} + * Retuns if the access level has gm access or not
    + *
    + * @return boolean: true if access level have gm access, otherwise false
    */ public boolean isGm() { @@ -132,8 +137,9 @@ public class L2AccessLevel } /** - * Verifies if the access level is allowed to attack in peace zone or not. - * @return {@code true} if the access level is allowed to attack in peace zone, otherwise {@code false} + * Returns if the access level is allowed to attack in peace zone or not
    + *
    + * @return boolean: true if the access level is allowed to attack in peace zone, otherwise false
    */ public boolean allowPeaceAttack() { @@ -141,8 +147,9 @@ public class L2AccessLevel } /** - * Verifies if the access level is allowed to use fixed resurrection or not. - * @return {@ode true} if the access level is allowed to use fixed resurrection, otherwise {@code false} + * Retruns if the access level is allowed to use fixed res or not
    + *
    + * @return true if the access level is allowed to use fixed res, otherwise false
    */ public boolean allowFixedRes() { @@ -150,8 +157,9 @@ public class L2AccessLevel } /** - * Verifies if the access level is allowed to perform transactions or not. - * @return {@ode true} if access level is allowed to perform transactions, otherwise {@code false} + * Returns if the access level is allowed to perform transactions or not
    + *
    + * @return boolean: true if access level is allowed to perform transactions, otherwise false
    */ public boolean allowTransaction() { @@ -159,8 +167,9 @@ public class L2AccessLevel } /** - * Verifies if the access level is allowed to use AltG commands or not. - * @return {@ode true} if access level is allowed to use AltG commands, otherwise {@code false} + * Returns if the access level is allowed to use AltG commands or not
    + *
    + * @return boolean: true if access level is allowed to use AltG commands, otherwise false
    */ public boolean allowAltG() { @@ -168,8 +177,9 @@ public class L2AccessLevel } /** - * Verifies if the access level can give damage or not. - * @return {@ode true} if the access level can give damage, otherwise {@code false} + * Returns if the access level can give damage or not
    + *
    + * @return boolean: true if the access level can give damage, otherwise false
    */ public boolean canGiveDamage() { @@ -177,8 +187,9 @@ public class L2AccessLevel } /** - * Verifies if the access level can take aggro or not. - * @return {@ode true} if the access level can take aggro, otherwise {@code false} + * Returns if the access level can take aggro or not
    + *
    + * @return boolean: true if the access level can take aggro, otherwise false
    */ public boolean canTakeAggro() { @@ -186,8 +197,9 @@ public class L2AccessLevel } /** - * Verifies if the access level can gain exp or not. - * @return {@ode true} if the access level can gain exp, otherwise {@code false} + * Returns if the access level can gain exp or not
    + *
    + * @return boolean: true if the access level can gain exp, otherwise false
    */ public boolean canGainExp() { @@ -195,9 +207,9 @@ public class L2AccessLevel } /** - * Returns if the access level contains allowedAccess as child. - * @param accessLevel the parent access level - * @return {@ode true} if a child access level is equals to allowedAccess, otherwise {@code false} + * Returns if the access level contains allowedAccess as child
    + * @param accessLevel as AccessLevel
    + * @return boolean: true if a child access level is equals to allowedAccess, otherwise false
    */ public boolean hasChildAccess(L2AccessLevel accessLevel) { @@ -210,6 +222,6 @@ public class L2AccessLevel _childsAccessLevel = AdminData.getInstance().getAccessLevel(_child); } - return (_childsAccessLevel.getLevel() == accessLevel.getLevel()) || _childsAccessLevel.hasChildAccess(accessLevel); + return (_childsAccessLevel != null) && ((_childsAccessLevel.getLevel() == accessLevel.getLevel()) || _childsAccessLevel.hasChildAccess(accessLevel)); } } \ No newline at end of file diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2AdminCommandAccessRight.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2AdminCommandAccessRight.java index 178b1c3416..4d73d188e3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2AdminCommandAccessRight.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2AdminCommandAccessRight.java @@ -56,7 +56,7 @@ public class L2AdminCommandAccessRight public boolean hasAccess(L2AccessLevel characterAccessLevel) { final L2AccessLevel accessLevel = AdminData.getInstance().getAccessLevel(_accessLevel); - return ((accessLevel.getLevel() == characterAccessLevel.getLevel()) || characterAccessLevel.hasChildAccess(accessLevel)); + return (accessLevel != null) && ((accessLevel.getLevel() == characterAccessLevel.getLevel()) || characterAccessLevel.hasChildAccess(accessLevel)); } /** diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java index 2c51a84cb8..20d4b94c54 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -40,7 +40,7 @@ import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager; import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.sql.impl.CrestTable; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.FortManager; import com.l2jmobius.gameserver.instancemanager.SiegeManager; @@ -930,7 +930,7 @@ public class L2Clan implements IIdentifiable, INamable /** * Store in database current clan's reputation. */ - public void updateClanScoreInDB() + public void updateInDB() { try (Connection con = DatabaseFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?")) @@ -1723,7 +1723,7 @@ public class L2Clan implements IIdentifiable, INamable public static class RankPrivs { private final int _rankId; - private final int _party;// TODO find out what this stuff means and implement it + private final int _party; // TODO find out what this stuff means and implement it private final EnumIntBitmask _rankPrivs; public RankPrivs(int rank, int party, int privs) @@ -1825,6 +1825,11 @@ public class L2Clan implements IIdentifiable, INamable */ public final SubPledge[] getAllSubPledges() { + if (_subPledges == null) + { + return new SubPledge[0]; + } + return _subPledges.values().toArray(new SubPledge[_subPledges.values().size()]); } @@ -1899,7 +1904,7 @@ public class L2Clan implements IIdentifiable, INamable { if (_subPledges.get(pledgeType) != null) { - // _log.warning("found sub-unit with id: "+pledgeType); + // LOGGER.warning("found sub-unit with id: "+pledgeType); switch (pledgeType) { case SUBUNIT_ACADEMY: @@ -1963,15 +1968,15 @@ public class L2Clan implements IIdentifiable, INamable { // Retrieve all skills of this L2PcInstance from the database ps.setInt(1, getId()); - // _log.warning("clanPrivs restore for ClanId : "+getClanId()); - try (ResultSet rs = ps.executeQuery()) + // LOGGER.warning("clanPrivs restore for ClanId : "+getClanId()); + try (ResultSet rset = ps.executeQuery()) { // Go though the recordset of this SQL query - while (rs.next()) + while (rset.next()) { - final int rank = rs.getInt("rank"); + final int rank = rset.getInt("rank"); // int party = rset.getInt("party"); - final int privileges = rs.getInt("privs"); + final int privileges = rset.getInt("privs"); // Create a SubPledge object for each record if (rank == -1) { @@ -2133,7 +2138,7 @@ public class L2Clan implements IIdentifiable, INamable broadcastToOnlineMembers(new PledgeShowInfoUpdate(this)); if (save) { - updateClanScoreInDB(); + updateInDB(); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ClanMember.java index ea88bd0954..5c28e1ce21 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ClanMember.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ClanMember.java @@ -32,7 +32,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; */ public class L2ClanMember { - private static final Logger _log = Logger.getLogger(L2ClanMember.class.getName()); + private static final Logger LOGGER = Logger.getLogger(L2ClanMember.class.getName()); private final L2Clan _clan; private int _objectId; @@ -241,7 +241,7 @@ public class L2ClanMember } catch (Exception e) { - _log.log(Level.WARNING, "Could not update pledge type: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Could not update pledge type: " + e.getMessage(), e); } } @@ -286,7 +286,7 @@ public class L2ClanMember } catch (Exception e) { - _log.log(Level.WARNING, "Could not update power _grade: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Could not update power _grade: " + e.getMessage(), e); } } @@ -798,7 +798,7 @@ public class L2ClanMember } catch (SQLException e) { - _log.log(Level.WARNING, "Could not save apprentice/sponsor: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Could not save apprentice/sponsor: " + e.getMessage(), e); } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2CommandChannel.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2CommandChannel.java index f630d6c0cb..876d50e7cd 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2CommandChannel.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2CommandChannel.java @@ -117,18 +117,17 @@ public class L2CommandChannel extends AbstractPlayerGroup */ public void disbandChannel() { - if (_parties == null) + if (_parties != null) { - return; - } - for (L2Party party : _parties) - { - if (party != null) + for (L2Party party : _parties) { - removeParty(party); + if (party != null) + { + removeParty(party); + } } + _parties.clear(); } - _parties.clear(); } /** @@ -195,7 +194,11 @@ public class L2CommandChannel extends AbstractPlayerGroup */ public boolean meetRaidWarCondition(L2Object obj) { - return (obj instanceof L2Character) && ((L2Character) obj).isRaid() && (getMemberCount() >= Config.LOOT_RAIDS_PRIVILEGE_CC_SIZE); + if (!((obj instanceof L2Character) && ((L2Character) obj).isRaid())) + { + return false; + } + return (getMemberCount() >= Config.LOOT_RAIDS_PRIVILEGE_CC_SIZE); } /** diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ContactList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ContactList.java index 9a1585f169..7efd01c498 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ContactList.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ContactList.java @@ -19,8 +19,8 @@ package com.l2jmobius.gameserver.model; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -39,9 +39,10 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; */ public class L2ContactList { - private final Logger _log = Logger.getLogger(getClass().getName()); + private static final Logger LOGGER = Logger.getLogger(L2ContactList.class.getName()); + private final L2PcInstance activeChar; - private final List _contacts = new CopyOnWriteArrayList<>(); + private final Set _contacts = ConcurrentHashMap.newKeySet(); private static final String QUERY_ADD = "INSERT INTO character_contacts (charId, contactId) VALUES (?, ?)"; private static final String QUERY_REMOVE = "DELETE FROM character_contacts WHERE charId = ? and contactId = ?"; @@ -58,16 +59,16 @@ public class L2ContactList _contacts.clear(); try (Connection con = DatabaseFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(QUERY_LOAD)) + PreparedStatement statement = con.prepareStatement(QUERY_LOAD)) { - ps.setInt(1, activeChar.getObjectId()); - try (ResultSet rs = ps.executeQuery()) + statement.setInt(1, activeChar.getObjectId()); + try (ResultSet rset = statement.executeQuery()) { int contactId; String contactName; - while (rs.next()) + while (rset.next()) { - contactId = rs.getInt(1); + contactId = rset.getInt(1); contactName = CharNameTable.getInstance().getNameById(contactId); if ((contactName == null) || contactName.equals(activeChar.getName()) || (contactId == activeChar.getObjectId())) { @@ -80,7 +81,7 @@ public class L2ContactList } catch (Exception e) { - _log.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e); } } @@ -124,11 +125,11 @@ public class L2ContactList } try (Connection con = DatabaseFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(QUERY_ADD)) + PreparedStatement statement = con.prepareStatement(QUERY_ADD)) { - ps.setInt(1, activeChar.getObjectId()); - ps.setInt(2, contactId); - ps.execute(); + statement.setInt(1, activeChar.getObjectId()); + statement.setInt(2, contactId); + statement.execute(); _contacts.add(name); @@ -138,7 +139,7 @@ public class L2ContactList } catch (Exception e) { - _log.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e); } return true; } @@ -161,11 +162,11 @@ public class L2ContactList _contacts.remove(name); try (Connection con = DatabaseFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement(QUERY_REMOVE)) + PreparedStatement statement = con.prepareStatement(QUERY_REMOVE)) { - ps.setInt(1, activeChar.getObjectId()); - ps.setInt(2, contactId); - ps.execute(); + statement.setInt(1, activeChar.getObjectId()); + statement.setInt(2, contactId); + statement.execute(); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_WAS_SUCCESSFULLY_DELETED_FROM_YOUR_CONTACT_LIST); sm.addString(name); @@ -173,11 +174,11 @@ public class L2ContactList } catch (Exception e) { - _log.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "Error found in " + activeChar.getName() + "'s ContactsList: " + e.getMessage(), e); } } - public List getAllContacts() + public Set getAllContacts() { return _contacts; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Crest.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Crest.java index ddd86449a6..61589f3602 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Crest.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Crest.java @@ -36,7 +36,7 @@ public final class L2Crest implements IIdentifiable private final int _id; - private CrestType(int id) + CrestType(int id) { _id = id; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ExtractableProduct.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ExtractableProduct.java index 9bda88cfa3..770a3c2856 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ExtractableProduct.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ExtractableProduct.java @@ -28,7 +28,7 @@ public class L2ExtractableProduct /** * Create Extractable product - * @param id crete item id + * @param id create item id * @param min item count max * @param max item count min * @param chance chance for creating diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java index a1e65b6dc5..0cb68edbec 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java @@ -87,7 +87,7 @@ public class L2GroupSpawn extends L2Spawn } catch (Exception e) { - _log.log(Level.WARNING, "NPC class not found: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, "NPC class not found: " + e.getMessage(), e); return null; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2MapRegion.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2MapRegion.java index fe88364ae1..eefb8ec7fe 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2MapRegion.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2MapRegion.java @@ -162,22 +162,50 @@ public class L2MapRegion public final Location getSpawnLoc() { - return Config.RANDOM_RESPAWN_IN_TOWN_ENABLED ? _spawnLocs.get(Rnd.get(_spawnLocs.size())) : _spawnLocs.get(0); + if (Config.RANDOM_RESPAWN_IN_TOWN_ENABLED) + { + return _spawnLocs.get(Rnd.get(_spawnLocs.size())); + } + return _spawnLocs.get(0); } public final Location getOtherSpawnLoc() { - return _otherSpawnLocs != null ? Config.RANDOM_RESPAWN_IN_TOWN_ENABLED ? _otherSpawnLocs.get(Rnd.get(_otherSpawnLocs.size())) : _otherSpawnLocs.get(0) : getSpawnLoc(); + if (_otherSpawnLocs != null) + { + if (Config.RANDOM_RESPAWN_IN_TOWN_ENABLED) + { + return _otherSpawnLocs.get(Rnd.get(_otherSpawnLocs.size())); + } + return _otherSpawnLocs.get(0); + } + return getSpawnLoc(); } public final Location getChaoticSpawnLoc() { - return _chaoticSpawnLocs != null ? Config.RANDOM_RESPAWN_IN_TOWN_ENABLED ? _chaoticSpawnLocs.get(Rnd.get(_chaoticSpawnLocs.size())) : _chaoticSpawnLocs.get(0) : getSpawnLoc(); + if (_chaoticSpawnLocs != null) + { + if (Config.RANDOM_RESPAWN_IN_TOWN_ENABLED) + { + return _chaoticSpawnLocs.get(Rnd.get(_chaoticSpawnLocs.size())); + } + return _chaoticSpawnLocs.get(0); + } + return getSpawnLoc(); } public final Location getBanishSpawnLoc() { - return _banishSpawnLocs != null ? Config.RANDOM_RESPAWN_IN_TOWN_ENABLED ? _banishSpawnLocs.get(Rnd.get(_banishSpawnLocs.size())) : _banishSpawnLocs.get(0) : getSpawnLoc(); + if (_banishSpawnLocs != null) + { + if (Config.RANDOM_RESPAWN_IN_TOWN_ENABLED) + { + return _banishSpawnLocs.get(Rnd.get(_banishSpawnLocs.size())); + } + return _banishSpawnLocs.get(0); + } + return getSpawnLoc(); } public final void addBannedRace(String race, String point) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2PetData.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2PetData.java index 85d7148236..48e6317bae 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2PetData.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2PetData.java @@ -21,7 +21,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.holders.SkillHolder; /** @@ -184,7 +184,7 @@ public class L2PetData { continue; } - if (temp.getSkillLvl() == 0) + if (temp.getSkillLevel() == 0) { if (petLvl < 70) { @@ -207,9 +207,9 @@ public class L2PetData } break; } - if ((temp.getMinLevel() <= petLvl) && (temp.getSkillLvl() > lvl)) + if ((temp.getMinLevel() <= petLvl) && (temp.getSkillLevel() > lvl)) { - lvl = temp.getSkillLvl(); + lvl = temp.getSkillLevel(); } } return lvl; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Radar.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Radar.java index ac6e4c6cb2..4a314c8aa6 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Radar.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Radar.java @@ -16,8 +16,8 @@ */ package com.l2jmobius.gameserver.model; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.network.serverpackets.RadarControl; @@ -28,7 +28,7 @@ import com.l2jmobius.gameserver.network.serverpackets.RadarControl; public final class L2Radar { private final L2PcInstance _player; - private final List _markers = new CopyOnWriteArrayList<>(); + private final Set _markers = ConcurrentHashMap.newKeySet(); public L2Radar(L2PcInstance player) { @@ -48,9 +48,13 @@ public final class L2Radar // Remove a marker from player's radar public void removeMarker(int x, int y, int z) { - final RadarMarker newMarker = new RadarMarker(x, y, z); - - _markers.remove(newMarker); + for (RadarMarker rm : _markers) + { + if ((rm._x == x) && (rm._y == y) && (rm._z == z)) + { + _markers.remove(rm); + } + } _player.sendPacket(new RadarControl(1, 1, x, y, z)); } @@ -102,7 +106,8 @@ public final class L2Radar result = (prime * result) + _type; result = (prime * result) + _x; result = (prime * result) + _y; - return result = (prime * result) + _z; + result = (prime * result) + _z; + return result; } @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java index f0de026abb..2b3013ca04 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java @@ -52,7 +52,7 @@ import com.l2jmobius.gameserver.model.zone.type.NpcSpawnTerritory; */ public class L2Spawn implements IPositionable, IIdentifiable, INamable { - protected static final Logger _log = Logger.getLogger(L2Spawn.class.getName()); + protected static final Logger LOGGER = Logger.getLogger(L2Spawn.class.getName()); /** String identifier of this spawn */ private String _name; @@ -100,7 +100,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable } catch (Exception e) { - _log.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "", e); } _scheduledCount--; @@ -532,7 +532,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable } catch (Exception e) { - _log.log(Level.WARNING, "NPC " + _template.getId() + " class not found", e); + LOGGER.log(Level.WARNING, "NPC " + _template.getId() + " class not found", e); } return null; } @@ -551,10 +551,10 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable // New method if (isTerritoryBased()) { - final int[] p = _spawnTerritory.getRandomPoint(); - newlocx = p[0]; - newlocy = p[1]; - newlocz = p[2]; + final Location p = _spawnTerritory.getRandomPoint(); + newlocx = p.getX(); + newlocy = p.getY(); + newlocz = p.getZ(); } // Old method (for backward compatibility) else if ((getX() == 0) && (getY() == 0)) @@ -698,7 +698,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable { if (delay < 0) { - _log.warning("respawn delay is negative for spawn:" + this); + LOGGER.warning("respawn delay is negative for spawn:" + this); } final int minDelay = delay - randomInterval; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Territory.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Territory.java index b94fcd2bc7..7e58c9c83c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Territory.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Territory.java @@ -107,7 +107,21 @@ public class L2Territory } final double dx1 = p1._x - x; - return ((dx1 >= 0) && ((p2._x - x) >= 0)) || (((dx1 >= 0) || ((p2._x - x) >= 0)) && (((dy1 * (p1._x - p2._x)) / (p1._y - p2._y)) <= dx1)); + final double dx2 = p2._x - x; + + if ((dx1 >= 0) && (dx2 >= 0)) + { + return true; + } + + if ((dx1 < 0) && (dx2 < 0)) + { + return false; + } + + final double dx0 = (dy1 * (p1._x - p2._x)) / (p1._y - p2._y); + + return dx0 <= dx1; } public boolean isInside(int x, int y) @@ -115,7 +129,10 @@ public class L2Territory int intersect_count = 0; for (int i = 0; i < _points.size(); i++) { - if (isIntersect(x, y, _points.get(i > 0 ? i - 1 : _points.size() - 1), _points.get(i))) + final Point p1 = _points.get(i > 0 ? i - 1 : _points.size() - 1); + final Point p2 = _points.get(i); + + if (isIntersect(x, y, p1, p2)) { intersect_count++; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index a7f486c87b..3d24bfceb1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -223,7 +223,6 @@ public final class L2WorldRegion } assert object.getWorldRegion() == this; - if (_visibleObjects == null) { synchronized (object) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/MobGroupTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/MobGroupTable.java index d5de7d3c3a..f37f2159e4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/MobGroupTable.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/MobGroupTable.java @@ -26,14 +26,13 @@ import com.l2jmobius.gameserver.model.actor.instance.L2ControllableMobInstance; */ public class MobGroupTable { - private final Map _groupMap; + private final Map _groupMap = new ConcurrentHashMap<>(); public static final int FOLLOW_RANGE = 300; public static final int RANDOM_RANGE = 300; protected MobGroupTable() { - _groupMap = new ConcurrentHashMap<>(); } public static MobGroupTable getInstance() diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/PartyMatchRoom.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/PartyMatchRoom.java index 5b814d2848..c2ba1357f4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/PartyMatchRoom.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/PartyMatchRoom.java @@ -83,7 +83,7 @@ public class PartyMatchRoom implements IIdentifiable for (L2PcInstance _member : _members) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_LEFT_THE_PARTY_ROOM); - sm.addCharName(player); + sm.addString(player.getName()); _member.sendPacket(sm); _member.sendPacket(new ExManagePartyRoomMember(player, this, 2)); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/PcCondOverride.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/PcCondOverride.java index cd9e5148c6..6a5415683c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/PcCondOverride.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/PcCondOverride.java @@ -41,7 +41,7 @@ public enum PcCondOverride private final int _mask; private final String _descr; - private PcCondOverride(int id, String descr) + PcCondOverride(int id, String descr) { _mask = 1 << id; _descr = descr; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/ShortCuts.java index 3d90d42cda..c46ef5186c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/ShortCuts.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/ShortCuts.java @@ -86,16 +86,16 @@ public class ShortCuts implements IRestorable } try (Connection con = DatabaseFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,class_index) values(?,?,?,?,?,?,?)")) + PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,class_index) values(?,?,?,?,?,?,?)")) { - ps.setInt(1, _owner.getObjectId()); - ps.setInt(2, shortcut.getSlot()); - ps.setInt(3, shortcut.getPage()); - ps.setInt(4, shortcut.getType().ordinal()); - ps.setInt(5, shortcut.getId()); - ps.setInt(6, shortcut.getLevel()); - ps.setInt(7, _owner.getClassIndex()); - ps.execute(); + statement.setInt(1, _owner.getObjectId()); + statement.setInt(2, shortcut.getSlot()); + statement.setInt(3, shortcut.getPage()); + statement.setInt(4, shortcut.getType().ordinal()); + statement.setInt(5, shortcut.getId()); + statement.setInt(6, shortcut.getLevel()); + statement.setInt(7, _owner.getClassIndex()); + statement.execute(); } catch (Exception e) { @@ -154,13 +154,13 @@ public class ShortCuts implements IRestorable private void deleteShortCutFromDb(Shortcut shortcut) { try (Connection con = DatabaseFactory.getInstance().getConnection(); - PreparedStatement ps = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?")) + PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?")) { - ps.setInt(1, _owner.getObjectId()); - ps.setInt(2, shortcut.getSlot()); - ps.setInt(3, shortcut.getPage()); - ps.setInt(4, _owner.getClassIndex()); - ps.execute(); + statement.setInt(1, _owner.getObjectId()); + statement.setInt(2, shortcut.getSlot()); + statement.setInt(3, shortcut.getPage()); + statement.setInt(4, _owner.getClassIndex()); + statement.execute(); } catch (Exception e) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/SpawnListener.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/SpawnListener.java index dacec73ab1..87b17936ac 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/SpawnListener.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/SpawnListener.java @@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.actor.L2Npc; * This class ... * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $ */ - public interface SpawnListener { void npcSpawned(L2Npc npc); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/StatsSet.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/StatsSet.java index 87af380179..a2c373a808 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/StatsSet.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/StatsSet.java @@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.interfaces.IParserAdvUtils; */ public class StatsSet implements IParserAdvUtils { - private static final Logger _log = Logger.getLogger(StatsSet.class.getName()); + private static final Logger LOGGER = Logger.getLogger(StatsSet.class.getName()); /** Static empty immutable map, used to avoid multiple null checks over the source. */ public static final StatsSet EMPTY_STATSET = new StatsSet(Collections. emptyMap()); @@ -623,7 +623,7 @@ public class StatsSet implements IParserAdvUtils assert ((min > max) || ((value >= min) && (value < max))); if ((min <= max) && ((value < min) || (value >= max))) { - _log.log(Level.SEVERE, "Incorrect value: " + value + "for: " + key + "Ref: " + reference); + LOGGER.log(Level.SEVERE, "Incorrect value: " + value + "for: " + key + "Ref: " + reference); } set(key, value); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/TradeList.java index 9d93e27605..29fb42db3f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/TradeList.java @@ -18,10 +18,11 @@ package com.l2jmobius.gameserver.model; import static com.l2jmobius.gameserver.model.itemcontainer.Inventory.MAX_ADENA; +import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Logger; import com.l2jmobius.Config; @@ -47,7 +48,7 @@ public class TradeList private final L2PcInstance _owner; private L2PcInstance _partner; - private final List _items = new CopyOnWriteArrayList<>(); + private final Set _items = ConcurrentHashMap.newKeySet(); private String _title; private boolean _packaged; @@ -117,7 +118,7 @@ public class TradeList * @param inventory * @return L2ItemInstance : items in inventory */ - public List getAvailableItems(PcInventory inventory) + public Collection getAvailableItems(PcInventory inventory) { final List list = new LinkedList<>(); for (TradeItem item : _items) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java index 0ffc7a3c5a..369eac97df 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java @@ -966,7 +966,7 @@ public class L2Attackable extends L2Npc if (isRaid() && !isRaidMinion() && (drop.getCount() > 0)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_DIED_AND_DROPPED_S3_S2); - sm.addCharName(this); + sm.addString(getName()); sm.addItemName(item); sm.addLong(drop.getCount()); broadcastPacket(sm); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 79b4a13a88..da7189a92c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -6251,7 +6251,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_EVADED_C2_S_ATTACK); sm.addPcName(target.getActingPlayer()); - sm.addCharName(this); + sm.addString(getName()); target.sendPacket(sm); } } @@ -6656,7 +6656,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe if (_invulAgainst != null) { final SkillHolder holder = getInvulAgainstSkills().get(skillId); - return ((holder != null) && ((holder.getSkillLvl() < 1) || (holder.getSkillLvl() == skillLvl))); + return ((holder != null) && ((holder.getSkillLevel() < 1) || (holder.getSkillLevel() == skillLvl))); } return false; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 51f543eb18..df4b9675b4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -782,7 +782,7 @@ public abstract class L2Summon extends L2Playable { sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_DONE_S3_POINTS_OF_DAMAGE_TO_C2); sm.addNpcName(this); - sm.addCharName(target); + sm.addString(target.getName()); sm.addInt(damage); } @@ -798,7 +798,7 @@ public abstract class L2Summon extends L2Playable { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RECEIVED_S3_DAMAGE_FROM_C2); sm.addNpcName(this); - sm.addCharName(attacker); + sm.addString(attacker.getName()); sm.addInt((int) damage); sendPacket(sm); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2BabyPetInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2BabyPetInstance.java index 04ffcc3cd2..f38248180b 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2BabyPetInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2BabyPetInstance.java @@ -24,7 +24,7 @@ import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.L2PetData.L2PetSkillLearn; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ClanHallManagerInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ClanHallManagerInstance.java index dc74680c3b..05fcc85523 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ClanHallManagerInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ClanHallManagerInstance.java @@ -22,7 +22,7 @@ import java.util.StringTokenizer; import com.l2jmobius.Config; import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.data.sql.impl.TeleportLocationTable; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.instancemanager.CHSiegeManager; import com.l2jmobius.gameserver.instancemanager.ClanHallManager; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2CubicInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2CubicInstance.java index f19d2c28a5..edacdd94d2 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2CubicInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2CubicInstance.java @@ -25,7 +25,7 @@ import java.util.logging.Logger; import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.instancemanager.DuelManager; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2DecoyInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2DecoyInstance.java index 1868906638..82dec8ac68 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2DecoyInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2DecoyInstance.java @@ -20,7 +20,7 @@ import java.util.concurrent.Future; import java.util.logging.Level; import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Decoy; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2FishermanInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2FishermanInstance.java index 4e7d682643..b0001fb1c9 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2FishermanInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2FishermanInstance.java @@ -19,8 +19,8 @@ package com.l2jmobius.gameserver.model.actor.instance; import java.util.List; import com.l2jmobius.Config; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.instancemanager.FishingChampionshipManager; import com.l2jmobius.gameserver.model.L2SkillLearn; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2FortManagerInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2FortManagerInstance.java index 7e87daabf0..beee73d255 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2FortManagerInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2FortManagerInstance.java @@ -22,7 +22,7 @@ import java.util.StringTokenizer; import com.l2jmobius.Config; import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.data.sql.impl.TeleportLocationTable; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.L2TeleportLocation; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2NpcBufferInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2NpcBufferInstance.java index 0b57a45a43..acbf9c29f4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2NpcBufferInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2NpcBufferInstance.java @@ -23,7 +23,7 @@ import java.util.logging.Logger; import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.data.sql.impl.NpcBufferTable; import com.l2jmobius.gameserver.data.sql.impl.NpcBufferTable.NpcBufferData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; @@ -159,7 +159,7 @@ public class L2NpcBufferInstance extends L2Npc } } - final Skill skill = SkillData.getInstance().getSkill(npcBuffGroupInfo.getSkill().getSkillId(), npcBuffGroupInfo.getSkill().getSkillLvl()); + final Skill skill = SkillData.getInstance().getSkill(npcBuffGroupInfo.getSkill().getSkillId(), npcBuffGroupInfo.getSkill().getSkillLevel()); if (skill != null) { skill.applyEffects(player, target); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2NpcInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2NpcInstance.java index 085f7a739d..ebadbc7fa3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2NpcInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2NpcInstance.java @@ -19,8 +19,8 @@ package com.l2jmobius.gameserver.model.actor.instance; import java.util.List; import java.util.Map; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.L2Npc; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index fb9e71b35f..f01c2f7ba0 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -75,9 +75,9 @@ import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; import com.l2jmobius.gameserver.data.xml.impl.PlayerTemplateData; import com.l2jmobius.gameserver.data.xml.impl.PlayerXpPercentLostData; import com.l2jmobius.gameserver.data.xml.impl.RecipeData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; import com.l2jmobius.gameserver.datatables.ItemTable; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.HtmlActionScope; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; @@ -9948,11 +9948,11 @@ public final class L2PcInstance extends L2Playable for (SkillHolder holder : _transformation.getTemplate(this).getSkills()) { - ts.putIfAbsent(holder.getSkillId(), holder.getSkillLvl()); + ts.putIfAbsent(holder.getSkillId(), holder.getSkillLevel()); - if (ts.get(holder.getSkillId()) < holder.getSkillLvl()) + if (ts.get(holder.getSkillId()) < holder.getSkillLevel()) { - ts.put(holder.getSkillId(), holder.getSkillLvl()); + ts.put(holder.getSkillId(), holder.getSkillLevel()); } } @@ -9960,10 +9960,10 @@ public final class L2PcInstance extends L2Playable { if (getLevel() >= holder.getMinLevel()) { - ts.putIfAbsent(holder.getSkillId(), holder.getSkillLvl()); - if (ts.get(holder.getSkillId()) < holder.getSkillLvl()) + ts.putIfAbsent(holder.getSkillId(), holder.getSkillLevel()); + if (ts.get(holder.getSkillId()) < holder.getSkillLevel()) { - ts.put(holder.getSkillId(), holder.getSkillLvl()); + ts.put(holder.getSkillId(), holder.getSkillLevel()); } } } @@ -12415,7 +12415,7 @@ public final class L2PcInstance extends L2Playable { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_EVADED_C2_S_ATTACK); sm.addPcName(target.getActingPlayer()); - sm.addCharName(this); + sm.addString(getName()); target.sendPacket(sm); } final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_ATTACK_WENT_ASTRAY); @@ -12456,7 +12456,7 @@ public final class L2PcInstance extends L2Playable { sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_DONE_S3_POINTS_OF_DAMAGE_TO_C2); sm.addPcName(this); - sm.addCharName(target); + sm.addString(target.getName()); sm.addInt(damage); } sendPacket(sm); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java index 1f4933bea1..676c8a1ff7 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java @@ -33,8 +33,8 @@ import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable; import com.l2jmobius.gameserver.data.sql.impl.SummonEffectsTable; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.datatables.ItemTable; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.ItemLocation; import com.l2jmobius.gameserver.enums.PartyDistributionType; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java index f77bded88a..29c0dac506 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java @@ -30,7 +30,7 @@ import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable; import com.l2jmobius.gameserver.data.sql.impl.SummonEffectsTable; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.actor.L2Character; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TamedBeastInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TamedBeastInstance.java index 2b0400014b..7ad7374f02 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TamedBeastInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TamedBeastInstance.java @@ -26,7 +26,7 @@ import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.data.xml.impl.NpcData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.Location; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TrapInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TrapInstance.java index 4e3a9cd652..659bcc561d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TrapInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2TrapInstance.java @@ -332,8 +332,8 @@ public final class L2TrapInstance extends L2Npc else { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_DONE_S3_POINTS_OF_DAMAGE_TO_C2); - sm.addCharName(this); - sm.addCharName(target); + sm.addString(this.getName()); + sm.addString(target.getName()); sm.addInt(damage); _owner.sendPacket(sm); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/status/PcStatus.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/status/PcStatus.java index d8e1aff11f..1b812dade3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/status/PcStatus.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/status/PcStatus.java @@ -231,7 +231,7 @@ public class PcStatus extends PlayableStatus // Send a System Message to the L2PcInstance smsg = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RECEIVED_S3_DAMAGE_FROM_C2); smsg.addString(getActiveChar().getName()); - smsg.addCharName(attacker); + smsg.addString(attacker.getName()); smsg.addInt(fullValue); getActiveChar().sendPacket(smsg); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/status/PetStatus.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/status/PetStatus.java index 71505b4eb4..e897f6ccf8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/status/PetStatus.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/status/PetStatus.java @@ -55,7 +55,7 @@ public class PetStatus extends SummonStatus if (!isDOT && (getActiveChar().getOwner() != null)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOUR_PET_RECEIVED_S2_DAMAGE_BY_C1); - sm.addCharName(attacker); + sm.addString(attacker.getName()); sm.addInt((int) value); getActiveChar().sendPacket(sm); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/transform/Transform.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/transform/Transform.java index 9f426d9f57..20817e8145 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/transform/Transform.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/transform/Transform.java @@ -338,7 +338,7 @@ public final class Transform implements IIdentifiable { for (AdditionalSkillHolder holder : template.getAdditionalSkills()) { - if ((player.getLevel() >= holder.getMinLevel()) && (player.getSkillLevel(holder.getSkillId()) < holder.getSkillLvl())) + if ((player.getLevel() >= holder.getMinLevel()) && (player.getSkillLevel(holder.getSkillId()) < holder.getSkillLevel())) { player.addSkill(holder.getSkill(), false); player.addTransformSkill(holder.getSkill()); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java index 0f4dca3353..74599dd08c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java @@ -27,7 +27,7 @@ import java.util.logging.Logger; import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.util.Rnd; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.datatables.SpawnTable; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager; @@ -583,6 +583,12 @@ public final class BlockCheckerEngine for (L2ItemInstance item : _drops) { + // npe + if (item == null) + { + continue; + } + // a player has it, it will be deleted later if (!item.isSpawned() || (item.getOwnerId() != 0)) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Castle.java index 6108984d4c..c054eb1d68 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Castle.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Castle.java @@ -32,8 +32,8 @@ import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.gameserver.data.sql.impl.ClanTable; import com.l2jmobius.gameserver.data.xml.impl.DoorData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.MountType; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.CastleManorManager; @@ -726,26 +726,23 @@ public final class Castle extends AbstractResidence { _function.put(type, new CastleFunction(type, lvl, lease, 0, rate, 0, false)); } + else if ((lvl == 0) && (lease == 0)) + { + removeFunction(type); + } else { - if ((lvl == 0) && (lease == 0)) + final int diffLease = lease - _function.get(type).getLease(); + if (diffLease > 0) { - removeFunction(type); + _function.remove(type); + _function.put(type, new CastleFunction(type, lvl, lease, 0, rate, -1, false)); } else { - final int diffLease = lease - _function.get(type).getLease(); - if (diffLease > 0) - { - _function.remove(type); - _function.put(type, new CastleFunction(type, lvl, lease, 0, rate, -1, false)); - } - else - { - _function.get(type).setLease(lease); - _function.get(type).setLvl(lvl); - _function.get(type).dbSave(); - } + _function.get(type).setLease(lease); + _function.get(type).setLvl(lvl); + _function.get(type).dbSave(); } } return true; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Fort.java index 85f48f63da..b12abaa689 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -440,24 +440,23 @@ public final class Fort extends AbstractResidence public void removeOwner(boolean updateDB) { final L2Clan clan = getOwnerClan(); - if (clan == null) + if (clan != null) { - return; - } - for (L2PcInstance member : clan.getOnlineMembers(0)) - { - removeResidentialSkills(member); - member.sendSkillList(); - } - clan.setFortId(0); - clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); - setOwnerClan(null); - setSupplyLvL(0); - saveFortVariables(); - removeAllFunctions(); - if (updateDB) - { - updateOwnerInDB(); + for (L2PcInstance member : clan.getOnlineMembers(0)) + { + removeResidentialSkills(member); + member.sendSkillList(); + } + clan.setFortId(0); + clan.broadcastToOnlineMembers(new PledgeShowInfoUpdate(clan)); + setOwnerClan(null); + setSupplyLvL(0); + saveFortVariables(); + removeAllFunctions(); + if (updateDB) + { + updateOwnerInDB(); + } } } @@ -539,12 +538,11 @@ public final class Fort extends AbstractResidence public void upgradeDoor(int doorId, int hp, int pDef, int mDef) { final L2DoorInstance door = getDoor(doorId); - if (door == null) + if (door != null) { - return; + door.setCurrentHp(door.getMaxHp() + hp); + saveDoorUpgrade(doorId, hp, pDef, mDef); } - door.setCurrentHp(door.getMaxHp() + hp); - saveDoorUpgrade(doorId, hp, pDef, mDef); } // This method loads fort diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/TvTEvent.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/TvTEvent.java index 0fd963dd4d..6dd6658241 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/TvTEvent.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/TvTEvent.java @@ -27,8 +27,8 @@ import com.l2jmobius.Config; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.data.xml.impl.DoorData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.datatables.ItemTable; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.datatables.SpawnTable; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.instancemanager.AntiFeedManager; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java index 6eeec37ea7..6dbdbe82e8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java @@ -45,7 +45,7 @@ public final class InstanceReenterTimeHolder _minute = minute; } - public final Long getTime() + public final long getTime() { return _time; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/holders/SkillHolder.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/holders/SkillHolder.java index 044fbc3849..c3d14b00eb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/holders/SkillHolder.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/holders/SkillHolder.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.model.holders; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.skills.Skill; /** @@ -45,7 +45,7 @@ public class SkillHolder return _skillId; } - public final int getSkillLvl() + public final int getSkillLevel() { return _skillLvl; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/AuctionDateGenerator.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/AuctionDateGenerator.java index 205e4cfe1f..f8105c7a6c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/AuctionDateGenerator.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/AuctionDateGenerator.java @@ -72,7 +72,7 @@ public final class AuctionDateGenerator return calcDestTime(_calendar.getTimeInMillis(), date, TimeUnit.MILLISECONDS.convert(_interval, TimeUnit.DAYS)); } - private final long calcDestTime(long time, long date, long add) + private long calcDestTime(long time, long date, long add) { if (time < date) { @@ -85,7 +85,7 @@ public final class AuctionDateGenerator return time; } - private final void checkDayOfWeek(int defaultValue) + private void checkDayOfWeek(int defaultValue) { if ((_day_of_week < 1) || (_day_of_week > 7)) { @@ -101,7 +101,7 @@ public final class AuctionDateGenerator } } - private final void checkHourOfDay(int defaultValue) + private void checkHourOfDay(int defaultValue) { if ((_hour_of_day < 0) || (_hour_of_day > 23)) { @@ -113,7 +113,7 @@ public final class AuctionDateGenerator } } - private final void checkMinuteOfHour(int defaultValue) + private void checkMinuteOfHour(int defaultValue) { if ((_minute_of_hour < 0) || (_minute_of_hour > 59)) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/ArmorType.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/ArmorType.java index 144d68d69b..efa050c9c3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/ArmorType.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/ArmorType.java @@ -35,7 +35,7 @@ public enum ArmorType implements ItemType /** * Constructor of the ArmorType. */ - private ArmorType() + ArmorType() { _mask = 1 << (ordinal() + WeaponType.values().length); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/CrystalType.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/CrystalType.java index 708ea637b8..e14132653a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/CrystalType.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/CrystalType.java @@ -36,7 +36,7 @@ public enum CrystalType private final int _crystalEnchantBonusArmor; private final int _crystalEnchantBonusWeapon; - private CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) + CrystalType(int id, int crystalId, int crystalEnchantBonusArmor, int crystalEnchantBonusWeapon) { _id = id; _crystalId = crystalId; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/WeaponType.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/WeaponType.java index fc51678cff..73e6be2d1d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/WeaponType.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/type/WeaponType.java @@ -49,7 +49,7 @@ public enum WeaponType implements ItemType * Constructor of the L2WeaponType. * @param traitType */ - private WeaponType(TraitType traitType) + WeaponType(TraitType traitType) { _mask = 1 << ordinal(); _traitType = traitType; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java index 324e0ff9fe..98d8e21248 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java @@ -65,7 +65,7 @@ import com.l2jmobius.gameserver.model.olympiad.Participant; import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.model.zone.L2ZoneType; import com.l2jmobius.gameserver.network.serverpackets.ActionFailed; -import com.l2jmobius.gameserver.network.serverpackets.ExNpcQuestHtmlMessage; +import com.l2jmobius.gameserver.network.serverpackets.NpcQuestHtmlMessage; import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jmobius.gameserver.scripting.ScriptEngineManager; @@ -2295,7 +2295,7 @@ public class Quest extends AbstractScript implements IIdentifiable * The lucky member is chosen by standard loot roll rules -
    * each member rolls a random number, the one with the highest roll wins. * @param player the player whose party to check - * @param npc the NPC used for distance and other checks (if {@link #checkPartyMember(L2PcInstance, L2Npc)} is overridden) + * @param npc the NPC used for distance and other checks (if {@link #checkPartyMember(L2PcInstance, L2Npc)} is overriden) * @return the random party member or {@code null} */ public L2PcInstance getRandomPartyMember(L2PcInstance player, L2Npc npc) @@ -2333,7 +2333,7 @@ public class Quest extends AbstractScript implements IIdentifiable /** * This method is called for every party member in {@link #getRandomPartyMember(L2PcInstance, L2Npc)}.
    - * It is intended to be overridden by the specific quest implementations. + * It is intended to be overriden by the specific quest implementations. * @param player the player to check * @param npc the NPC that was passed to {@link #getRandomPartyMember(L2PcInstance, L2Npc)} * @return {@code true} if this party member passes the check, {@code false} otherwise @@ -2410,7 +2410,7 @@ public class Quest extends AbstractScript implements IIdentifiable /** * This method is called for every party member in {@link #getRandomPartyMemberState(L2PcInstance, int, int, L2Npc)} if/after all the standard checks are passed.
    - * It is intended to be overridden by the specific quest implementations.
    + * It is intended to be overriden by the specific quest implementations.
    * It can be used in cases when there are more checks performed than simply a quest condition check,
    * for example, if an item is required in the player's inventory. * @param qs the {@link QuestState} object of the party member @@ -2460,7 +2460,7 @@ public class Quest extends AbstractScript implements IIdentifiable if (questwindow && (questId > 0) && (questId < 20000) && (questId != 999)) { - final ExNpcQuestHtmlMessage npcReply = new ExNpcQuestHtmlMessage(npc != null ? npc.getObjectId() : 0, questId); + final NpcQuestHtmlMessage npcReply = new NpcQuestHtmlMessage(npc != null ? npc.getObjectId() : 0, questId); npcReply.setHtml(content); npcReply.replace("%playername%", player.getName()); player.sendPacket(npcReply); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/BuffTimeTask.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/BuffTimeTask.java index 135547768b..279bf9b14d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/BuffTimeTask.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/BuffTimeTask.java @@ -48,7 +48,7 @@ public class BuffTimeTask implements Runnable @Override public void run() { - if (_time.incrementAndGet() > _info.getAbnormalTime()) + if ((_info.getEffected() != null) && (_time.incrementAndGet() > _info.getAbnormalTime())) { _info.getEffected().getEffectList().stopSkillEffects(false, _info.getSkill().getId()); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/CommonSkill.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/CommonSkill.java index 47c635877f..a9fbfc6471 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/CommonSkill.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/CommonSkill.java @@ -52,7 +52,7 @@ public enum CommonSkill private final SkillHolder _holder; - private CommonSkill(int id, int level) + CommonSkill(int id, int level) { _holder = new SkillHolder(id, level); } @@ -64,7 +64,7 @@ public enum CommonSkill public int getLevel() { - return _holder.getSkillLvl(); + return _holder.getSkillLevel(); } public Skill getSkill() diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/Skill.java index b4842098f2..3ad1e615da 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/Skill.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/Skill.java @@ -29,8 +29,8 @@ import java.util.logging.Logger; import com.l2jmobius.Config; import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.MountType; import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.geoengine.GeoEngine; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java index dc51ec92f1..971b0d0403 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java @@ -22,7 +22,7 @@ import java.util.concurrent.ScheduledFuture; import java.util.logging.Logger; import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.ShotType; import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.model.L2Object; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/stats/Formulas.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/stats/Formulas.java index c10c685444..2f8e2a3921 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/stats/Formulas.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/stats/Formulas.java @@ -896,7 +896,7 @@ public final class Formulas else { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RESISTED_YOUR_S2); - sm.addCharName(target); + sm.addString(target.getName()); sm.addSkillName(skill); attacker.sendPacket(sm); damage = 1; @@ -906,7 +906,7 @@ public final class Formulas if (target.isPlayer()) { final SystemMessage sm = (skill.hasEffectType(L2EffectType.HP_DRAIN)) ? SystemMessage.getSystemMessage(SystemMessageId.YOU_RESISTED_C1_S_DRAIN) : SystemMessage.getSystemMessage(SystemMessageId.YOU_RESISTED_C1_S_MAGIC); - sm.addCharName(attacker); + sm.addString(attacker.getName()); target.sendPacket(sm); } } @@ -989,7 +989,7 @@ public final class Formulas else { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RESISTED_YOUR_S2); - sm.addCharName(target); + sm.addString(target.getName()); sm.addSkillName(skill); owner.sendPacket(sm); damage = 1; @@ -1000,13 +1000,13 @@ public final class Formulas if (skill.hasEffectType(L2EffectType.HP_DRAIN)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_RESISTED_C1_S_DRAIN); - sm.addCharName(owner); + sm.addString(owner.getName()); target.sendPacket(sm); } else { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_RESISTED_C1_S_MAGIC); - sm.addCharName(owner); + sm.addString(owner.getName()); target.sendPacket(sm); } } @@ -1304,7 +1304,7 @@ public final class Formulas if (skill.isDebuff() && (target.calcStat(Stats.DEBUFF_IMMUNITY, 0, attacker, skill) > 0)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RESISTED_YOUR_S2); - sm.addCharName(target); + sm.addString(target.getName()); sm.addSkillName(skill); attacker.sendPacket(sm); return false; @@ -1382,7 +1382,7 @@ public final class Formulas if (finalRate <= Rnd.get(100)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RESISTED_YOUR_S2); - sm.addCharName(target); + sm.addString(target.getName()); sm.addSkillName(skill); attacker.sendPacket(sm); return false; @@ -1522,8 +1522,8 @@ public final class Formulas if (attacker.isPlayer()) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.DAMAGE_IS_DECREASED_BECAUSE_C1_RESISTED_C2_S_MAGIC); - sm.addCharName(target); - sm.addCharName(attacker); + sm.addString(target.getName()); + sm.addString(attacker.getName()); attacker.sendPacket(sm); damage /= 2; } @@ -1531,8 +1531,8 @@ public final class Formulas if (target.isPlayer()) { final SystemMessage sm2 = SystemMessage.getSystemMessage(SystemMessageId.C1_WEAKLY_RESISTED_C2_S_MAGIC); - sm2.addCharName(target); - sm2.addCharName(attacker); + sm2.addString(target.getName()); + sm2.addString(attacker.getName()); target.sendPacket(sm2); } } @@ -1818,13 +1818,13 @@ public final class Formulas if (target.isPlayer()) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_COUNTERED_C1_S_ATTACK); - sm.addCharName(attacker); + sm.addString(attacker.getName()); target.sendPacket(sm); } if (attacker.isPlayer()) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_PERFORMING_A_COUNTERATTACK); - sm.addCharName(target); + sm.addString(target.getName()); attacker.sendPacket(sm); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/L2ZoneForm.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/L2ZoneForm.java index 2e9cc3b5c7..3f7ceffd3e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/L2ZoneForm.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/L2ZoneForm.java @@ -18,6 +18,7 @@ package com.l2jmobius.gameserver.model.zone; import com.l2jmobius.gameserver.idfactory.IdFactory; import com.l2jmobius.gameserver.instancemanager.ZoneManager; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; /** @@ -55,5 +56,5 @@ public abstract class L2ZoneForm ZoneManager.getInstance().getDebugItems().add(item); } - public abstract int[] getRandomPoint(); + public abstract Location getRandomPoint(); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java index ab39a95652..ae15645108 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java @@ -20,6 +20,7 @@ import java.awt.Rectangle; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.geoengine.GeoEngine; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.zone.L2ZoneForm; @@ -125,16 +126,11 @@ public class ZoneCuboid extends L2ZoneForm } @Override - public int[] getRandomPoint() + public Location getRandomPoint() { final int x = Rnd.get(_r.x, _r.x + _r.width); final int y = Rnd.get(_r.y, _r.y + _r.height); - return new int[] - { - x, - y, - GeoEngine.getInstance().getHeight(x, y, _z1) - }; + return new Location(x, y, GeoEngine.getInstance().getHeight(x, y, _z1)); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java index c8257df4cb..75b9214666 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java @@ -18,6 +18,7 @@ package com.l2jmobius.gameserver.model.zone.form; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.geoengine.GeoEngine; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.zone.L2ZoneForm; @@ -48,13 +49,55 @@ public class ZoneCylinder extends L2ZoneForm @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return ((_x > ax1) && (_x < ax2) && (_y > ay1) && (_y < ay2)) || // - ((Math.pow(ax1 - _x, 2) + Math.pow(ay1 - _y, 2)) < _radS) || // - ((Math.pow(ax1 - _x, 2) + Math.pow(ay2 - _y, 2)) < _radS) || // - ((Math.pow(ax2 - _x, 2) + Math.pow(ay1 - _y, 2)) < _radS) || // - ((Math.pow(ax2 - _x, 2) + Math.pow(ay2 - _y, 2)) < _radS) || // - ((_x > ax1) && (_x < ax2) && ((Math.abs(_y - ay2) < _rad) || (Math.abs(_y - ay1) < _rad))) || // - ((_y > ay1) && (_y < ay2) && ((Math.abs(_x - ax2) < _rad) || (Math.abs(_x - ax1) < _rad))); + // Circles point inside the rectangle? + if ((_x > ax1) && (_x < ax2) && (_y > ay1) && (_y < ay2)) + { + return true; + } + + // Any point of the rectangle intersecting the Circle? + if ((Math.pow(ax1 - _x, 2) + Math.pow(ay1 - _y, 2)) < _radS) + { + return true; + } + if ((Math.pow(ax1 - _x, 2) + Math.pow(ay2 - _y, 2)) < _radS) + { + return true; + } + if ((Math.pow(ax2 - _x, 2) + Math.pow(ay1 - _y, 2)) < _radS) + { + return true; + } + if ((Math.pow(ax2 - _x, 2) + Math.pow(ay2 - _y, 2)) < _radS) + { + return true; + } + + // Collision on any side of the rectangle? + if ((_x > ax1) && (_x < ax2)) + { + if (Math.abs(_y - ay2) < _rad) + { + return true; + } + if (Math.abs(_y - ay1) < _rad) + { + return true; + } + } + if ((_y > ay1) && (_y < ay2)) + { + if (Math.abs(_x - ax2) < _rad) + { + return true; + } + if (Math.abs(_x - ax1) < _rad) + { + return true; + } + } + + return false; } @Override @@ -88,20 +131,15 @@ public class ZoneCylinder extends L2ZoneForm } @Override - public int[] getRandomPoint() + public Location getRandomPoint() { - double x, y; - final double q = Rnd.get() * 2 * Math.PI; - final double r = Math.sqrt(Rnd.get()); + int x, y, q, r; - x = (_rad * r * Math.cos(q)) + _x; - y = (_rad * r * Math.sin(q)) + _y; + q = (int) (Rnd.get() * 2 * Math.PI); + r = (int) Math.sqrt(Rnd.get()); + x = (int) ((_rad * r * Math.cos(q)) + _x); + y = (int) ((_rad * r * Math.sin(q)) + _y); - return new int[] - { - (int) x, - (int) y, - GeoEngine.getInstance().getHeight((int) x, (int) y, _z1) - }; + return new Location(x, y, GeoEngine.getInstance().getHeight(x, y, _z1)); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java index 3afd22e684..3098fbe0ca 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java @@ -20,6 +20,7 @@ import java.awt.Polygon; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.geoengine.GeoEngine; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.itemcontainer.Inventory; import com.l2jmobius.gameserver.model.zone.L2ZoneForm; @@ -108,7 +109,7 @@ public class ZoneNPoly extends L2ZoneForm } @Override - public int[] getRandomPoint() + public Location getRandomPoint() { int x, y; @@ -127,12 +128,7 @@ public class ZoneNPoly extends L2ZoneForm y = Rnd.get(_minY, _maxY); } - return new int[] - { - x, - y, - GeoEngine.getInstance().getHeight(x, y, _z1) - }; + return new Location(x, y, GeoEngine.getInstance().getHeight(x, y, _z1)); } public int[] getX() diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2ConditionZone.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2ConditionZone.java index de42092e4e..16b5ea1741 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2ConditionZone.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2ConditionZone.java @@ -53,34 +53,32 @@ public class L2ConditionZone extends L2ZoneType @Override protected void onEnter(L2Character character) { - if (!character.isPlayer()) + if (character.isPlayer()) { - return; - } - if (NO_BOOKMARK) - { - character.setInsideZone(ZoneId.NO_BOOKMARK, true); - } - if (NO_ITEM_DROP) - { - character.setInsideZone(ZoneId.NO_ITEM_DROP, true); + if (NO_BOOKMARK) + { + character.setInsideZone(ZoneId.NO_BOOKMARK, true); + } + if (NO_ITEM_DROP) + { + character.setInsideZone(ZoneId.NO_ITEM_DROP, true); + } } } @Override protected void onExit(L2Character character) { - if (!character.isPlayer()) + if (character.isPlayer()) { - return; - } - if (NO_BOOKMARK) - { - character.setInsideZone(ZoneId.NO_BOOKMARK, false); - } - if (NO_ITEM_DROP) - { - character.setInsideZone(ZoneId.NO_ITEM_DROP, false); + if (NO_BOOKMARK) + { + character.setInsideZone(ZoneId.NO_BOOKMARK, false); + } + if (NO_ITEM_DROP) + { + character.setInsideZone(ZoneId.NO_ITEM_DROP, false); + } } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2EffectZone.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2EffectZone.java index 5fc5a34037..9e28a8a4ee 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2EffectZone.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2EffectZone.java @@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap; import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.util.Rnd; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.actor.L2Character; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2JailZone.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2JailZone.java index f68a48f158..531e2ba802 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2JailZone.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2JailZone.java @@ -43,47 +43,47 @@ public class L2JailZone extends L2ZoneType @Override protected void onEnter(L2Character character) { - if (!character.isPlayer()) + if (character.isPlayer()) { - return; - } - character.setInsideZone(ZoneId.JAIL, true); - character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true); - if (Config.JAIL_IS_PVP) - { - character.setInsideZone(ZoneId.PVP, true); - character.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE); - } - if (Config.JAIL_DISABLE_TRANSACTION) - { - character.setInsideZone(ZoneId.NO_STORE, true); + character.setInsideZone(ZoneId.JAIL, true); + character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true); + if (Config.JAIL_IS_PVP) + { + character.setInsideZone(ZoneId.PVP, true); + character.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_A_COMBAT_ZONE); + } + if (Config.JAIL_DISABLE_TRANSACTION) + { + character.setInsideZone(ZoneId.NO_STORE, true); + } } } @Override protected void onExit(L2Character character) { - if (!character.isPlayer()) + if (character.isPlayer()) { - return; - } - final L2PcInstance player = character.getActingPlayer(); - player.setInsideZone(ZoneId.JAIL, false); - player.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false); - if (Config.JAIL_IS_PVP) - { - character.setInsideZone(ZoneId.PVP, false); - character.sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE); - } - if (player.isJailed()) - { - // when a player wants to exit jail even if he is still jailed, teleport him back to jail - ThreadPool.schedule(new TeleportTask(player, JAIL_IN_LOC), 2000); - character.sendMessage("You cannot cheat your way out of here. You must wait until your jail time is over."); - } - if (Config.JAIL_DISABLE_TRANSACTION) - { - character.setInsideZone(ZoneId.NO_STORE, false); + final L2PcInstance player = character.getActingPlayer(); + player.setInsideZone(ZoneId.JAIL, false); + player.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false); + + if (Config.JAIL_IS_PVP) + { + character.setInsideZone(ZoneId.PVP, false); + character.sendPacket(SystemMessageId.YOU_HAVE_LEFT_A_COMBAT_ZONE); + } + + if (player.isJailed()) + { + // when a player wants to exit jail even if he is still jailed, teleport him back to jail + ThreadPool.schedule(new TeleportTask(player, JAIL_IN_LOC), 2000); + character.sendMessage("You cannot cheat your way out of here. You must wait until your jail time is over."); + } + if (Config.JAIL_DISABLE_TRANSACTION) + { + character.setInsideZone(ZoneId.NO_STORE, false); + } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2MotherTreeZone.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2MotherTreeZone.java index 9b4de1cf69..3f34b03231 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2MotherTreeZone.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2MotherTreeZone.java @@ -66,30 +66,28 @@ public class L2MotherTreeZone extends L2ZoneType @Override protected void onEnter(L2Character character) { - if (!character.isPlayer()) + if (character.isPlayer()) { - return; - } - final L2PcInstance player = character.getActingPlayer(); - character.setInsideZone(ZoneId.MOTHER_TREE, true); - if (_enterMsg != 0) - { - player.sendPacket(SystemMessage.getSystemMessage(_enterMsg)); + final L2PcInstance player = character.getActingPlayer(); + character.setInsideZone(ZoneId.MOTHER_TREE, true); + if (_enterMsg != 0) + { + player.sendPacket(SystemMessage.getSystemMessage(_enterMsg)); + } } } @Override protected void onExit(L2Character character) { - if (!character.isPlayer()) + if (character.isPlayer()) { - return; - } - final L2PcInstance player = character.getActingPlayer(); - player.setInsideZone(ZoneId.MOTHER_TREE, false); - if (_leaveMsg != 0) - { - player.sendPacket(SystemMessage.getSystemMessage(_leaveMsg)); + final L2PcInstance player = character.getActingPlayer(); + player.setInsideZone(ZoneId.MOTHER_TREE, false); + if (_leaveMsg != 0) + { + player.sendPacket(SystemMessage.getSystemMessage(_leaveMsg)); + } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java index b830a0ca76..5dd96a50fb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.model.zone.type; import com.l2jmobius.Config; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.enums.MountType; import com.l2jmobius.gameserver.instancemanager.CHSiegeManager; import com.l2jmobius.gameserver.instancemanager.FortManager; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/NpcSpawnTerritory.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/NpcSpawnTerritory.java index 551dc9a977..6ef745eb9d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/NpcSpawnTerritory.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/NpcSpawnTerritory.java @@ -18,6 +18,7 @@ package com.l2jmobius.gameserver.model.zone.type; import java.util.List; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.zone.L2ZoneForm; /** @@ -42,7 +43,7 @@ public class NpcSpawnTerritory return _name; } - public int[] getRandomPoint() + public Location getRandomPoint() { return _territory.getRandomPoint(); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java index b68af7e434..5c7d769f71 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/CharacterCreate.java @@ -30,8 +30,8 @@ import com.l2jmobius.gameserver.data.sql.impl.CharNameTable; import com.l2jmobius.gameserver.data.xml.impl.InitialEquipmentData; import com.l2jmobius.gameserver.data.xml.impl.InitialShortcutData; import com.l2jmobius.gameserver.data.xml.impl.PlayerTemplateData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.instancemanager.QuestManager; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.L2World; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java index bbccdcedcf..b40eeba07a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkill.java @@ -20,8 +20,8 @@ import java.util.List; import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.instancemanager.QuestManager; import com.l2jmobius.gameserver.model.ClanPrivilege; @@ -454,7 +454,7 @@ public final class RequestAcquireSkill implements IClientIncomingPacket { for (SkillHolder skill : s.getPreReqSkills()) { - if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLvl()) + if (player.getSkillLevel(skill.getSkillId()) != skill.getSkillLevel()) { if (skill.getSkillId() == CommonSkill.ONYX_BEAST_TRANSFORMATION.getId()) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkillInfo.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkillInfo.java index 2a0a5aa639..62270e35aa 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkillInfo.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAcquireSkillInfo.java @@ -17,8 +17,8 @@ package com.l2jmobius.gameserver.network.clientpackets; import com.l2jmobius.commons.network.PacketReader; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.data.xml.impl.SkillTreesData; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.model.ClanPrivilege; import com.l2jmobius.gameserver.model.L2SkillLearn; import com.l2jmobius.gameserver.model.actor.L2Npc; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestActionUse.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestActionUse.java index cc70a24b2f..4ab6275fa0 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestActionUse.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestActionUse.java @@ -27,8 +27,8 @@ import com.l2jmobius.gameserver.ai.L2SummonAI; import com.l2jmobius.gameserver.ai.NextAction; import com.l2jmobius.gameserver.data.xml.impl.PetDataTable; import com.l2jmobius.gameserver.data.xml.impl.PetSkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.datatables.BotReportTable; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.MountType; import com.l2jmobius.gameserver.enums.PrivateStoreType; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java index 7bac5f5f7c..d0de180958 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java @@ -58,7 +58,7 @@ public final class RequestAnswerFriendInvite implements IClientIncomingPacket || requestor.getFriendList().contains(player.getObjectId())) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THIS_PLAYER_IS_ALREADY_REGISTERED_ON_YOUR_FRIENDS_LIST); - sm.addCharName(player); + sm.addString(player.getName()); requestor.sendPacket(sm); return; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestCancelPostAttachment.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestCancelPostAttachment.java index 6162d1168d..5790e2495a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestCancelPostAttachment.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestCancelPostAttachment.java @@ -217,7 +217,7 @@ public final class RequestCancelPostAttachment implements IClientIncomingPacket if (receiver != null) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_CANCELED_THE_SENT_MAIL); - sm.addCharName(activeChar); + sm.addString(activeChar.getName()); receiver.sendPacket(sm); receiver.sendPacket(new ExChangePostState(true, _msgId, Message.DELETED)); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestDispel.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestDispel.java index f808931e0d..c546e7235f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestDispel.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestDispel.java @@ -18,7 +18,7 @@ package com.l2jmobius.gameserver.network.clientpackets; import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.skills.AbnormalType; import com.l2jmobius.gameserver.model.skills.Skill; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java index 0f0c975eb6..5520a8e816 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java @@ -207,7 +207,7 @@ public final class RequestEnchantItem implements IClientIncomingPacket if ((item.getEnchantLevel() == minEnchantAnnounce) || (item.getEnchantLevel() == maxEnchantAnnounce)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_SUCCESSFULLY_ENCHANTED_A_S2_S3); - sm.addCharName(activeChar); + sm.addString(activeChar.getName()); sm.addInt(item.getEnchantLevel()); sm.addItemName(item); activeChar.broadcastPacket(sm); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkill.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkill.java index b452385315..158a0cd691 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkill.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkill.java @@ -24,7 +24,7 @@ import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.data.xml.impl.EnchantSkillGroupsData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.L2EnchantSkillGroup.EnchantSkillHolder; import com.l2jmobius.gameserver.model.L2EnchantSkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillInfo.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillInfo.java index 7840699431..0b50daa638 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillInfo.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillInfo.java @@ -18,7 +18,7 @@ package com.l2jmobius.gameserver.network.clientpackets; import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.gameserver.data.xml.impl.EnchantSkillGroupsData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.network.L2GameClient; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillRouteChange.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillRouteChange.java index cc8cca9008..df9b90fc47 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillRouteChange.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillRouteChange.java @@ -24,7 +24,7 @@ import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.data.xml.impl.EnchantSkillGroupsData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.L2EnchantSkillGroup.EnchantSkillHolder; import com.l2jmobius.gameserver.model.L2EnchantSkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillSafe.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillSafe.java index bea5a647a0..0c6c0ec5b1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillSafe.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillSafe.java @@ -24,7 +24,7 @@ import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.data.xml.impl.EnchantSkillGroupsData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.L2EnchantSkillGroup.EnchantSkillHolder; import com.l2jmobius.gameserver.model.L2EnchantSkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillUntrain.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillUntrain.java index ed80d597ab..3a59cad341 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillUntrain.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExEnchantSkillUntrain.java @@ -23,7 +23,7 @@ import java.util.logging.Logger; import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.gameserver.data.xml.impl.EnchantSkillGroupsData; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.L2EnchantSkillGroup.EnchantSkillHolder; import com.l2jmobius.gameserver.model.L2EnchantSkillLearn; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExMagicSkillUseGround.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExMagicSkillUseGround.java index 3219a12d4c..ceac9e059a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExMagicSkillUseGround.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestExMagicSkillUseGround.java @@ -17,7 +17,7 @@ package com.l2jmobius.gameserver.network.clientpackets; import com.l2jmobius.commons.network.PacketReader; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.skills.Skill; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendInvite.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendInvite.java index fcc569bd42..a3348db351 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendInvite.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendInvite.java @@ -76,7 +76,7 @@ public final class RequestFriendInvite implements IClientIncomingPacket if (BlockList.isBlocked(activeChar, friend)) { sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_BLOCKED_C1); - sm.addCharName(friend); + sm.addString(friend.getName()); activeChar.sendPacket(sm); return; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestJoinParty.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestJoinParty.java index 143bbc176a..00253dac1d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestJoinParty.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestJoinParty.java @@ -78,7 +78,7 @@ public final class RequestJoinParty implements IClientIncomingPacket if (target.isPartyBanned()) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_BEEN_REPORTED_AS_AN_ILLEGAL_PROGRAM_USER_AND_CANNOT_JOIN_A_PARTY); - sm.addCharName(target); + sm.addString(target.getName()); requestor.sendPacket(sm); return; } @@ -101,7 +101,7 @@ public final class RequestJoinParty implements IClientIncomingPacket if (BlockList.isBlocked(target, requestor)) { sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_PLACED_YOU_ON_HIS_HER_IGNORE_LIST); - sm.addCharName(target); + sm.addString(target.getName()); requestor.sendPacket(sm); return; } @@ -134,7 +134,7 @@ public final class RequestJoinParty implements IClientIncomingPacket } sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_BEEN_INVITED_TO_THE_PARTY); - sm.addCharName(target); + sm.addString(target.getName()); requestor.sendPacket(sm); if (!requestor.isInParty()) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPartyMatchDetail.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPartyMatchDetail.java index dadfcdd812..49456992d2 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPartyMatchDetail.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPartyMatchDetail.java @@ -88,7 +88,7 @@ public final class RequestPartyMatchDetail implements IClientIncomingPacket _member.sendPacket(new ExManagePartyRoomMember(_activeChar, _room, 0)); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ENTERED_THE_PARTY_ROOM); - sm.addCharName(_activeChar); + sm.addString(_activeChar.getName()); _member.sendPacket(sm); } _room.addMember(_activeChar); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPostAttachment.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPostAttachment.java index e1fc2cf3ad..a6d6f461b3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPostAttachment.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPostAttachment.java @@ -251,7 +251,7 @@ public final class RequestPostAttachment implements IClientIncomingPacket sender.addAdena("PayMail", adena, activeChar, false); sm = SystemMessage.getSystemMessage(SystemMessageId.S2_HAS_MADE_A_PAYMENT_OF_S1_ADENA_PER_YOUR_PAYMENT_REQUEST_MAIL); sm.addLong(adena); - sm.addCharName(activeChar); + sm.addString(activeChar.getName()); sender.sendPacket(sm); } else @@ -266,7 +266,7 @@ public final class RequestPostAttachment implements IClientIncomingPacket else if (sender != null) { sm = SystemMessage.getSystemMessage(SystemMessageId.S1_ACQUIRED_THE_ATTACHED_ITEM_TO_YOUR_MAIL); - sm.addCharName(activeChar); + sm.addString(activeChar.getName()); sender.sendPacket(sm); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestRejectPostAttachment.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestRejectPostAttachment.java index dd49b8a8d9..1800904889 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestRejectPostAttachment.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestRejectPostAttachment.java @@ -94,7 +94,7 @@ public final class RequestRejectPostAttachment implements IClientIncomingPacket if (sender != null) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_RETURNED_THE_MAIL); - sm.addCharName(activeChar); + sm.addString(activeChar.getName()); sender.sendPacket(sm); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/TradeRequest.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/TradeRequest.java index 45dadd5291..67a996d980 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/TradeRequest.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/TradeRequest.java @@ -115,7 +115,7 @@ public final class TradeRequest implements IClientIncomingPacket if (!effect.checkCondition(BotReportTable.TRADE_ACTION_BLOCK_ID)) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_BEEN_REPORTED_AS_AN_ILLEGAL_PROGRAM_USER_AND_IS_CURRENTLY_BEING_INVESTIGATED); - sm.addCharName(partner); + sm.addString(partner.getName()); player.sendPacket(sm); player.sendPacket(ActionFailed.STATIC_PACKET); return; @@ -172,7 +172,7 @@ public final class TradeRequest implements IClientIncomingPacket if (BlockList.isBlocked(partner, player)) { sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_PLACED_YOU_ON_HIS_HER_IGNORE_LIST); - sm.addCharName(partner); + sm.addString(partner.getName()); player.sendPacket(sm); return; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/AbstractMessagePacket.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/AbstractMessagePacket.java index 3fbfbd6713..f84efa2d4e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/AbstractMessagePacket.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/AbstractMessagePacket.java @@ -24,13 +24,12 @@ import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketWriter; import com.l2jmobius.gameserver.data.xml.impl.DoorData; import com.l2jmobius.gameserver.data.xml.impl.NpcData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.datatables.ItemTable; -import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.instancemanager.CastleManager; import com.l2jmobius.gameserver.instancemanager.InstanceManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.model.Elementals; -import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance; @@ -193,38 +192,6 @@ public abstract class AbstractMessagePacket> return (T) this; } - public final T addCharName(L2Character cha) - { - if (cha.isNpc()) - { - final L2Npc npc = (L2Npc) cha; - if (npc.getTemplate().isUsingServerSideName()) - { - return addString(npc.getTemplate().getName()); - } - return addNpcName(npc); - } - else if (cha.isPlayer()) - { - return addPcName(cha.getActingPlayer()); - } - else if (cha.isSummon()) - { - final L2Summon summon = (L2Summon) cha; - if (summon.getTemplate().isUsingServerSideName()) - { - return addString(summon.getTemplate().getName()); - } - return addNpcName(summon); - } - else if (cha.isDoor()) - { - final L2DoorInstance door = (L2DoorInstance) cha; - return addDoorName(door.getId()); - } - return addString(cha.getName()); - } - public final T addPcName(L2PcInstance pc) { append(new SMParam(TYPE_PLAYER_NAME, pc.getAppearance().getVisibleName())); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExShowContactList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExShowContactList.java index f385e05fba..dcdcf9b4a9 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExShowContactList.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExShowContactList.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.network.serverpackets; -import java.util.List; +import java.util.Set; import com.l2jmobius.commons.network.PacketWriter; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -27,7 +27,7 @@ import com.l2jmobius.gameserver.network.OutgoingPackets; */ public class ExShowContactList implements IClientOutgoingPacket { - private final List _contacts; + private final Set _contacts; public ExShowContactList(L2PcInstance player) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/GMViewSkillInfo.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/GMViewSkillInfo.java index ebb7450461..fd99f86ab2 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/GMViewSkillInfo.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/GMViewSkillInfo.java @@ -20,7 +20,7 @@ package com.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.datatables.SkillData; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.skills.Skill; import com.l2jmobius.gameserver.network.OutgoingPackets; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExNpcQuestHtmlMessage.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/NpcQuestHtmlMessage.java similarity index 88% rename from L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExNpcQuestHtmlMessage.java rename to L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/NpcQuestHtmlMessage.java index acd58281c4..c1c673b27d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExNpcQuestHtmlMessage.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/NpcQuestHtmlMessage.java @@ -24,11 +24,11 @@ import com.l2jmobius.gameserver.network.OutgoingPackets; * NpcQuestHtmlMessage server packet implementation. * @author HorridoJoho */ -public final class ExNpcQuestHtmlMessage extends AbstractHtmlPacket +public final class NpcQuestHtmlMessage extends AbstractHtmlPacket { private final int _questId; - public ExNpcQuestHtmlMessage(int npcObjId, int questId) + public NpcQuestHtmlMessage(int npcObjId, int questId) { super(npcObjId); _questId = questId; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/PrivateStoreListBuy.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/PrivateStoreListBuy.java index 8549b0e9ce..830f953f45 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/PrivateStoreListBuy.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/PrivateStoreListBuy.java @@ -16,7 +16,7 @@ */ package com.l2jmobius.gameserver.network.serverpackets; -import java.util.List; +import java.util.Collection; import com.l2jmobius.commons.network.PacketWriter; import com.l2jmobius.gameserver.model.TradeItem; @@ -27,7 +27,7 @@ public class PrivateStoreListBuy extends AbstractItemPacket { private final int _objId; private final long _playerAdena; - private final List _items; + private final Collection _items; public PrivateStoreListBuy(L2PcInstance player, L2PcInstance storePlayer) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/Task.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/Task.java index 5e62a96f85..59274905e6 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/Task.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/Task.java @@ -26,7 +26,7 @@ import com.l2jmobius.gameserver.taskmanager.TaskManager.ExecutedTask; */ public abstract class Task { - protected final Logger _log = Logger.getLogger(getClass().getName()); + protected final Logger LOGGER = Logger.getLogger(getClass().getName()); public void initializate() { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java index c5b89e566c..0c3b2420b9 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java @@ -55,7 +55,7 @@ import com.l2jmobius.gameserver.taskmanager.tasks.TaskShutdown; */ public final class TaskManager { - protected static final Logger _log = Logger.getLogger(TaskManager.class.getName()); + protected static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName()); private final Map _tasks = new ConcurrentHashMap<>(); protected final List _currentTasks = new CopyOnWriteArrayList<>(); @@ -72,7 +72,7 @@ public final class TaskManager { initializate(); startAllTasks(); - _log.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _tasks.size() + " Tasks"); + LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _tasks.size() + " Tasks."); } public class ExecutedTask implements Runnable @@ -112,7 +112,7 @@ public final class TaskManager } catch (SQLException e) { - _log.log(Level.WARNING, getClass().getSimpleName() + ": Cannot updated the Global Task " + id + ": " + e.getMessage(), e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Cannot updated the Global Task " + id + ": " + e.getMessage(), e); } if ((type == TYPE_SHEDULED) || (type == TYPE_TIME)) @@ -223,7 +223,7 @@ public final class TaskManager } catch (Exception e) { - _log.log(Level.SEVERE, getClass().getSimpleName() + ": Error while loading Global Task table: " + e.getMessage(), e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error while loading Global Task table: " + e.getMessage(), e); } } @@ -262,7 +262,7 @@ public final class TaskManager task.scheduled = ThreadPool.schedule(task, diff); return true; } - _log.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted."); + LOGGER.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted."); } catch (Exception e) { @@ -286,7 +286,7 @@ public final class TaskManager if (hour.length != 3) { - _log.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters"); + LOGGER.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters"); return false; } @@ -302,7 +302,7 @@ public final class TaskManager } catch (Exception e) { - _log.log(Level.WARNING, getClass().getSimpleName() + ": Bad parameter on task " + task.getId() + ": " + e.getMessage(), e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Bad parameter on task " + task.getId() + ": " + e.getMessage(), e); return false; } @@ -354,7 +354,7 @@ public final class TaskManager } catch (SQLException e) { - _log.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the unique task: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the unique task: " + e.getMessage(), e); } return false; } @@ -380,7 +380,7 @@ public final class TaskManager } catch (SQLException e) { - _log.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the task: " + e.getMessage(), e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the task: " + e.getMessage(), e); } return false; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java index ed51fb4f39..c3d464dc47 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java @@ -50,7 +50,7 @@ public class TaskBirthday extends Task @Override public void onTimeElapsed(ExecutedTask task) { - _log.info("BirthdayManager: " + giveBirthdayGifts(task.getLastActivation()) + " gifts sent."); + LOGGER.info("BirthdayManager: " + giveBirthdayGifts(task.getLastActivation()) + " gifts sent."); } private int giveBirthdayGifts(long lastActivation) @@ -74,7 +74,7 @@ public class TaskBirthday extends Task } catch (SQLException e) { - _log.warning("Error checking birthdays: " + e.getMessage()); + LOGGER.warning("Error checking birthdays: " + e.getMessage()); } return birthdayGiftCount; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskClanLeaderApply.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskClanLeaderApply.java index c3f47b629b..7e0a05ae9c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskClanLeaderApply.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskClanLeaderApply.java @@ -61,7 +61,7 @@ public class TaskClanLeaderApply extends Task clan.setNewLeader(member); } } - _log.info(getClass().getSimpleName() + ": launched."); + LOGGER.info(getClass().getSimpleName() + ": launched."); } @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskDailySkillReuseClean.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskDailySkillReuseClean.java index a88091e7ea..ad20f81bcb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskDailySkillReuseClean.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskDailySkillReuseClean.java @@ -57,9 +57,9 @@ public class TaskDailySkillReuseClean extends Task } catch (Exception e) { - _log.severe(getClass().getSimpleName() + ": Could not reset daily skill reuse: " + e); + LOGGER.severe(getClass().getSimpleName() + ": Could not reset daily skill reuse: " + e); } - _log.info("Daily skill reuse cleaned."); + LOGGER.info("Daily skill reuse cleaned."); } @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskNevit.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskNevit.java index 41d74fe0a7..c11f4beea2 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskNevit.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskNevit.java @@ -50,7 +50,7 @@ public class TaskNevit extends Task player.getVariables().set("hunting_time", 0); player.sendPacket(new ExNevitAdventTimeChange(0, true)); } - _log.info("Nevit system reseted."); + LOGGER.info("Nevit system reseted."); } @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskOlympiadSave.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskOlympiadSave.java index cf999aa9df..114a2281da 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskOlympiadSave.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskOlympiadSave.java @@ -42,7 +42,7 @@ public class TaskOlympiadSave extends Task if (Olympiad.getInstance().inCompPeriod()) { Olympiad.getInstance().saveOlympiadStatus(); - _log.info("Olympiad System: Data updated."); + LOGGER.info("Olympiad System: Data updated."); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRaidPointsReset.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRaidPointsReset.java index 4bf22be509..051bfde1ac 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRaidPointsReset.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRaidPointsReset.java @@ -125,7 +125,7 @@ public class TaskRaidPointsReset extends Task } RaidBossPointsManager.getInstance().cleanUp(); - _log.info("Raid Points Reset Global Task: launched."); + LOGGER.info("Raid Points Reset Global Task: launched."); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java index 3e3cfe73dd..8cde822fa6 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java @@ -61,7 +61,7 @@ public class TaskRecom extends Task } catch (Exception e) { - _log.severe(getClass().getSimpleName() + ": Could not reset Recommendations System: " + e); + LOGGER.severe(getClass().getSimpleName() + ": Could not reset Recommendations System: " + e); } // Refresh reco bonus for online players @@ -73,7 +73,7 @@ public class TaskRecom extends Task player.startNevitHourglassTask(); } } - _log.info("Recommendations System reseted"); + LOGGER.info("Recommendations System reseted"); } @Override diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskSevenSignsUpdate.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskSevenSignsUpdate.java index 27418dbe06..3d70ab96b0 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskSevenSignsUpdate.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskSevenSignsUpdate.java @@ -47,11 +47,11 @@ public class TaskSevenSignsUpdate extends Task { SevenSignsFestival.getInstance().saveFestivalData(false); } - _log.info("SevenSigns: Data updated successfully."); + LOGGER.info("SevenSigns: Data updated successfully."); } catch (Exception e) { - _log.warning(getClass().getSimpleName() + ": SevenSigns: Failed to save Seven Signs configuration: " + e.getMessage()); + LOGGER.warning(getClass().getSimpleName() + ": SevenSigns: Failed to save Seven Signs configuration: " + e.getMessage()); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/HtmlUtil.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/HtmlUtil.java index 391e38d5e7..75bd1795f4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/HtmlUtil.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/HtmlUtil.java @@ -195,7 +195,7 @@ public class HtmlUtil } else { - int tdWidth = (width - 10) / 2; + final int tdWidth = (width - 10) / 2; sb.append(""); sb.append(""); sb.append("
    ", Pattern.DOTALL); private static final Pattern BLOCK_PATTERN = Pattern.compile("(.*?)", Pattern.DOTALL); - private final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); + private static final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); private int _loadedFiles; private long _bytesBuffLen; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java index 6a19cc7d31..3f98953c02 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java @@ -204,14 +204,7 @@ public class Forum public Forum getChildByName(String name) { vload(); - for (Forum f : _children) - { - if (f.getName().equals(name)) - { - return f; - } - } - return null; + return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null); } /** @@ -220,7 +213,6 @@ public class Forum public void rmTopicByID(int id) { _topic.remove(id); - } public void insertIntoDb() diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java index bc05a8ff5c..a4df772cc3 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java @@ -46,9 +46,7 @@ public class ForumsBBSManager extends BaseBBSManager { while (rs.next()) { - final int forumId = rs.getInt("forum_id"); - final Forum f = new Forum(forumId, null); - addForum(f); + addForum(new Forum(rs.getInt("forum_id"), null)); } } catch (Exception e) @@ -62,10 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager */ public void initRoot() { - for (Forum f : _table) - { - f.vload(); - } + _table.forEach(f -> f.vload()); _log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index 188d99945c..7d74ef6eb4 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import com.l2jmobius.gameserver.communitybbs.BB.Forum; import com.l2jmobius.gameserver.communitybbs.BB.Post; -import com.l2jmobius.gameserver.communitybbs.BB.Post.CPost; import com.l2jmobius.gameserver.communitybbs.BB.Topic; import com.l2jmobius.gameserver.handler.CommunityBoardHandler; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -68,21 +67,8 @@ public class PostBBSManager extends BaseBBSManager st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); final int idp = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } - + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind); } else if (command.startsWith("_bbsposts;edit;")) @@ -106,7 +92,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); if ((forum == null) || (topic == null) || (p == null)) { - CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exit !


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exist!


    ", activeChar); } else { @@ -118,7 +104,7 @@ public class PostBBSManager extends BaseBBSManager { if ((forum == null) || (topic == null)) { - CommunityBoardHandler.separateAndSend("

    Error, this forum is not implemented yet


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error: This forum is not implemented yet!
    ", activeChar); } else if (forum.getType() == Forum.MEMO) { @@ -126,7 +112,7 @@ public class PostBBSManager extends BaseBBSManager } else { - CommunityBoardHandler.separateAndSend("

    the forum: " + forum.getName() + " is not implemented yet


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    The forum: " + forum.getName() + " is not implemented yet!
    ", activeChar); } } @@ -139,7 +125,6 @@ public class PostBBSManager extends BaseBBSManager private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum) { - // final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); @@ -176,8 +161,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(t); if (p != null) { - final CPost cp = p.getCPost(idp); - if (cp == null) + if (p.getCPost(idp) == null) { CommunityBoardHandler.separateAndSend("

    the post: " + idp + " does not exist !


    ", activeChar); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index db6e17a2b0..427f456b84 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -60,11 +60,7 @@ public class TopicBBSManager extends BaseBBSManager public int getMaxID(Forum f) { final Integer i = _maxId.get(f); - if (i == null) - { - return 0; - } - return i; + return i == null ? 0 : i; } public Topic getTopicByID(int idf) @@ -146,20 +142,8 @@ public class TopicBBSManager extends BaseBBSManager st.nextToken(); st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf); } else if (command.startsWith("_bbstopics;crea")) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java index d8dc164725..609f0858d5 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java @@ -170,12 +170,7 @@ public class CharNameTable public final int getAccessLevelById(int objectId) { - if (getNameById(objectId) != null) - { - return _accessLevels.get(objectId); - } - - return 0; + return getNameById(objectId) != null ? _accessLevels.get(objectId) : 0; } public synchronized boolean doesCharNameExist(String name) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java index 3f2fe830c7..c6ee79672c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java @@ -67,7 +67,6 @@ import com.l2jmobius.gameserver.util.Util; public class ClanTable { private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName()); - private final Map _clans = new ConcurrentHashMap<>(); protected ClanTable() @@ -444,16 +443,13 @@ public class ClanTable for (L2Clan clan : _clans.values()) { final int allyId = clan.getAllyId(); - if ((allyId != 0) && (clan.getId() != allyId)) + if ((allyId != 0) && (clan.getId() != allyId) && !_clans.containsKey(allyId)) { - if (!_clans.containsKey(allyId)) - { - clan.setAllyId(0); - clan.setAllyName(null); - clan.changeAllyCrest(0, true); - clan.updateClanInDB(); - LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); - } + clan.setAllyId(0); + clan.setAllyName(null); + clan.changeAllyCrest(0, true); + clan.updateClanInDB(); + LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); } } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/EventDroplist.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/EventDroplist.java index c22e5eb0ee..ba8c26bbd8 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/EventDroplist.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/EventDroplist.java @@ -35,7 +35,7 @@ public class EventDroplist /** * The table containing all DataDrop object */ - private static final List _allNpcDateDrops = new CopyOnWriteArrayList<>(); + private static final List ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>(); public static class DateDrop { @@ -74,7 +74,7 @@ public class EventDroplist */ public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); } /** @@ -86,7 +86,7 @@ public class EventDroplist */ public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); } /** @@ -96,7 +96,7 @@ public class EventDroplist */ public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop) { - _allNpcDateDrops.add(new DateDrop(dateRange, eventDrop)); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, eventDrop)); } /** @@ -106,7 +106,7 @@ public class EventDroplist { final List list = new LinkedList<>(); final Date currentDate = new Date(); - for (DateDrop drop : _allNpcDateDrops) + for (DateDrop drop : ALL_NPC_DATE_DROPS) { if (drop._dateRange.isWithinRange(currentDate)) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/engines/DocumentBase.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/engines/DocumentBase.java index 0050c0a281..37410b0b38 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/engines/DocumentBase.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/engines/DocumentBase.java @@ -151,12 +151,11 @@ public abstract class DocumentBase protected final Logger _log = Logger.getLogger(getClass().getName()); private final File _file; - protected Map _tables; + protected final Map _tables = new HashMap<>(); protected DocumentBase(File pFile) { _file = pFile; - _tables = new HashMap<>(); } public Document parse() diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java index 0e3b945cf4..4d3be938c9 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java @@ -79,7 +79,6 @@ public final class DocumentItem extends DocumentBase implements IGameXmlReader { if ("list".equalsIgnoreCase(n.getNodeName())) { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("item".equalsIgnoreCase(d.getNodeName())) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/PlayerAction.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/PlayerAction.java index 95b3da5c8d..a9a2393db7 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/PlayerAction.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/PlayerAction.java @@ -30,7 +30,7 @@ public enum PlayerAction private PlayerAction() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/ShotType.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/ShotType.java index 2e98cb6d93..87e917b8bf 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/ShotType.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/enums/ShotType.java @@ -31,7 +31,7 @@ public enum ShotType private ShotType() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java index cb1452b64b..adf6462b78 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java @@ -34,8 +34,7 @@ public class AdminCommandHandler implements IHandler= FREE_OBJECT_ID_SIZE) { throw new NullPointerException("Ran out of valid Id's."); } + increaseBitSetCapacity(); } _nextFreeId.set(nextFree); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java index 6a3e232a26..002a6f75c3 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java @@ -316,7 +316,6 @@ public final class MapRegionManager implements IGameXmlReader return flags.stream().findAny().get().getLocation(); } } - } else if (fort != null) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java index 8f24f8dfc6..4e3abc79eb 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java @@ -191,7 +191,6 @@ public final class QuestManager { old.unload(); LOGGER.info("Replaced quest " + old.getName() + " (" + old.getId() + ") with a new version!"); - } if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java index e3235b056e..cd7118dc3b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java @@ -427,7 +427,7 @@ public final class SellBuffsManager implements IGameXmlReader } else if (player.isMounted() || player.isFlyingMounted() || player.isFlying()) { - player.sendMessage("You can't sell buffs in Mounth state!"); + player.sendMessage("You can't sell buffs in Mount state!"); return false; } else if (player.isTransformed()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java index 70cfb5d922..5e16e5a91f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java @@ -71,9 +71,7 @@ public final class MessageDeletionTask implements Runnable final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId()); if (receiver != null) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME); - // sm.addString(msg.getReceiverName()); - receiver.sendPacket(sm); + receiver.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME)); } } catch (Exception e) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java index 43cf6815de..964757069c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java @@ -78,7 +78,7 @@ public abstract class AbstractPlayerGroup */ public boolean isLeader(L2PcInstance player) { - return (getLeaderObjectId() == player.getObjectId()); + return getLeaderObjectId() == player.getObjectId(); } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/AggroInfo.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/AggroInfo.java index 3be79b12bb..613e113b28 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/AggroInfo.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/AggroInfo.java @@ -93,4 +93,10 @@ public final class AggroInfo { return _attacker.getObjectId(); } + + @Override + public String toString() + { + return "AggroInfo [attacker=" + _attacker + ", hate=" + _hate + ", damage=" + _damage + "]"; + } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/BlockList.java index 08918cc853..627b0dbbe4 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/BlockList.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/BlockList.java @@ -33,14 +33,10 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.BlockListPacket; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -/** - * This class ... - * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $ - */ public class BlockList { private static Logger _log = Logger.getLogger(BlockList.class.getName()); - private static Map> _offlineList = new ConcurrentHashMap<>(); + private static final Map> OFFLINE_LIST = new ConcurrentHashMap<>(); private final L2PcInstance _owner; private List _blockList; @@ -48,7 +44,7 @@ public class BlockList public BlockList(L2PcInstance owner) { _owner = owner; - _blockList = _offlineList.get(owner.getObjectId()); + _blockList = OFFLINE_LIST.get(owner.getObjectId()); if (_blockList == null) { _blockList = loadList(_owner.getObjectId()); @@ -69,7 +65,7 @@ public class BlockList public void playerLogout() { - _offlineList.put(_owner.getObjectId(), _blockList); + OFFLINE_LIST.put(_owner.getObjectId(), _blockList); } private static List loadList(int ObjId) @@ -263,10 +259,10 @@ public class BlockList { return BlockList.isBlocked(player, targetId); } - if (!_offlineList.containsKey(ownerId)) + if (!OFFLINE_LIST.containsKey(ownerId)) { - _offlineList.put(ownerId, loadList(ownerId)); + OFFLINE_LIST.put(ownerId, loadList(ownerId)); } - return _offlineList.get(ownerId).contains(targetId); + return OFFLINE_LIST.get(ownerId).contains(targetId); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java index ee640a3d9c..047d3d7074 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java @@ -49,17 +49,7 @@ public final class DamageDoneInfo @Override public final boolean equals(Object obj) { - if (this == obj) - { - return true; - } - - if (obj instanceof DamageDoneInfo) - { - return (((DamageDoneInfo) obj).getAttacker() == _attacker); - } - - return false; + return (this == obj) || ((obj instanceof DamageDoneInfo) && (((DamageDoneInfo) obj).getAttacker() == _attacker)); } @Override diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2AccessLevel.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2AccessLevel.java index a050f2f872..aefc7fb15d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2AccessLevel.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2AccessLevel.java @@ -23,29 +23,19 @@ import com.l2jmobius.gameserver.data.xml.impl.AdminData; */ public class L2AccessLevel { - /** - * The access level
    - */ + /** The access level. */ private int _accessLevel = 0; - /** - * The access level name
    - */ + /** The access level name. */ private String _name = null; - /** Child access levels */ + /** Child access levels. */ L2AccessLevel _childsAccessLevel = null; - /** Child access levels */ + /** Child access levels. */ private int _child = 0; - /** - * The name color for the access level
    - */ + /** The name color for the access level. */ private int _nameColor = 0; - /** - * The title color for the access level
    - */ + /** The title color for the access level. */ private int _titleColor = 0; - /** - * Flag to determine if the access level has gm access
    - */ + /** Flag to determine if the access level has GM access. */ private boolean _isGm = false; /** Flag for peace zone attack */ private boolean _allowPeaceAttack = false; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java index b303750a48..13aef855d1 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -219,7 +219,7 @@ public class L2Clan implements IIdentifiable, INamable */ public int getLeaderId() { - return (_leader != null ? _leader.getObjectId() : 0); + return _leader != null ? _leader.getObjectId() : 0; } /** @@ -261,7 +261,6 @@ public class L2Clan implements IIdentifiable, INamable } exLeader.getClanPrivileges().clear(); exLeader.broadcastUserInfo(); - } else { @@ -378,6 +377,7 @@ public class L2Clan implements IIdentifiable, INamable player.setPledgeClass(L2ClanMember.calculatePledgeClass(player)); player.sendPacket(new PledgeShowMemberListUpdate(player)); player.sendPacket(new PledgeSkillList(this)); + addSkillEffects(player); // Notify to scripts @@ -1334,7 +1334,6 @@ public class L2Clan implements IIdentifiable, INamable Skill oldSkill = null; if (newSkill != null) { - if (subType == -2) { oldSkill = _skills.put(newSkill.getId(), newSkill); @@ -1793,12 +1792,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final SubPledge getSubPledge(int pledgeType) { - if (_subPledges == null) - { - return null; - } - - return _subPledges.get(pledgeType); + return _subPledges == null ? null : _subPledges.get(pledgeType); } /** @@ -1999,21 +1993,15 @@ public class L2Clan implements IIdentifiable, INamable public void initializePrivs() { - RankPrivs privs; for (int i = 1; i < 10; i++) { - privs = new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false)); - _privs.put(i, privs); + _privs.put(i, new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false))); } } public EnumIntBitmask getRankPrivs(int rank) { - if (_privs.get(rank) != null) - { - return _privs.get(rank).getPrivs(); - } - return new EnumIntBitmask<>(ClanPrivilege.class, false); + return _privs.get(rank) != null ? _privs.get(rank).getPrivs() : new EnumIntBitmask<>(ClanPrivilege.class, false); } public void setRankPrivs(int rank, int privs) @@ -2080,12 +2068,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final RankPrivs[] getAllRankPrivs() { - if (_privs == null) - { - return new RankPrivs[0]; - } - - return _privs.values().toArray(new RankPrivs[_privs.values().size()]); + return _privs == null ? new RankPrivs[0] : _privs.values().toArray(new RankPrivs[_privs.values().size()]); } public int getLeaderSubPledge(int leaderId) @@ -2417,13 +2400,10 @@ public class L2Clan implements IIdentifiable, INamable player.sendPacket(SystemMessageId.TO_CREATE_AN_ALLIANCE_YOUR_CLAN_MUST_BE_LEVEL_5_OR_HIGHER); return; } - if (getAllyPenaltyExpiryTime() > System.currentTimeMillis()) + if ((getAllyPenaltyExpiryTime() > System.currentTimeMillis()) && (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY)) { - if (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); - return; - } + player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); + return; } if (getDissolvingExpiryTime() > System.currentTimeMillis()) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ClanMember.java index daef76108a..7f0fa86028 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ClanMember.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ClanMember.java @@ -151,8 +151,8 @@ public class L2ClanMember } /** - * Checks if is online. - * @return true, if is online + * Verifies if the clan member is online. + * @return {@code true} if is online */ public boolean isOnline() { @@ -263,11 +263,7 @@ public class L2ClanMember */ public int getPowerGrade() { - if (_player != null) - { - return _player.getPowerGrade(); - } - return _powerGrade; + return _player != null ? _player.getPowerGrade() : _powerGrade; } /** @@ -323,11 +319,7 @@ public class L2ClanMember */ public int getRaceOrdinal() { - if (_player != null) - { - return _player.getRace().ordinal(); - } - return _raceOrdinal; + return _player != null ? _player.getRace().ordinal() : _raceOrdinal; } /** @@ -336,11 +328,7 @@ public class L2ClanMember */ public boolean getSex() { - if (_player != null) - { - return _player.getAppearance().getSex(); - } - return _sex; + return _player != null ? _player.getAppearance().getSex() : _sex; } /** @@ -349,11 +337,7 @@ public class L2ClanMember */ public int getSponsor() { - if (_player != null) - { - return _player.getSponsor(); - } - return _sponsor; + return _player != null ? _player.getSponsor() : _sponsor; } /** @@ -362,11 +346,7 @@ public class L2ClanMember */ public int getApprentice() { - if (_player != null) - { - return _player.getApprentice(); - } - return _apprentice; + return _player != null ? _player.getApprentice() : _apprentice; } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2CommandChannel.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2CommandChannel.java index bb1b4b57c4..d91e7e0554 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2CommandChannel.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2CommandChannel.java @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class L2CommandChannel extends AbstractPlayerGroup { private final List _parties = new CopyOnWriteArrayList<>(); - private L2PcInstance _commandLeader = null; + private L2PcInstance _commandLeader; private int _channelLvl; /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java index 09025eeed1..f485978cf6 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java @@ -68,19 +68,11 @@ public class L2GroupSpawn extends L2Spawn final L2Npc mob = new L2ControllableMobInstance(_template); mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp()); - if (getHeading() == -1) - { - mob.setHeading(Rnd.nextInt(61794)); - } - else - { - mob.setHeading(getHeading()); - } + mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading()); mob.setSpawn(this); mob.spawnMe(newlocx, newlocy, newlocz); return mob; - } catch (Exception e) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java index 7875bdbb6a..905a58c1b8 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java @@ -35,7 +35,7 @@ public class L2NpcWalkerNode extends Location _delay = delay; _runToLocation = runToLocation; _npcString = npcString; - _chatString = ((chatText == null) ? "" : chatText); + _chatString = (chatText == null) ? "" : chatText; } public int getDelay() diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Object.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Object.java index 9164db110c..171ad1e543 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Object.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Object.java @@ -782,7 +782,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared) { final double distance = Math.pow(x - getX(), 2) + Math.pow(y - getY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0); - return (squared) ? distance : Math.sqrt(distance); + return squared ? distance : Math.sqrt(distance); } /** @@ -898,12 +898,12 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab @Override public boolean equals(Object obj) { - return ((obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId())); + return (obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId()); } @Override public String toString() { - return (getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"); + return getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"; } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java index 469b9843cc..c0fad148f8 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java @@ -53,5 +53,4 @@ public class L2RecipeInstance { return _quantity; } - } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java index ae06fa8c1b..c22321462d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java @@ -55,5 +55,4 @@ public class L2RecipeStatInstance { return _value; } - } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Territory.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Territory.java index 5152d69c0d..41cb26df2b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Territory.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Territory.java @@ -16,8 +16,8 @@ */ package com.l2jmobius.gameserver.model; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Logger; import com.l2jmobius.commons.util.Rnd; @@ -44,7 +44,7 @@ public class L2Territory } } - private final List _points = new ArrayList<>(); + private final List _points = new CopyOnWriteArrayList<>(); private final int _terr; private int _xMin; private int _xMax; @@ -96,14 +96,6 @@ public class L2Territory _procMax += proc; } - public void print() - { - for (Point p : _points) - { - _log.info("(" + p._x + "," + p._y + ")"); - } - } - public boolean isIntersect(int x, int y, Point p1, Point p2) { final double dy1 = p1._y - y; @@ -163,7 +155,6 @@ public class L2Territory return new Location(p1._x, p1._y, Rnd.get(p1._zmin, p1._zmax)); } } - } for (int i = 0; i < 100; i++) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2World.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2World.java index 805e0c0ed2..9b02364b07 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2World.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2World.java @@ -282,20 +282,20 @@ public final class L2World } /** - * Add a L2Object in the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Add a L2Object in the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Add the L2Object object in _allPlayers* of L2World
  • *
  • Add the L2Object object in _gmList** of GmListTable
  • - *
  • Add object in _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding PlayerInstance in its _knownPlayer

  • - * * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of WorldRegion (need synchronisation)
    + *
  • Add object in _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding L2PcInstance in its _knownPlayer

  • + * * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of L2WorldRegion (need synchronisation)
    * Caution : This method DOESN'T ADD the object to _allObjects and _allPlayers* of L2World (need synchronisation) Example of use : *
  • Drop an Item
  • *
  • Spawn a L2Character
  • - *
  • Apply Death Penalty of a PlayerInstance
  • + *
  • Apply Death Penalty of a L2PcInstance
  • * @param object L2object to add in the world - * @param newRegion WorldRegion in wich the object will be add (not used) + * @param newRegion L2WorldRegion in wich the object will be add (not used) */ public void addVisibleObject(L2Object object, L2WorldRegion newRegion) { @@ -371,18 +371,18 @@ public final class L2World } /** - * Remove a L2Object from the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Remove a L2Object from the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Remove the L2Object object from _allPlayers* of L2World
  • - *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of WorldRegion
  • + *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of L2WorldRegion
  • *
  • Remove the L2Object object from _gmList** of GmListTable
  • - *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all PlayerInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Example of use : + *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all L2PcInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Example of use : *
  • Pickup an Item
  • *
  • Decay a L2Character
  • * @param object L2object to remove from the world - * @param oldRegion WorldRegion in which the object was before removing + * @param oldRegion L2WorldRegion in which the object was before removing */ public void removeVisibleObject(L2Object object, L2WorldRegion oldRegion) { @@ -395,7 +395,7 @@ public final class L2World { oldRegion.removeVisibleObject(object); - // Go through all surrounding WorldRegion Creatures + // Go through all surrounding L2WorldRegion L2Characters oldRegion.forEachSurroundingRegion(w -> { for (L2Object wo : w.getVisibleObjects().values()) @@ -714,7 +714,7 @@ public final class L2World } /** - * Calculate the current WorldRegions of the object according to its position (x,y). Example of use : + * Calculate the current L2WorldRegions of the object according to its position (x,y). Example of use : *
  • Set position of a new L2Object (drop, spawn...)
  • *
  • Update position of a L2Object after a movement

  • * @param point position of the object @@ -749,12 +749,12 @@ public final class L2World } /** - * Check if the current WorldRegions of the object is valid according to its position (x,y). Example of use : - *
  • Init WorldRegions

  • + * Check if the current L2WorldRegions of the object is valid according to its position (x,y). Example of use : + *
  • Init L2WorldRegions

  • * @param x X position of the object * @param y Y position of the object * @param z Z position of the object - * @return True if the WorldRegion is valid + * @return True if the L2WorldRegion is valid */ public static boolean validRegion(int x, int y, int z) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 6bfaf3a33d..97608b326d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -136,7 +136,6 @@ public final class L2WorldRegion } LOGGER.finer(c + " mobs were turned on"); } - } public boolean isActive() diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MobGroup.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MobGroup.java index 88cc4a5599..4eb38cf27b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MobGroup.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MobGroup.java @@ -191,8 +191,7 @@ public final class MobGroup final int y = player.getY() + Rnd.nextInt(50); mobInst.teleToLocation(new Location(x, y, player.getZ()), true); - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(player); + ((L2ControllableMobAI) mobInst.getAI()).follow(player); } } } @@ -294,8 +293,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.forceAttack(target); + ((L2ControllableMobAI) mobInst.getAI()).forceAttack(target); } } @@ -310,8 +308,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.stop(); + ((L2ControllableMobAI) mobInst.getAI()).stop(); } } @@ -347,8 +344,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(character); + ((L2ControllableMobAI) mobInst.getAI()).follow(character); } } @@ -363,8 +359,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setAlternateAI(L2ControllableMobAI.AI_CAST); + ((L2ControllableMobAI) mobInst.getAI()).setAlternateAI(L2ControllableMobAI.AI_CAST); } } @@ -379,8 +374,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setNotMoving(enabled); + ((L2ControllableMobAI) mobInst.getAI()).setNotMoving(enabled); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MobGroupTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MobGroupTable.java index db0a789765..da1b620a40 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MobGroupTable.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MobGroupTable.java @@ -75,7 +75,7 @@ public class MobGroupTable public boolean removeGroup(int groupKey) { - return (_groupMap.remove(groupKey) != null); + return _groupMap.remove(groupKey) != null; } private static class SingletonHolder diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/Petition.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/Petition.java index 8596c3ea61..cbed80441a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/Petition.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/Petition.java @@ -98,7 +98,7 @@ public final class Petition } PetitionManager.getInstance().getCompletedPetitions().put(getId(), this); - return (PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null); + return PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null; } public String getContent() diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/ShortCuts.java index 2bbf25dee0..3f8d959ef6 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/ShortCuts.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/ShortCuts.java @@ -55,13 +55,10 @@ public class ShortCuts implements IRestorable { Shortcut sc = _shortCuts.get(slot + (page * MAX_SHORTCUTS_PER_BAR)); // Verify shortcut - if ((sc != null) && (sc.getType() == ShortcutType.ITEM)) + if ((sc != null) && (sc.getType() == ShortcutType.ITEM) && (_owner.getInventory().getItemByObjectId(sc.getId()) == null)) { - if (_owner.getInventory().getItemByObjectId(sc.getId()) == null) - { - deleteShortCut(sc.getSlot(), sc.getPage()); - sc = null; - } + deleteShortCut(sc.getSlot(), sc.getPage()); + sc = null; } return sc; } @@ -78,8 +75,7 @@ public class ShortCuts implements IRestorable } shortcut.setSharedReuseGroup(item.getSharedReuseGroup()); } - final Shortcut oldShortCut = _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut); - registerShortCutInDb(shortcut, oldShortCut); + registerShortCutInDb(shortcut, _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut)); } private void registerShortCutInDb(Shortcut shortcut, Shortcut oldShortCut) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/TradeList.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/TradeList.java index 29362b8549..eeee7d0cae 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/TradeList.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/TradeList.java @@ -149,11 +149,7 @@ public class TradeList { if (exclItem.getItem().getId() == item.getId()) { - if (item.getCount() <= exclItem.getCount()) - { - return null; - } - return new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice()); + return item.getCount() <= exclItem.getCount() ? null : new TradeItem(item, item.getCount() - exclItem.getCount(), item.getReferencePrice()); } } } @@ -440,11 +436,7 @@ public class TradeList { partnerList.lock(); lock(); - if (!partnerList.validate()) - { - return false; - } - if (!validate()) + if (!partnerList.validate() || !validate()) { return false; } @@ -616,12 +608,12 @@ public class TradeList boolean success = false; // check weight and slots - if ((!getOwner().getInventory().validateWeight(partnerList.calcItemsWeight())) || !(partnerList.getOwner().getInventory().validateWeight(calcItemsWeight()))) + if (!getOwner().getInventory().validateWeight(partnerList.calcItemsWeight()) || !partnerList.getOwner().getInventory().validateWeight(calcItemsWeight())) { partnerList.getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT); getOwner().sendPacket(SystemMessageId.YOU_HAVE_EXCEEDED_THE_WEIGHT_LIMIT); } - else if ((!getOwner().getInventory().validateCapacity(partnerList.countItemsSlots(getOwner()))) || (!partnerList.getOwner().getInventory().validateCapacity(countItemsSlots(partnerList.getOwner())))) + else if (!getOwner().getInventory().validateCapacity(partnerList.countItemsSlots(getOwner())) || !partnerList.getOwner().getInventory().validateCapacity(countItemsSlots(partnerList.getOwner()))) { partnerList.getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL); getOwner().sendPacket(SystemMessageId.YOUR_INVENTORY_IS_FULL); @@ -846,42 +838,36 @@ public class TradeList } // Send messages about the transaction to both players + SystemMessage msg; if (newItem.isStackable()) { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); + msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); msg.addString(player.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); msg.addString(_owner.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); - player.sendPacket(msg); } else { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); + msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); msg.addString(player.getName()); msg.addItemName(newItem); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); msg.addString(_owner.getName()); msg.addItemName(newItem); - player.sendPacket(msg); } + player.sendPacket(msg); } // Send inventory update packet _owner.sendInventoryUpdate(ownerIU); player.sendInventoryUpdate(playerIU); - if (ok) - { - return 0; - } - return 2; + return ok ? 0 : 2; } /** @@ -892,12 +878,7 @@ public class TradeList */ public synchronized boolean privateStoreSell(L2PcInstance player, ItemRequest[] requestedItems) { - if (_locked) - { - return false; - } - - if (!_owner.isOnline() || !player.isOnline()) + if (_locked || !_owner.isOnline() || !player.isOnline()) { return false; } @@ -1037,32 +1018,30 @@ public class TradeList } // Send messages about the transaction to both players + SystemMessage msg; if (newItem.isStackable()) { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); + msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S3_S2_S_FROM_C1); msg.addString(player.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S3_S2_S); msg.addString(_owner.getName()); msg.addItemName(newItem); msg.addLong(item.getCount()); - player.sendPacket(msg); } else { - SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); + msg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_PURCHASED_S2_FROM_C1); msg.addString(player.getName()); msg.addItemName(newItem); _owner.sendPacket(msg); - msg = SystemMessage.getSystemMessage(SystemMessageId.C1_PURCHASED_S2); msg.addString(_owner.getName()); msg.addItemName(newItem); - player.sendPacket(msg); } + player.sendPacket(msg); } if (totalPrice > 0) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java index d77bf6af86..6892d0798a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java @@ -454,21 +454,18 @@ public final class BlockCheckerEngine switch (_round) { - case 1: + case 1: // Schedule second spawn round { - // Schedule second spawn round _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); break; } - case 2: + case 2: // Schedule third spawn round { - // Schedule third spawn round _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); break; } - case 3: + case 3: // Schedule Event End Count Down { - // Schedule Event End Count Down _task = ThreadPool.schedule(new EndEvent(), 180000); break; } @@ -572,7 +569,7 @@ public final class BlockCheckerEngine /* * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_WILL_END_IN_5_SECONDS)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } + * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } */ /** @@ -652,7 +649,7 @@ public final class BlockCheckerEngine } /** - * Reward the speicifed team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra + * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra * @param isRed */ private void rewardAsWinner(boolean isRed) @@ -714,8 +711,7 @@ public final class BlockCheckerEngine */ private void rewardAsLooser(boolean isRed) { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - for (Entry entry : tempPoints.entrySet()) + for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) { final L2PcInstance player = entry.getKey(); if ((player != null) && (entry.getValue() >= 10)) @@ -726,7 +722,7 @@ public final class BlockCheckerEngine } /** - * Telport players back, give status back and send final packet + * Teleport players back, give status back and send final packet */ private void setPlayersBack() { @@ -748,13 +744,11 @@ public final class BlockCheckerEngine final PcInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); } if (inv.getItemByItemId(13788) != null) { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); } broadcastRelationChanged(player); // Teleport Back diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Couple.java index 7901689adf..c31232e232 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Couple.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Couple.java @@ -99,7 +99,7 @@ public class Couple } catch (Exception e) { - _log.log(Level.SEVERE, "Could not create couple:", e); + _log.log(Level.SEVERE, "Could not create couple: " + e.getMessage(), e); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java index e9b3160a50..75ec9236b8 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -192,12 +192,7 @@ public final class Fort extends AbstractResidence } if ((getOwnerClan().getWarehouse().getAdena() >= _fee) || !_cwh) { - int fee = _fee; - if (getEndTime() == -1) - { - fee = _tempFee; - } - + final int fee = getEndTime() == -1 ? _tempFee : _fee; setEndTime(System.currentTimeMillis() + getRate()); dbSave(); if (_cwh) @@ -549,7 +544,6 @@ public final class Fort extends AbstractResidence if (door != null) { door.setCurrentHp(door.getMaxHp() + hp); - saveDoorUpgrade(doorId, hp, pDef, mDef); } } @@ -589,7 +583,7 @@ public final class Fort extends AbstractResidence long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis(); while (initial > (Config.FS_UPDATE_FRQ * 60000L)) { - initial -= (Config.FS_UPDATE_FRQ * 60000L); + initial -= Config.FS_UPDATE_FRQ * 60000L; } initial = (Config.FS_UPDATE_FRQ * 60000L) - initial; if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600))) @@ -609,7 +603,6 @@ public final class Fort extends AbstractResidence { setOwnerClan(null); } - } catch (Exception e) { @@ -675,12 +668,9 @@ public final class Fort extends AbstractResidence { return false; } - if (lease > 0) + if ((lease > 0) && !player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) { - if (!player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) - { - return false; - } + return false; } if (addNew) { @@ -690,20 +680,16 @@ public final class Fort extends AbstractResidence { removeFunction(type); } + else if ((lease - _function.get(type).getLease()) > 0) + { + _function.remove(type); + _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); + } else { - final int diffLease = lease - _function.get(type).getLease(); - if (diffLease > 0) - { - _function.remove(type); - _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); - } - else - { - _function.get(type).setLease(lease); - _function.get(type).setLvl(lvl); - _function.get(type).dbSave(); - } + _function.get(type).setLease(lease); + _function.get(type).setLvl(lvl); + _function.get(type).dbSave(); } return true; } @@ -934,31 +920,17 @@ public final class Fort extends AbstractResidence public final int getOwnedTime() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); } public final int getTimeTillRebelArmy() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); } public final long getTimeTillNextFortUpdate() { - if (_FortUpdater[0] == null) - { - return 0; - } - return _FortUpdater[0].getDelay(TimeUnit.SECONDS); + return _FortUpdater[0] == null ? 0 : _FortUpdater[0].getDelay(TimeUnit.SECONDS); } public void updateClansReputation(L2Clan owner, boolean removePoints) @@ -999,7 +971,6 @@ public final class Fort extends AbstractResidence _log.log(Level.WARNING, "Exception in endFortressSiege " + e.getMessage(), e); } } - } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/L2Event.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/L2Event.java index ad93bd97a4..be28d47897 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/L2Event.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/L2Event.java @@ -46,7 +46,8 @@ import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse; import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; /** - * @since $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $ This ancient thingie got reworked by Nik at $Date: 2011/05/17 21:51:39 $ Yeah, for 6 years no one bothered reworking this buggy event engine. + * @author Nik + * @Since 2011/05/17 21:51:39 */ public class L2Event { @@ -164,7 +165,6 @@ public class L2Event try { final L2Spawn spawn = new L2Spawn(_npcId); - spawn.setX(target.getX() + 50); spawn.setY(target.getY() + 50); spawn.setZ(target.getZ()); @@ -184,13 +184,11 @@ public class L2Event spawn.getLastSpawn().broadcastPacket(new MagicSkillUse(spawn.getLastSpawn(), spawn.getLastSpawn(), 1034, 1, 1, 1)); // _npcs.add(spawn.getLastSpawn()); - } catch (Exception e) { _log.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e); } - } /** @@ -274,7 +272,6 @@ public class L2Event */ public static void removeAndResetPlayer(L2PcInstance player) { - try { if (isParticipant(player)) @@ -475,7 +472,6 @@ public class L2Event biggestLvlPlayer.setEventStatus(); i = (i + 1) % _teamsNumber; } - } catch (Exception e) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java index 64f1bd2117..08f8d8f701 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java @@ -30,7 +30,7 @@ public final class InstanceReenterTimeHolder private int _minute = -1; private long _time = -1; - public InstanceReenterTimeHolder(int time) + public InstanceReenterTimeHolder(long time) { _time = TimeUnit.MINUTES.toMillis(time); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java index ee59be43a2..03514cc06f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java @@ -45,5 +45,4 @@ public interface IParserAdvUtils extends IParserUtils Duration getDuration(String key); > T getEnum(String key, Class clazz); - } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java index 3930368188..f97917af4f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java @@ -62,7 +62,7 @@ public final class ClanWarehouse extends Warehouse @Override public boolean validateCapacity(long slots) { - return ((_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN); + return (_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN; } @Override diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index a3e5358978..076cfe435a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -1806,7 +1806,7 @@ public final class L2ItemInstance extends L2Object public boolean isTimeLimitedItem() { - return (_time > 0); + return _time > 0; } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java index a4d6c7d9db..2d9fc312b0 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java @@ -49,5 +49,5 @@ public enum MaterialType FISH, RUNE_XP, RUNE_SP, - RUNE_REMOVE_PENALTY + RUNE_REMOVE_PENALTY; } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/Quest.java index 829a045a0e..0c8a3b044b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/Quest.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/Quest.java @@ -155,7 +155,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ protected void onLoad() { - } /** @@ -166,7 +165,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onSave() { - } /** @@ -1056,7 +1054,7 @@ public class Quest extends AbstractScript implements IIdentifiable */ public String onDeath(L2Character killer, L2Character victim, QuestState qs) { - return onAdvEvent("", ((killer instanceof L2Npc) ? ((L2Npc) killer) : null), qs.getPlayer()); + return onAdvEvent("", (killer instanceof L2Npc) ? (L2Npc) killer : null, qs.getPlayer()); } /** @@ -1389,7 +1387,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) { - } /** @@ -1399,7 +1396,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadLose(L2PcInstance loser, CompetitionType type) { - } /** @@ -1408,7 +1404,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onMoveFinished(L2Npc npc) { - } /** @@ -1417,7 +1412,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onNodeArrived(L2Npc npc) { - } /** @@ -1426,7 +1420,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onRouteFinished(L2Npc npc) { - } /** @@ -2624,11 +2617,7 @@ public class Quest extends AbstractScript implements IIdentifiable } } } - if ((luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc)) - { - return luckyPlayer; - } - return null; + return (luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc) ? luckyPlayer : null; } /** @@ -2663,15 +2652,7 @@ public class Quest extends AbstractScript implements IIdentifiable QuestState qs = player.getQuestState(getName()); if (!player.isInParty()) { - if (!checkPartyMemberConditions(qs, condition, target)) - { - return null; - } - if (!checkDistanceToTarget(player, target)) - { - return null; - } - return qs; + return !checkPartyMemberConditions(qs, condition, target) || !checkDistanceToTarget(player, target) ? null : qs; } final List candidates = new ArrayList<>(); @@ -2703,21 +2684,17 @@ public class Quest extends AbstractScript implements IIdentifiable } qs = candidates.get(getRandom(candidates.size())); - if (!checkDistanceToTarget(qs.getPlayer(), target)) - { - return null; - } - return qs; + return !checkDistanceToTarget(qs.getPlayer(), target) ? null : qs; } private boolean checkPartyMemberConditions(QuestState qs, int condition, L2Npc npc) { - return ((qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc)); + return (qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc); } private static boolean checkDistanceToTarget(L2PcInstance player, L2Npc target) { - return ((target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true)); + return (target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true); } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/QuestState.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/QuestState.java index abf9825d8e..23c0acc8d1 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/QuestState.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/QuestState.java @@ -114,7 +114,7 @@ public final class QuestState */ public boolean isCreated() { - return (_state == State.CREATED); + return _state == State.CREATED; } /** @@ -123,7 +123,7 @@ public final class QuestState */ public boolean isStarted() { - return (_state == State.STARTED); + return _state == State.STARTED; } /** @@ -132,7 +132,7 @@ public final class QuestState */ public boolean isCompleted() { - return (_state == State.COMPLETED); + return _state == State.COMPLETED; } /** @@ -340,10 +340,10 @@ public final class QuestState // since no flag had been skipped until now, the least significant bits must all // be set to 1, up until "old" number of bits. - completedStateFlags |= ((1 << old) - 1); + completedStateFlags |= (1 << old) - 1; // now, just set the bit corresponding to the passed cond to 1 (current step) - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } } @@ -352,7 +352,7 @@ public final class QuestState else if (cond < old) { // note, this also unsets the flag indicating that there exist skips - completedStateFlags &= ((1 << cond) - 1); + completedStateFlags &= (1 << cond) - 1; // now, check if this resulted in no steps being skipped any more if (completedStateFlags == ((1 << cond) - 1)) @@ -372,7 +372,7 @@ public final class QuestState // Just mark this state and we are done. else { - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } @@ -463,7 +463,7 @@ public final class QuestState */ public boolean isCond(int condition) { - return (getInt("cond") == condition); + return getInt("cond") == condition; } /** @@ -523,7 +523,7 @@ public final class QuestState */ public boolean isSet(String variable) { - return (get(variable) != null); + return get(variable) != null; } /** @@ -578,7 +578,7 @@ public final class QuestState public boolean isMemoState(int memoState) { - return (getInt("memoState") == memoState); + return getInt("memoState") == memoState; } /** @@ -823,7 +823,7 @@ public final class QuestState public boolean isNowAvailable() { final String val = get("restartTime"); - return (val != null) && (!Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis())); + return (val == null) || !Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis()); } public void setSimulated(boolean simulated) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/TraitType.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/TraitType.java index e7a799703d..890e7b48b8 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/TraitType.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/stats/TraitType.java @@ -83,7 +83,7 @@ public enum TraitType { _type = type; } - + public int getType() { return _type; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java index 4433e97b28..f431bdab71 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java @@ -49,13 +49,13 @@ public class ZoneCuboid extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_r.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _r.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -65,9 +65,9 @@ public class ZoneCuboid extends L2ZoneForm final int _x2 = _r.x + _r.width; final int _y1 = _r.y; final int _y2 = _r.y + _r.height; - double test, shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); + double test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); + double shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); - test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); if (test < shortestDist) { shortestDist = test; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java index afdfd3fade..5f3b143379 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java @@ -43,11 +43,7 @@ public class ZoneCylinder extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - if (((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) > _radS) || (z < _z1) || (z > _z2)) - { - return false; - } - return true; + return ((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) <= _radS) && (z >= _z1) && (z <= _z2); } @Override @@ -130,9 +126,7 @@ public class ZoneCylinder extends L2ZoneForm final double angle = (2 * Math.PI) / count; for (int i = 0; i < count; i++) { - final int x = (int) (Math.cos(angle * i) * _rad); - final int y = (int) (Math.sin(angle * i) * _rad); - dropDebugItem(Inventory.ADENA_ID, 1, _x + x, _y + y, z); + dropDebugItem(Inventory.ADENA_ID, 1, _x + (int) (Math.cos(angle * i) * _rad), _y + (int) (Math.sin(angle * i) * _rad), z); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java index 2340c1b218..d1ef507961 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java @@ -51,13 +51,13 @@ public class ZoneNPoly extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_p.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _p.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -95,25 +95,15 @@ public class ZoneNPoly extends L2ZoneForm @Override public void visualizeZone(int z) { - final int[] _x = _p.xpoints; - final int[] _y = _p.ypoints; - for (int i = 0; i < _p.npoints; i++) { - int nextIndex = i + 1; - // ending point to first one - if (nextIndex == _x.length) - { - nextIndex = 0; - } - final int vx = _x[nextIndex] - _x[i]; - final int vy = _y[nextIndex] - _y[i]; - float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)); - lenght /= STEP; + final int nextIndex = (i + 1) == _p.xpoints.length ? 0 : i + 1; + final int vx = _p.xpoints[nextIndex] - _p.xpoints[i]; + final int vy = _p.ypoints[nextIndex] - _p.ypoints[i]; + final float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)) / STEP; for (int o = 1; o <= lenght; o++) { - final float k = o / lenght; - dropDebugItem(Inventory.ADENA_ID, 1, (int) (_x[i] + (k * vx)), (int) (_y[i] + (k * vy)), z); + dropDebugItem(Inventory.ADENA_ID, 1, (int) (_p.xpoints[i] + ((o / lenght) * vx)), (int) (_p.ypoints[i] + ((o / lenght) * vy)), z); } } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java index 09ea4b531a..904a7f2919 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public final class L2CastleZone extends L2ResidenceZone { - public L2CastleZone(int id) { super(id); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java index ec9a75b975..a1a99b7051 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java @@ -99,7 +99,7 @@ public class L2NoRestartZone extends L2ZoneType return; } - if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.getInstance().getStartedTime()) > getRestartAllowedTime())) + if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis()) > getRestartAllowedTime())) { player.teleToLocation(TeleportWhereType.TOWN); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java index 45e377e22a..b3b1c77f42 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java @@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public class L2NoSummonFriendZone extends L2ZoneType { - public L2NoSummonFriendZone(int id) { super(id); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java index cb7760aee0..9ab43dd1cd 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java @@ -71,12 +71,7 @@ public class L2ResidenceHallTeleportZone extends L2ResidenceTeleportZone @Override public void run() { - int index = 0; - if (getSpawns().size() > 1) - { - index = Rnd.get(getSpawns().size()); - } - + final int index = getSpawns().size() > 1 ? Rnd.get(getSpawns().size()) : 0; final Location loc = getSpawns().get(index); if (loc == null) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java index e63f1883f1..46037463d5 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java @@ -26,7 +26,6 @@ public class BlowFishKeygen { private static final int CRYPT_KEYS_SIZE = 20; private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16]; - static { // init the GS encryption keys on class load @@ -54,7 +53,6 @@ public class BlowFishKeygen // block instantiation private BlowFishKeygen() { - } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/IncomingPackets.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/IncomingPackets.java index 98362130f8..85b3fad9fd 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/IncomingPackets.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/IncomingPackets.java @@ -208,7 +208,6 @@ public enum IncomingPackets implements IIncomingPackets EX_PACKET(0xD0, ExPacket::new, ConnectionState.values()); // This packet has its own connection state checking so we allow all of them public static final IncomingPackets[] PACKET_ARRAY; - static { final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java index 8681078d71..cf476ab880 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java @@ -56,5 +56,4 @@ public class AuthRequest extends BaseSendablePacket { return getBytes(); } - } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java index 69264263b4..2603512fdf 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java @@ -25,7 +25,6 @@ import com.l2jmobius.commons.network.BaseSendablePacket; */ public class ReplyCharacters extends BaseSendablePacket { - public ReplyCharacters(String account, int chars, List timeToDel) { writeC(0x08); @@ -43,5 +42,4 @@ public class ReplyCharacters extends BaseSendablePacket { return getBytes(); } - } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java index 113caaea70..ed3375e8d2 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class AuthResponse extends BaseRecievePacket { - private final int _serverId; private final String _serverName; @@ -52,5 +51,4 @@ public class AuthResponse extends BaseRecievePacket { return _serverName; } - } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java index 6945db648c..721ff58f8e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java @@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; public class ChangePasswordResponse extends BaseRecievePacket { - public ChangePasswordResponse(byte[] decrypt) { super(decrypt); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java index d937c4762e..6f43b2976d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java @@ -43,5 +43,4 @@ public class InitLS extends BaseRecievePacket final int size = readD(); _key = readB(size); } - } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java index fe2c0b2d88..bbf888d495 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class KickPlayer extends BaseRecievePacket { - private final String _account; /** @@ -39,5 +38,4 @@ public class KickPlayer extends BaseRecievePacket { return _account; } - } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java index f50e7a95e6..ae76f77fb7 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class LoginServerFail extends BaseRecievePacket { - private static final String[] REASONS = { "None", @@ -52,5 +51,4 @@ public class LoginServerFail extends BaseRecievePacket { return _reason; } - } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java index a87742fab7..c747b9bb56 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class PlayerAuthResponse extends BaseRecievePacket { - private final String _account; private final boolean _authed; @@ -35,7 +34,7 @@ public class PlayerAuthResponse extends BaseRecievePacket super(decrypt); _account = readS(); - _authed = (readC() != 0); + _authed = readC() != 0; } /** @@ -53,5 +52,4 @@ public class PlayerAuthResponse extends BaseRecievePacket { return _authed; } - } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/DateRange.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/DateRange.java index e825d08b90..3b8acae352 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/DateRange.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/DateRange.java @@ -43,10 +43,7 @@ public class DateRange { try { - final Date start = format.parse(date[0]); - final Date end = format.parse(date[1]); - - return new DateRange(start, end); + return new DateRange(format.parse(date[0]), format.parse(date[1])); } catch (ParseException e) { @@ -63,7 +60,8 @@ public class DateRange public boolean isWithinRange(Date date) { - return date.after(_startDate) && date.before(_endDate); + return (date.equals(_startDate) || date.after(_startDate)) // + && (date.equals(_endDate) || date.before(_endDate)); } public Date getEndDate() diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/ScriptDocument.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/ScriptDocument.java index 00b292822c..eacfe5baf8 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/ScriptDocument.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/ScriptDocument.java @@ -63,7 +63,6 @@ public class ScriptDocument { // Parser with specified options can't be built _log.log(Level.WARNING, "", pce); - } catch (IOException ioe) { @@ -90,5 +89,4 @@ public class ScriptDocument { return _name; } - } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/ScriptEngine.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/ScriptEngine.java index 41525b111f..bdef90d7b6 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/ScriptEngine.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/script/ScriptEngine.java @@ -41,16 +41,16 @@ public class ScriptEngine s = parserFactories.get(name); if (s == null) // if the shape factory is not there even now { - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } catch (ClassNotFoundException e) { // We'll throw an exception to indicate that // the shape could not be created - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } - return (s.create()); + return s.create(); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/Task.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/Task.java index ecbef18add..d76a02c101 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/Task.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/Task.java @@ -43,6 +43,5 @@ public abstract class Task public void onDestroy() { - } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java index 7f86a2bfb3..6b73502977 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java @@ -104,7 +104,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.warning("Cannot updated the Global Task " + id + ": " + e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Cannot updated the Global Task " + id + ": " + e.getMessage(), e); } if ((type == TYPE_SHEDULED) || (type == TYPE_TIME)) @@ -116,15 +116,7 @@ public final class TaskManager @Override public boolean equals(Object object) { - if (this == object) - { - return true; - } - if (!(object instanceof ExecutedTask)) - { - return false; - } - return id == ((ExecutedTask) object).id; + return (this == object) || ((object instanceof ExecutedTask) && (id == ((ExecutedTask) object).id)); } @Override @@ -169,7 +161,6 @@ public final class TaskManager _currentTasks.remove(this); } - } private void initializate() @@ -182,8 +173,7 @@ public final class TaskManager public void registerTask(Task task) { - final int key = task.getName().hashCode(); - _tasks.computeIfAbsent(key, k -> + _tasks.computeIfAbsent(task.getName().hashCode(), k -> { task.initializate(); return task; @@ -217,7 +207,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.SEVERE, "Error while loading Global Task table: ", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error while loading Global Task table: " + e.getMessage(), e); } } @@ -256,7 +246,7 @@ public final class TaskManager task.scheduled = ThreadPool.schedule(task, diff); return true; } - LOGGER.info("Task " + task.getId() + " is obsoleted."); + LOGGER.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted."); } catch (Exception e) { @@ -280,7 +270,7 @@ public final class TaskManager if (hour.length != 3) { - LOGGER.warning("Task " + task.getId() + " has incorrect parameters"); + LOGGER.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters"); return false; } @@ -296,7 +286,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.WARNING, "Bad parameter on task " + task.getId() + ": ", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Bad parameter on task " + task.getId() + ": " + e.getMessage(), e); return false; } @@ -348,7 +338,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the unique task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the unique task: " + e.getMessage(), e); } return false; } @@ -374,7 +364,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the task: " + e.getMessage(), e); } return false; } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java index e23716eba1..f005fca2ea 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java @@ -94,7 +94,7 @@ public final class FloodProtectorAction if ((curTick < _nextGameTick) || _punishmentInProgress) { - if (_config.LOG_FLOODING && !_logged && (_log.getLevel() == Level.WARNING)) + if (_config.LOG_FLOODING && !_logged && _log.isLoggable(Level.WARNING)) { log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeController.MILLIS_IN_TICK), " ms after previous command"); _logged = true; @@ -124,12 +124,9 @@ public final class FloodProtectorAction return false; } - if (_count.get() > 0) + if ((_count.get() > 0) && _config.LOG_FLOODING && _log.isLoggable(Level.WARNING)) { - if (_config.LOG_FLOODING && (_log.getLevel() == Level.WARNING)) - { - log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); - } + log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); } _nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL; @@ -145,7 +142,7 @@ public final class FloodProtectorAction { Disconnection.of(_client).defaultSequence(false); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log("kicked for flooding"); } @@ -157,7 +154,7 @@ public final class FloodProtectorAction private void banAccount() { PunishmentManager.getInstance().startPunishment(new PunishmentTask(_client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log(" banned for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } @@ -168,18 +165,20 @@ public final class FloodProtectorAction */ private void jailChar() { - if (_client.getActiveChar() != null) + if (_client.getActiveChar() == null) { - final int charId = _client.getActiveChar().getObjectId(); - if (charId > 0) - { - PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - } - - if (_log.getLevel() == Level.WARNING) - { - log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); - } + return; + } + + final int charId = _client.getActiveChar().getObjectId(); + if (charId > 0) + { + PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); + } + + if (_log.isLoggable(Level.WARNING)) + { + log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/GMAudit.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/GMAudit.java index ab7aa87ed6..c2ee25069b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/GMAudit.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/GMAudit.java @@ -32,7 +32,6 @@ import com.l2jmobius.Config; public class GMAudit { private static final Logger _log = Logger.getLogger(GMAudit.class.getName()); - static { new File("log/GMAudit").mkdirs(); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/LinePointIterator.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/LinePointIterator.java index 2208c5092d..168255fafd 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/LinePointIterator.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/LinePointIterator.java @@ -65,7 +65,7 @@ public final class LinePointIterator _first = false; return true; } - else if (_dx >= _dy) + if (_dx >= _dy) { if (_srcX != _dstX) { @@ -81,21 +81,18 @@ public final class LinePointIterator return true; } } - else + else if (_srcY != _dstY) { - if (_srcY != _dstY) + _srcY += _sy; + + _error += _dx; + if (_error >= _dy) { - _srcY += _sy; - - _error += _dx; - if (_error >= _dy) - { - _srcX += _sx; - _error -= _dy; - } - - return true; + _srcX += _sx; + _error -= _dy; } + + return true; } return false; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java index 771bbb5fc7..c9dd0c3840 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java @@ -75,7 +75,7 @@ public final class LinePointIterator3D _first = false; return true; } - else if ((_dx >= _dy) && (_dx >= _dz)) + if ((_dx >= _dy) && (_dx >= _dz)) { if (_srcX != _dstX) { @@ -121,28 +121,25 @@ public final class LinePointIterator3D return true; } } - else + else if (_srcZ != _dstZ) { - if (_srcZ != _dstZ) + _srcZ += _sz; + + _error += _dx; + if (_error >= _dz) { - _srcZ += _sz; - - _error += _dx; - if (_error >= _dz) - { - _srcX += _sx; - _error -= _dz; - } - - _error2 += _dy; - if (_error2 >= _dz) - { - _srcY += _sy; - _error2 -= _dz; - } - - return true; + _srcX += _sx; + _error -= _dz; } + + _error2 += _dy; + if (_error2 >= _dz) + { + _srcY += _sy; + _error2 -= _dz; + } + + return true; } return false; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/PrimeFinder.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/PrimeFinder.java index a454fd5289..e032195067 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/PrimeFinder.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/PrimeFinder.java @@ -1,18 +1,13 @@ /* - * This file is part of the L2J Mobius project. + * Copyright (c) 1999 CERN - European Organization for Nuclear Research. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear in + * supporting documentation. CERN makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without expressed or implied warranty. */ package com.l2jmobius.gameserver.util; @@ -331,7 +326,6 @@ public final class PrimeFinder 800076929, 1600153859 }; - static { // initializer // The above prime numbers are formatted for human readability. diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/commons/util/DeadLockDetector.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/commons/util/DeadLockDetector.java index e9f16e2ccc..ad202531e4 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/commons/util/DeadLockDetector.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/commons/util/DeadLockDetector.java @@ -114,7 +114,7 @@ public class DeadLockDetector extends Thread } catch (Exception e) { - LOGGER.log(Level.WARNING, "", e); + LOGGER.log(Level.WARNING, "DeadLockDetector: ", e); } } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameServer.java index 2b32c16a96..abcba85ca2 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameServer.java @@ -180,7 +180,7 @@ public class GameServer if (!IdFactory.getInstance().isInitialized()) { LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration."); - throw new Exception("Could not initialize the ID factory"); + throw new Exception("Could not initialize the ID factory!"); } // load script engines @@ -267,6 +267,7 @@ public class GameServer if (Config.PREMIUM_SYSTEM_ENABLED) { + LOGGER.info("PremiumManager: Premium system is enabled."); PremiumManager.getInstance(); } @@ -457,7 +458,7 @@ public class GameServer /*** Main ***/ // Create log folder - final File logFolder = new File(".", LOG_FOLDER); + final File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER); logFolder.mkdir(); // Create input stream for log file -- or store file data into memory diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java index a4fc1b00a2..75089ff0f6 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/ItemsAutoDestroy.java @@ -87,7 +87,6 @@ public final class ItemsAutoDestroy ItemsOnGroundManager.getInstance().removeObject(item); } } - } } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/RecipeController.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/RecipeController.java index 8b8cbe3470..dba4334dd6 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/RecipeController.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/RecipeController.java @@ -60,6 +60,7 @@ public class RecipeController protected RecipeController() { + // Prevent external initialization. } public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft) @@ -336,7 +337,6 @@ public class RecipeController if (Config.ALT_GAME_CREATION && !_items.isEmpty()) { - if (!calculateStatUse(true, true)) { return; // check stat use diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/Shutdown.java index 2e99f8f99f..547750542b 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/Shutdown.java @@ -263,11 +263,10 @@ public class Shutdown extends Thread try { DatabaseFactory.getInstance().close(); - LOGGER.info("L2Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); + LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms)."); } catch (Throwable t) { - } // server will quit, when this function ends. @@ -536,9 +535,6 @@ public class Shutdown extends Thread } } - /* - * if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true); - */ final TimeCounter tc = new TimeCounter(); // Save all raidboss and GrandBoss status ^_^ @@ -590,7 +586,7 @@ public class Shutdown extends Thread if (Config.BOTREPORT_ENABLE) { BotReportTable.getInstance().saveReportedCharData(); - LOGGER.info("Bot Report Table: Sucessfully saved reports to database!"); + LOGGER.info("Bot Report Table: Successfully saved reports to database!"); } try diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/cache/HtmCache.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/cache/HtmCache.java index fec436d1fa..2da85f99ff 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/cache/HtmCache.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/cache/HtmCache.java @@ -43,7 +43,7 @@ public class HtmCache private static final Pattern ABSTRACT_BLOCK_PATTERN = Pattern.compile("", Pattern.DOTALL); private static final Pattern BLOCK_PATTERN = Pattern.compile("(.*?)", Pattern.DOTALL); - private final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); + private static final Map _cache = Config.LAZY_CACHE ? new ConcurrentHashMap<>() : new HashMap<>(); private int _loadedFiles; private long _bytesBuffLen; diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java index 6a19cc7d31..3f98953c02 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java @@ -204,14 +204,7 @@ public class Forum public Forum getChildByName(String name) { vload(); - for (Forum f : _children) - { - if (f.getName().equals(name)) - { - return f; - } - } - return null; + return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null); } /** @@ -220,7 +213,6 @@ public class Forum public void rmTopicByID(int id) { _topic.remove(id); - } public void insertIntoDb() diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java index bc05a8ff5c..a4df772cc3 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java @@ -46,9 +46,7 @@ public class ForumsBBSManager extends BaseBBSManager { while (rs.next()) { - final int forumId = rs.getInt("forum_id"); - final Forum f = new Forum(forumId, null); - addForum(f); + addForum(new Forum(rs.getInt("forum_id"), null)); } } catch (Exception e) @@ -62,10 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager */ public void initRoot() { - for (Forum f : _table) - { - f.vload(); - } + _table.forEach(f -> f.vload()); _log.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid); } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java index 188d99945c..7d74ef6eb4 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/PostBBSManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import com.l2jmobius.gameserver.communitybbs.BB.Forum; import com.l2jmobius.gameserver.communitybbs.BB.Post; -import com.l2jmobius.gameserver.communitybbs.BB.Post.CPost; import com.l2jmobius.gameserver.communitybbs.BB.Topic; import com.l2jmobius.gameserver.handler.CommunityBoardHandler; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -68,21 +67,8 @@ public class PostBBSManager extends BaseBBSManager st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); final int idp = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } - + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showPost(TopicBBSManager.getInstance().getTopicByID(idp), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind); } else if (command.startsWith("_bbsposts;edit;")) @@ -106,7 +92,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(topic); if ((forum == null) || (topic == null) || (p == null)) { - CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exit !


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error, this forum, topic or post does not exist!


    ", activeChar); } else { @@ -118,7 +104,7 @@ public class PostBBSManager extends BaseBBSManager { if ((forum == null) || (topic == null)) { - CommunityBoardHandler.separateAndSend("

    Error, this forum is not implemented yet


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    Error: This forum is not implemented yet!
    ", activeChar); } else if (forum.getType() == Forum.MEMO) { @@ -126,7 +112,7 @@ public class PostBBSManager extends BaseBBSManager } else { - CommunityBoardHandler.separateAndSend("

    the forum: " + forum.getName() + " is not implemented yet


    ", activeChar); + CommunityBoardHandler.separateAndSend("

    The forum: " + forum.getName() + " is not implemented yet!
    ", activeChar); } } @@ -139,7 +125,6 @@ public class PostBBSManager extends BaseBBSManager private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum) { - // final Post p = getGPosttByTopic(topic); final Locale locale = Locale.getDefault(); final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale); @@ -176,8 +161,7 @@ public class PostBBSManager extends BaseBBSManager final Post p = getGPosttByTopic(t); if (p != null) { - final CPost cp = p.getCPost(idp); - if (cp == null) + if (p.getCPost(idp) == null) { CommunityBoardHandler.separateAndSend("

    the post: " + idp + " does not exist !


    ", activeChar); } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java index db6e17a2b0..427f456b84 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/TopicBBSManager.java @@ -60,11 +60,7 @@ public class TopicBBSManager extends BaseBBSManager public int getMaxID(Forum f) { final Integer i = _maxId.get(f); - if (i == null) - { - return 0; - } - return i; + return i == null ? 0 : i; } public Topic getTopicByID(int idf) @@ -146,20 +142,8 @@ public class TopicBBSManager extends BaseBBSManager st.nextToken(); st.nextToken(); final int idf = Integer.parseInt(st.nextToken()); - String index = null; - if (st.hasMoreTokens()) - { - index = st.nextToken(); - } - int ind = 0; - if (index == null) - { - ind = 1; - } - else - { - ind = Integer.parseInt(index); - } + final String index = st.hasMoreTokens() ? st.nextToken() : null; + final int ind = index == null ? 1 : Integer.parseInt(index); showTopics(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, ind, idf); } else if (command.startsWith("_bbstopics;crea")) diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java index d8dc164725..609f0858d5 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java @@ -170,12 +170,7 @@ public class CharNameTable public final int getAccessLevelById(int objectId) { - if (getNameById(objectId) != null) - { - return _accessLevels.get(objectId); - } - - return 0; + return getNameById(objectId) != null ? _accessLevels.get(objectId) : 0; } public synchronized boolean doesCharNameExist(String name) diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java index 3f2fe830c7..c6ee79672c 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java @@ -67,7 +67,6 @@ import com.l2jmobius.gameserver.util.Util; public class ClanTable { private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName()); - private final Map _clans = new ConcurrentHashMap<>(); protected ClanTable() @@ -444,16 +443,13 @@ public class ClanTable for (L2Clan clan : _clans.values()) { final int allyId = clan.getAllyId(); - if ((allyId != 0) && (clan.getId() != allyId)) + if ((allyId != 0) && (clan.getId() != allyId) && !_clans.containsKey(allyId)) { - if (!_clans.containsKey(allyId)) - { - clan.setAllyId(0); - clan.setAllyName(null); - clan.changeAllyCrest(0, true); - clan.updateClanInDB(); - LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); - } + clan.setAllyId(0); + clan.setAllyName(null); + clan.changeAllyCrest(0, true); + clan.updateClanInDB(); + LOGGER.info(getClass().getSimpleName() + ": Removed alliance from clan: " + clan); } } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/datatables/EventDroplist.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/datatables/EventDroplist.java index c22e5eb0ee..ba8c26bbd8 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/datatables/EventDroplist.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/datatables/EventDroplist.java @@ -35,7 +35,7 @@ public class EventDroplist /** * The table containing all DataDrop object */ - private static final List _allNpcDateDrops = new CopyOnWriteArrayList<>(); + private static final List ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>(); public static class DateDrop { @@ -74,7 +74,7 @@ public class EventDroplist */ public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance))); } /** @@ -86,7 +86,7 @@ public class EventDroplist */ public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange) { - _allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance))); } /** @@ -96,7 +96,7 @@ public class EventDroplist */ public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop) { - _allNpcDateDrops.add(new DateDrop(dateRange, eventDrop)); + ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, eventDrop)); } /** @@ -106,7 +106,7 @@ public class EventDroplist { final List list = new LinkedList<>(); final Date currentDate = new Date(); - for (DateDrop drop : _allNpcDateDrops) + for (DateDrop drop : ALL_NPC_DATE_DROPS) { if (drop._dateRange.isWithinRange(currentDate)) { diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/engines/DocumentBase.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/engines/DocumentBase.java index 0050c0a281..37410b0b38 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/engines/DocumentBase.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/engines/DocumentBase.java @@ -151,12 +151,11 @@ public abstract class DocumentBase protected final Logger _log = Logger.getLogger(getClass().getName()); private final File _file; - protected Map _tables; + protected final Map _tables = new HashMap<>(); protected DocumentBase(File pFile) { _file = pFile; - _tables = new HashMap<>(); } public Document parse() diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java index 0e3b945cf4..4d3be938c9 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/engines/items/DocumentItem.java @@ -79,7 +79,6 @@ public final class DocumentItem extends DocumentBase implements IGameXmlReader { if ("list".equalsIgnoreCase(n.getNodeName())) { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { if ("item".equalsIgnoreCase(d.getNodeName())) diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/enums/PlayerAction.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/enums/PlayerAction.java index 95b3da5c8d..a9a2393db7 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/enums/PlayerAction.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/enums/PlayerAction.java @@ -30,7 +30,7 @@ public enum PlayerAction private PlayerAction() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/enums/ShotType.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/enums/ShotType.java index 2e98cb6d93..87e917b8bf 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/enums/ShotType.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/enums/ShotType.java @@ -31,7 +31,7 @@ public enum ShotType private ShotType() { - _mask = (1 << ordinal()); + _mask = 1 << ordinal(); } public int getMask() diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java index cb1452b64b..adf6462b78 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/handler/AdminCommandHandler.java @@ -34,8 +34,7 @@ public class AdminCommandHandler implements IHandler= FREE_OBJECT_ID_SIZE) { throw new NullPointerException("Ran out of valid Id's."); } + increaseBitSetCapacity(); } _nextFreeId.set(nextFree); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java index 6a3e232a26..002a6f75c3 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/MapRegionManager.java @@ -316,7 +316,6 @@ public final class MapRegionManager implements IGameXmlReader return flags.stream().findAny().get().getLocation(); } } - } else if (fort != null) { diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java index 8f24f8dfc6..4e3abc79eb 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/QuestManager.java @@ -191,7 +191,6 @@ public final class QuestManager { old.unload(); LOGGER.info("Replaced quest " + old.getName() + " (" + old.getId() + ") with a new version!"); - } if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS) diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java index e3235b056e..cd7118dc3b 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/SellBuffsManager.java @@ -427,7 +427,7 @@ public final class SellBuffsManager implements IGameXmlReader } else if (player.isMounted() || player.isFlyingMounted() || player.isFlying()) { - player.sendMessage("You can't sell buffs in Mounth state!"); + player.sendMessage("You can't sell buffs in Mount state!"); return false; } else if (player.isTransformed()) diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java index 70cfb5d922..5e16e5a91f 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/tasks/MessageDeletionTask.java @@ -71,9 +71,7 @@ public final class MessageDeletionTask implements Runnable final L2PcInstance receiver = L2World.getInstance().getPlayer(msg.getReceiverId()); if (receiver != null) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME); - // sm.addString(msg.getReceiverName()); - receiver.sendPacket(sm); + receiver.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_MAIL_WAS_RETURNED_DUE_TO_THE_EXCEEDED_WAITING_TIME)); } } catch (Exception e) diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java index 43cf6815de..964757069c 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/AbstractPlayerGroup.java @@ -78,7 +78,7 @@ public abstract class AbstractPlayerGroup */ public boolean isLeader(L2PcInstance player) { - return (getLeaderObjectId() == player.getObjectId()); + return getLeaderObjectId() == player.getObjectId(); } /** diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/AggroInfo.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/AggroInfo.java index 3be79b12bb..613e113b28 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/AggroInfo.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/AggroInfo.java @@ -93,4 +93,10 @@ public final class AggroInfo { return _attacker.getObjectId(); } + + @Override + public String toString() + { + return "AggroInfo [attacker=" + _attacker + ", hate=" + _hate + ", damage=" + _damage + "]"; + } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/BlockList.java index 08918cc853..627b0dbbe4 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/BlockList.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/BlockList.java @@ -33,14 +33,10 @@ import com.l2jmobius.gameserver.network.SystemMessageId; import com.l2jmobius.gameserver.network.serverpackets.BlockListPacket; import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -/** - * This class ... - * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $ - */ public class BlockList { private static Logger _log = Logger.getLogger(BlockList.class.getName()); - private static Map> _offlineList = new ConcurrentHashMap<>(); + private static final Map> OFFLINE_LIST = new ConcurrentHashMap<>(); private final L2PcInstance _owner; private List _blockList; @@ -48,7 +44,7 @@ public class BlockList public BlockList(L2PcInstance owner) { _owner = owner; - _blockList = _offlineList.get(owner.getObjectId()); + _blockList = OFFLINE_LIST.get(owner.getObjectId()); if (_blockList == null) { _blockList = loadList(_owner.getObjectId()); @@ -69,7 +65,7 @@ public class BlockList public void playerLogout() { - _offlineList.put(_owner.getObjectId(), _blockList); + OFFLINE_LIST.put(_owner.getObjectId(), _blockList); } private static List loadList(int ObjId) @@ -263,10 +259,10 @@ public class BlockList { return BlockList.isBlocked(player, targetId); } - if (!_offlineList.containsKey(ownerId)) + if (!OFFLINE_LIST.containsKey(ownerId)) { - _offlineList.put(ownerId, loadList(ownerId)); + OFFLINE_LIST.put(ownerId, loadList(ownerId)); } - return _offlineList.get(ownerId).contains(targetId); + return OFFLINE_LIST.get(ownerId).contains(targetId); } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java index ee640a3d9c..047d3d7074 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/DamageDoneInfo.java @@ -49,17 +49,7 @@ public final class DamageDoneInfo @Override public final boolean equals(Object obj) { - if (this == obj) - { - return true; - } - - if (obj instanceof DamageDoneInfo) - { - return (((DamageDoneInfo) obj).getAttacker() == _attacker); - } - - return false; + return (this == obj) || ((obj instanceof DamageDoneInfo) && (((DamageDoneInfo) obj).getAttacker() == _attacker)); } @Override diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2AccessLevel.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2AccessLevel.java index a050f2f872..aefc7fb15d 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2AccessLevel.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2AccessLevel.java @@ -23,29 +23,19 @@ import com.l2jmobius.gameserver.data.xml.impl.AdminData; */ public class L2AccessLevel { - /** - * The access level
    - */ + /** The access level. */ private int _accessLevel = 0; - /** - * The access level name
    - */ + /** The access level name. */ private String _name = null; - /** Child access levels */ + /** Child access levels. */ L2AccessLevel _childsAccessLevel = null; - /** Child access levels */ + /** Child access levels. */ private int _child = 0; - /** - * The name color for the access level
    - */ + /** The name color for the access level. */ private int _nameColor = 0; - /** - * The title color for the access level
    - */ + /** The title color for the access level. */ private int _titleColor = 0; - /** - * Flag to determine if the access level has gm access
    - */ + /** Flag to determine if the access level has GM access. */ private boolean _isGm = false; /** Flag for peace zone attack */ private boolean _allowPeaceAttack = false; diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java index b303750a48..13aef855d1 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java @@ -219,7 +219,7 @@ public class L2Clan implements IIdentifiable, INamable */ public int getLeaderId() { - return (_leader != null ? _leader.getObjectId() : 0); + return _leader != null ? _leader.getObjectId() : 0; } /** @@ -261,7 +261,6 @@ public class L2Clan implements IIdentifiable, INamable } exLeader.getClanPrivileges().clear(); exLeader.broadcastUserInfo(); - } else { @@ -378,6 +377,7 @@ public class L2Clan implements IIdentifiable, INamable player.setPledgeClass(L2ClanMember.calculatePledgeClass(player)); player.sendPacket(new PledgeShowMemberListUpdate(player)); player.sendPacket(new PledgeSkillList(this)); + addSkillEffects(player); // Notify to scripts @@ -1334,7 +1334,6 @@ public class L2Clan implements IIdentifiable, INamable Skill oldSkill = null; if (newSkill != null) { - if (subType == -2) { oldSkill = _skills.put(newSkill.getId(), newSkill); @@ -1793,12 +1792,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final SubPledge getSubPledge(int pledgeType) { - if (_subPledges == null) - { - return null; - } - - return _subPledges.get(pledgeType); + return _subPledges == null ? null : _subPledges.get(pledgeType); } /** @@ -1999,21 +1993,15 @@ public class L2Clan implements IIdentifiable, INamable public void initializePrivs() { - RankPrivs privs; for (int i = 1; i < 10; i++) { - privs = new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false)); - _privs.put(i, privs); + _privs.put(i, new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false))); } } public EnumIntBitmask getRankPrivs(int rank) { - if (_privs.get(rank) != null) - { - return _privs.get(rank).getPrivs(); - } - return new EnumIntBitmask<>(ClanPrivilege.class, false); + return _privs.get(rank) != null ? _privs.get(rank).getPrivs() : new EnumIntBitmask<>(ClanPrivilege.class, false); } public void setRankPrivs(int rank, int privs) @@ -2080,12 +2068,7 @@ public class L2Clan implements IIdentifiable, INamable */ public final RankPrivs[] getAllRankPrivs() { - if (_privs == null) - { - return new RankPrivs[0]; - } - - return _privs.values().toArray(new RankPrivs[_privs.values().size()]); + return _privs == null ? new RankPrivs[0] : _privs.values().toArray(new RankPrivs[_privs.values().size()]); } public int getLeaderSubPledge(int leaderId) @@ -2417,13 +2400,10 @@ public class L2Clan implements IIdentifiable, INamable player.sendPacket(SystemMessageId.TO_CREATE_AN_ALLIANCE_YOUR_CLAN_MUST_BE_LEVEL_5_OR_HIGHER); return; } - if (getAllyPenaltyExpiryTime() > System.currentTimeMillis()) + if ((getAllyPenaltyExpiryTime() > System.currentTimeMillis()) && (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY)) { - if (getAllyPenaltyType() == L2Clan.PENALTY_TYPE_DISSOLVE_ALLY) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); - return; - } + player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION); + return; } if (getDissolvingExpiryTime() > System.currentTimeMillis()) { diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2ClanMember.java index daef76108a..7f0fa86028 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2ClanMember.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2ClanMember.java @@ -151,8 +151,8 @@ public class L2ClanMember } /** - * Checks if is online. - * @return true, if is online + * Verifies if the clan member is online. + * @return {@code true} if is online */ public boolean isOnline() { @@ -263,11 +263,7 @@ public class L2ClanMember */ public int getPowerGrade() { - if (_player != null) - { - return _player.getPowerGrade(); - } - return _powerGrade; + return _player != null ? _player.getPowerGrade() : _powerGrade; } /** @@ -323,11 +319,7 @@ public class L2ClanMember */ public int getRaceOrdinal() { - if (_player != null) - { - return _player.getRace().ordinal(); - } - return _raceOrdinal; + return _player != null ? _player.getRace().ordinal() : _raceOrdinal; } /** @@ -336,11 +328,7 @@ public class L2ClanMember */ public boolean getSex() { - if (_player != null) - { - return _player.getAppearance().getSex(); - } - return _sex; + return _player != null ? _player.getAppearance().getSex() : _sex; } /** @@ -349,11 +337,7 @@ public class L2ClanMember */ public int getSponsor() { - if (_player != null) - { - return _player.getSponsor(); - } - return _sponsor; + return _player != null ? _player.getSponsor() : _sponsor; } /** @@ -362,11 +346,7 @@ public class L2ClanMember */ public int getApprentice() { - if (_player != null) - { - return _player.getApprentice(); - } - return _apprentice; + return _player != null ? _player.getApprentice() : _apprentice; } /** diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2CommandChannel.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2CommandChannel.java index bb1b4b57c4..d91e7e0554 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2CommandChannel.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2CommandChannel.java @@ -37,7 +37,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; public class L2CommandChannel extends AbstractPlayerGroup { private final List _parties = new CopyOnWriteArrayList<>(); - private L2PcInstance _commandLeader = null; + private L2PcInstance _commandLeader; private int _channelLvl; /** diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java index 09025eeed1..f485978cf6 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2GroupSpawn.java @@ -68,19 +68,11 @@ public class L2GroupSpawn extends L2Spawn final L2Npc mob = new L2ControllableMobInstance(_template); mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp()); - if (getHeading() == -1) - { - mob.setHeading(Rnd.nextInt(61794)); - } - else - { - mob.setHeading(getHeading()); - } + mob.setHeading(getHeading() == -1 ? Rnd.nextInt(61794) : getHeading()); mob.setSpawn(this); mob.spawnMe(newlocx, newlocy, newlocz); return mob; - } catch (Exception e) { diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java index 7875bdbb6a..905a58c1b8 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2NpcWalkerNode.java @@ -35,7 +35,7 @@ public class L2NpcWalkerNode extends Location _delay = delay; _runToLocation = runToLocation; _npcString = npcString; - _chatString = ((chatText == null) ? "" : chatText); + _chatString = (chatText == null) ? "" : chatText; } public int getDelay() diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Object.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Object.java index 9164db110c..171ad1e543 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Object.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Object.java @@ -782,7 +782,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared) { final double distance = Math.pow(x - getX(), 2) + Math.pow(y - getY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0); - return (squared) ? distance : Math.sqrt(distance); + return squared ? distance : Math.sqrt(distance); } /** @@ -898,12 +898,12 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab @Override public boolean equals(Object obj) { - return ((obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId())); + return (obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId()); } @Override public String toString() { - return (getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"); + return getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]"; } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java index 469b9843cc..c0fad148f8 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2RecipeInstance.java @@ -53,5 +53,4 @@ public class L2RecipeInstance { return _quantity; } - } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java index ae06fa8c1b..c22321462d 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2RecipeStatInstance.java @@ -55,5 +55,4 @@ public class L2RecipeStatInstance { return _value; } - } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Territory.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Territory.java index 5152d69c0d..41cb26df2b 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Territory.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2Territory.java @@ -16,8 +16,8 @@ */ package com.l2jmobius.gameserver.model; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Logger; import com.l2jmobius.commons.util.Rnd; @@ -44,7 +44,7 @@ public class L2Territory } } - private final List _points = new ArrayList<>(); + private final List _points = new CopyOnWriteArrayList<>(); private final int _terr; private int _xMin; private int _xMax; @@ -96,14 +96,6 @@ public class L2Territory _procMax += proc; } - public void print() - { - for (Point p : _points) - { - _log.info("(" + p._x + "," + p._y + ")"); - } - } - public boolean isIntersect(int x, int y, Point p1, Point p2) { final double dy1 = p1._y - y; @@ -163,7 +155,6 @@ public class L2Territory return new Location(p1._x, p1._y, Rnd.get(p1._zmin, p1._zmax)); } } - } for (int i = 0; i < 100; i++) { diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2World.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2World.java index 805e0c0ed2..9b02364b07 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2World.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2World.java @@ -282,20 +282,20 @@ public final class L2World } /** - * Add a L2Object in the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Add a L2Object in the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Add the L2Object object in _allPlayers* of L2World
  • *
  • Add the L2Object object in _gmList** of GmListTable
  • - *
  • Add object in _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding PlayerInstance in its _knownPlayer

  • - * * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of WorldRegion (need synchronisation)
    + *
  • Add object in _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, add all surrounding L2Object in its _knownObjects and all surrounding L2PcInstance in its _knownPlayer

  • + * * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Caution : This method DOESN'T ADD the object in _visibleObjects and _allPlayers* of L2WorldRegion (need synchronisation)
    * Caution : This method DOESN'T ADD the object to _allObjects and _allPlayers* of L2World (need synchronisation) Example of use : *
  • Drop an Item
  • *
  • Spawn a L2Character
  • - *
  • Apply Death Penalty of a PlayerInstance
  • + *
  • Apply Death Penalty of a L2PcInstance
  • * @param object L2object to add in the world - * @param newRegion WorldRegion in wich the object will be add (not used) + * @param newRegion L2WorldRegion in wich the object will be add (not used) */ public void addVisibleObject(L2Object object, L2WorldRegion newRegion) { @@ -371,18 +371,18 @@ public final class L2World } /** - * Remove a L2Object from the world. Concept : L2Object (including PlayerInstance) are identified in _visibleObjects of his current WorldRegion and in _knownObjects of other surrounding L2Characters
    - * PlayerInstance are identified in _allPlayers of L2World, in _allPlayers of his current WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : + * Remove a L2Object from the world. Concept : L2Object (including L2PcInstance) are identified in _visibleObjects of his current L2WorldRegion and in _knownObjects of other surrounding L2Characters
    + * L2PcInstance are identified in _allPlayers of L2World, in _allPlayers of his current L2WorldRegion and in _knownPlayer of other surrounding L2Characters Actions : *
  • Remove the L2Object object from _allPlayers* of L2World
  • - *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of WorldRegion
  • + *
  • Remove the L2Object object from _visibleObjects and _allPlayers* of L2WorldRegion
  • *
  • Remove the L2Object object from _gmList** of GmListTable
  • - *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding WorldRegion L2Characters

  • - *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all PlayerInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a PlayerInstance
    - * ** only if object is a GM PlayerInstance Example of use : + *
  • Remove object from _knownObjects and _knownPlayer* of all surrounding L2WorldRegion L2Characters

  • + *
  • If object is a L2Character, remove all L2Object from its _knownObjects and all L2PcInstance from its _knownPlayer
  • Caution : This method DOESN'T REMOVE the object from _allObjects of L2World * only if object is a L2PcInstance
    + * ** only if object is a GM L2PcInstance Example of use : *
  • Pickup an Item
  • *
  • Decay a L2Character
  • * @param object L2object to remove from the world - * @param oldRegion WorldRegion in which the object was before removing + * @param oldRegion L2WorldRegion in which the object was before removing */ public void removeVisibleObject(L2Object object, L2WorldRegion oldRegion) { @@ -395,7 +395,7 @@ public final class L2World { oldRegion.removeVisibleObject(object); - // Go through all surrounding WorldRegion Creatures + // Go through all surrounding L2WorldRegion L2Characters oldRegion.forEachSurroundingRegion(w -> { for (L2Object wo : w.getVisibleObjects().values()) @@ -714,7 +714,7 @@ public final class L2World } /** - * Calculate the current WorldRegions of the object according to its position (x,y). Example of use : + * Calculate the current L2WorldRegions of the object according to its position (x,y). Example of use : *
  • Set position of a new L2Object (drop, spawn...)
  • *
  • Update position of a L2Object after a movement

  • * @param point position of the object @@ -749,12 +749,12 @@ public final class L2World } /** - * Check if the current WorldRegions of the object is valid according to its position (x,y). Example of use : - *
  • Init WorldRegions

  • + * Check if the current L2WorldRegions of the object is valid according to its position (x,y). Example of use : + *
  • Init L2WorldRegions

  • * @param x X position of the object * @param y Y position of the object * @param z Z position of the object - * @return True if the WorldRegion is valid + * @return True if the L2WorldRegion is valid */ public static boolean validRegion(int x, int y, int z) { diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2WorldRegion.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2WorldRegion.java index 6bfaf3a33d..97608b326d 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2WorldRegion.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/L2WorldRegion.java @@ -136,7 +136,6 @@ public final class L2WorldRegion } LOGGER.finer(c + " mobs were turned on"); } - } public boolean isActive() diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/MobGroup.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/MobGroup.java index 88cc4a5599..4eb38cf27b 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/MobGroup.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/MobGroup.java @@ -191,8 +191,7 @@ public final class MobGroup final int y = player.getY() + Rnd.nextInt(50); mobInst.teleToLocation(new Location(x, y, player.getZ()), true); - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(player); + ((L2ControllableMobAI) mobInst.getAI()).follow(player); } } } @@ -294,8 +293,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.forceAttack(target); + ((L2ControllableMobAI) mobInst.getAI()).forceAttack(target); } } @@ -310,8 +308,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.stop(); + ((L2ControllableMobAI) mobInst.getAI()).stop(); } } @@ -347,8 +344,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.follow(character); + ((L2ControllableMobAI) mobInst.getAI()).follow(character); } } @@ -363,8 +359,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setAlternateAI(L2ControllableMobAI.AI_CAST); + ((L2ControllableMobAI) mobInst.getAI()).setAlternateAI(L2ControllableMobAI.AI_CAST); } } @@ -379,8 +374,7 @@ public final class MobGroup continue; } - final L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI(); - ai.setNotMoving(enabled); + ((L2ControllableMobAI) mobInst.getAI()).setNotMoving(enabled); } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/MobGroupTable.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/MobGroupTable.java index db0a789765..da1b620a40 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/MobGroupTable.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/MobGroupTable.java @@ -75,7 +75,7 @@ public class MobGroupTable public boolean removeGroup(int groupKey) { - return (_groupMap.remove(groupKey) != null); + return _groupMap.remove(groupKey) != null; } private static class SingletonHolder diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/Petition.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/Petition.java index 8596c3ea61..cbed80441a 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/Petition.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/Petition.java @@ -98,7 +98,7 @@ public final class Petition } PetitionManager.getInstance().getCompletedPetitions().put(getId(), this); - return (PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null); + return PetitionManager.getInstance().getPendingPetitions().remove(getId()) != null; } public String getContent() diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/ShortCuts.java index 2bbf25dee0..3f8d959ef6 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/ShortCuts.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/ShortCuts.java @@ -55,13 +55,10 @@ public class ShortCuts implements IRestorable { Shortcut sc = _shortCuts.get(slot + (page * MAX_SHORTCUTS_PER_BAR)); // Verify shortcut - if ((sc != null) && (sc.getType() == ShortcutType.ITEM)) + if ((sc != null) && (sc.getType() == ShortcutType.ITEM) && (_owner.getInventory().getItemByObjectId(sc.getId()) == null)) { - if (_owner.getInventory().getItemByObjectId(sc.getId()) == null) - { - deleteShortCut(sc.getSlot(), sc.getPage()); - sc = null; - } + deleteShortCut(sc.getSlot(), sc.getPage()); + sc = null; } return sc; } @@ -78,8 +75,7 @@ public class ShortCuts implements IRestorable } shortcut.setSharedReuseGroup(item.getSharedReuseGroup()); } - final Shortcut oldShortCut = _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut); - registerShortCutInDb(shortcut, oldShortCut); + registerShortCutInDb(shortcut, _shortCuts.put(shortcut.getSlot() + (shortcut.getPage() * MAX_SHORTCUTS_PER_BAR), shortcut)); } private void registerShortCutInDb(Shortcut shortcut, Shortcut oldShortCut) diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java index d77bf6af86..6892d0798a 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/BlockCheckerEngine.java @@ -454,21 +454,18 @@ public final class BlockCheckerEngine switch (_round) { - case 1: + case 1: // Schedule second spawn round { - // Schedule second spawn round _task = ThreadPool.schedule(new SpawnRound(20, 2), 60000); break; } - case 2: + case 2: // Schedule third spawn round { - // Schedule third spawn round _task = ThreadPool.schedule(new SpawnRound(14, 3), 60000); break; } - case 3: + case 3: // Schedule Event End Count Down { - // Schedule Event End Count Down _task = ThreadPool.schedule(new EndEvent(), 180000); break; } @@ -572,7 +569,7 @@ public final class BlockCheckerEngine /* * private class CountDown implements Runnable { - * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_WILL_END_IN_5_SECONDS)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } + * @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.schedule(new EndEvent(), 5000); } } */ /** @@ -652,7 +649,7 @@ public final class BlockCheckerEngine } /** - * Reward the speicifed team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra + * Reward the specified team as a winner team 1) Higher score - 8 extra 2) Higher score - 5 extra * @param isRed */ private void rewardAsWinner(boolean isRed) @@ -714,8 +711,7 @@ public final class BlockCheckerEngine */ private void rewardAsLooser(boolean isRed) { - final Map tempPoints = isRed ? _redTeamPoints : _blueTeamPoints; - for (Entry entry : tempPoints.entrySet()) + for (Entry entry : (isRed ? _redTeamPoints : _blueTeamPoints).entrySet()) { final L2PcInstance player = entry.getKey(); if ((player != null) && (entry.getValue() >= 10)) @@ -726,7 +722,7 @@ public final class BlockCheckerEngine } /** - * Telport players back, give status back and send final packet + * Teleport players back, give status back and send final packet */ private void setPlayersBack() { @@ -748,13 +744,11 @@ public final class BlockCheckerEngine final PcInventory inv = player.getInventory(); if (inv.getItemByItemId(13787) != null) { - final long count = inv.getInventoryItemCount(13787, 0); - inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13787, inv.getInventoryItemCount(13787, 0), player, player); } if (inv.getItemByItemId(13788) != null) { - final long count = inv.getInventoryItemCount(13788, 0); - inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player); + inv.destroyItemByItemId("Handys Block Checker", 13788, inv.getInventoryItemCount(13788, 0), player, player); } broadcastRelationChanged(player); // Teleport Back diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/Couple.java index 7901689adf..c31232e232 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/Couple.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/Couple.java @@ -99,7 +99,7 @@ public class Couple } catch (Exception e) { - _log.log(Level.SEVERE, "Could not create couple:", e); + _log.log(Level.SEVERE, "Could not create couple: " + e.getMessage(), e); } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java index e9b3160a50..75ec9236b8 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java @@ -192,12 +192,7 @@ public final class Fort extends AbstractResidence } if ((getOwnerClan().getWarehouse().getAdena() >= _fee) || !_cwh) { - int fee = _fee; - if (getEndTime() == -1) - { - fee = _tempFee; - } - + final int fee = getEndTime() == -1 ? _tempFee : _fee; setEndTime(System.currentTimeMillis() + getRate()); dbSave(); if (_cwh) @@ -549,7 +544,6 @@ public final class Fort extends AbstractResidence if (door != null) { door.setCurrentHp(door.getMaxHp() + hp); - saveDoorUpgrade(doorId, hp, pDef, mDef); } } @@ -589,7 +583,7 @@ public final class Fort extends AbstractResidence long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis(); while (initial > (Config.FS_UPDATE_FRQ * 60000L)) { - initial -= (Config.FS_UPDATE_FRQ * 60000L); + initial -= Config.FS_UPDATE_FRQ * 60000L; } initial = (Config.FS_UPDATE_FRQ * 60000L) - initial; if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600))) @@ -609,7 +603,6 @@ public final class Fort extends AbstractResidence { setOwnerClan(null); } - } catch (Exception e) { @@ -675,12 +668,9 @@ public final class Fort extends AbstractResidence { return false; } - if (lease > 0) + if ((lease > 0) && !player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) { - if (!player.destroyItemByItemId("Consume", Inventory.ADENA_ID, lease, null, true)) - { - return false; - } + return false; } if (addNew) { @@ -690,20 +680,16 @@ public final class Fort extends AbstractResidence { removeFunction(type); } + else if ((lease - _function.get(type).getLease()) > 0) + { + _function.remove(type); + _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); + } else { - final int diffLease = lease - _function.get(type).getLease(); - if (diffLease > 0) - { - _function.remove(type); - _function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false)); - } - else - { - _function.get(type).setLease(lease); - _function.get(type).setLvl(lvl); - _function.get(type).dbSave(); - } + _function.get(type).setLease(lease); + _function.get(type).setLvl(lvl); + _function.get(type).dbSave(); } return true; } @@ -934,31 +920,17 @@ public final class Fort extends AbstractResidence public final int getOwnedTime() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000); } public final int getTimeTillRebelArmy() { - if (_lastOwnedTime.getTimeInMillis() == 0) - { - return 0; - } - - return (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); + return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); } public final long getTimeTillNextFortUpdate() { - if (_FortUpdater[0] == null) - { - return 0; - } - return _FortUpdater[0].getDelay(TimeUnit.SECONDS); + return _FortUpdater[0] == null ? 0 : _FortUpdater[0].getDelay(TimeUnit.SECONDS); } public void updateClansReputation(L2Clan owner, boolean removePoints) @@ -999,7 +971,6 @@ public final class Fort extends AbstractResidence _log.log(Level.WARNING, "Exception in endFortressSiege " + e.getMessage(), e); } } - } /** diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/L2Event.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/L2Event.java index ad93bd97a4..be28d47897 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/L2Event.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/entity/L2Event.java @@ -46,7 +46,8 @@ import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse; import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; /** - * @since $Revision: 1.3.4.1 $ $Date: 2005/03/27 15:29:32 $ This ancient thingie got reworked by Nik at $Date: 2011/05/17 21:51:39 $ Yeah, for 6 years no one bothered reworking this buggy event engine. + * @author Nik + * @Since 2011/05/17 21:51:39 */ public class L2Event { @@ -164,7 +165,6 @@ public class L2Event try { final L2Spawn spawn = new L2Spawn(_npcId); - spawn.setX(target.getX() + 50); spawn.setY(target.getY() + 50); spawn.setZ(target.getZ()); @@ -184,13 +184,11 @@ public class L2Event spawn.getLastSpawn().broadcastPacket(new MagicSkillUse(spawn.getLastSpawn(), spawn.getLastSpawn(), 1034, 1, 1, 1)); // _npcs.add(spawn.getLastSpawn()); - } catch (Exception e) { _log.log(Level.WARNING, "Exception on spawn(): " + e.getMessage(), e); } - } /** @@ -274,7 +272,6 @@ public class L2Event */ public static void removeAndResetPlayer(L2PcInstance player) { - try { if (isParticipant(player)) @@ -475,7 +472,6 @@ public class L2Event biggestLvlPlayer.setEventStatus(); i = (i + 1) % _teamsNumber; } - } catch (Exception e) { diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java index 64f1bd2117..08f8d8f701 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/holders/InstanceReenterTimeHolder.java @@ -30,7 +30,7 @@ public final class InstanceReenterTimeHolder private int _minute = -1; private long _time = -1; - public InstanceReenterTimeHolder(int time) + public InstanceReenterTimeHolder(long time) { _time = TimeUnit.MINUTES.toMillis(time); } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java index ee59be43a2..03514cc06f 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/interfaces/IParserAdvUtils.java @@ -45,5 +45,4 @@ public interface IParserAdvUtils extends IParserUtils Duration getDuration(String key); > T getEnum(String key, Class clazz); - } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java index 3930368188..f97917af4f 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/ClanWarehouse.java @@ -62,7 +62,7 @@ public final class ClanWarehouse extends Warehouse @Override public boolean validateCapacity(long slots) { - return ((_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN); + return (_items.size() + slots) <= Config.WAREHOUSE_SLOTS_CLAN; } @Override diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java index a3e5358978..076cfe435a 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java @@ -1806,7 +1806,7 @@ public final class L2ItemInstance extends L2Object public boolean isTimeLimitedItem() { - return (_time > 0); + return _time > 0; } /** diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java index a4d6c7d9db..2d9fc312b0 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/items/type/MaterialType.java @@ -49,5 +49,5 @@ public enum MaterialType FISH, RUNE_XP, RUNE_SP, - RUNE_REMOVE_PENALTY + RUNE_REMOVE_PENALTY; } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/quest/Quest.java index 829a045a0e..0c8a3b044b 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/quest/Quest.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/quest/Quest.java @@ -155,7 +155,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ protected void onLoad() { - } /** @@ -166,7 +165,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onSave() { - } /** @@ -1056,7 +1054,7 @@ public class Quest extends AbstractScript implements IIdentifiable */ public String onDeath(L2Character killer, L2Character victim, QuestState qs) { - return onAdvEvent("", ((killer instanceof L2Npc) ? ((L2Npc) killer) : null), qs.getPlayer()); + return onAdvEvent("", (killer instanceof L2Npc) ? (L2Npc) killer : null, qs.getPlayer()); } /** @@ -1389,7 +1387,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadMatchFinish(Participant winner, Participant looser, CompetitionType type) { - } /** @@ -1399,7 +1396,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onOlympiadLose(L2PcInstance loser, CompetitionType type) { - } /** @@ -1408,7 +1404,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onMoveFinished(L2Npc npc) { - } /** @@ -1417,7 +1412,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onNodeArrived(L2Npc npc) { - } /** @@ -1426,7 +1420,6 @@ public class Quest extends AbstractScript implements IIdentifiable */ public void onRouteFinished(L2Npc npc) { - } /** @@ -2624,11 +2617,7 @@ public class Quest extends AbstractScript implements IIdentifiable } } } - if ((luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc)) - { - return luckyPlayer; - } - return null; + return (luckyPlayer != null) && checkDistanceToTarget(luckyPlayer, npc) ? luckyPlayer : null; } /** @@ -2663,15 +2652,7 @@ public class Quest extends AbstractScript implements IIdentifiable QuestState qs = player.getQuestState(getName()); if (!player.isInParty()) { - if (!checkPartyMemberConditions(qs, condition, target)) - { - return null; - } - if (!checkDistanceToTarget(player, target)) - { - return null; - } - return qs; + return !checkPartyMemberConditions(qs, condition, target) || !checkDistanceToTarget(player, target) ? null : qs; } final List candidates = new ArrayList<>(); @@ -2703,21 +2684,17 @@ public class Quest extends AbstractScript implements IIdentifiable } qs = candidates.get(getRandom(candidates.size())); - if (!checkDistanceToTarget(qs.getPlayer(), target)) - { - return null; - } - return qs; + return !checkDistanceToTarget(qs.getPlayer(), target) ? null : qs; } private boolean checkPartyMemberConditions(QuestState qs, int condition, L2Npc npc) { - return ((qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc)); + return (qs != null) && ((condition == -1) ? qs.isStarted() : qs.isCond(condition)) && checkPartyMember(qs, npc); } private static boolean checkDistanceToTarget(L2PcInstance player, L2Npc target) { - return ((target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true)); + return (target == null) || com.l2jmobius.gameserver.util.Util.checkIfInRange(1500, player, target, true); } /** diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/quest/QuestState.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/quest/QuestState.java index abf9825d8e..23c0acc8d1 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/quest/QuestState.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/quest/QuestState.java @@ -114,7 +114,7 @@ public final class QuestState */ public boolean isCreated() { - return (_state == State.CREATED); + return _state == State.CREATED; } /** @@ -123,7 +123,7 @@ public final class QuestState */ public boolean isStarted() { - return (_state == State.STARTED); + return _state == State.STARTED; } /** @@ -132,7 +132,7 @@ public final class QuestState */ public boolean isCompleted() { - return (_state == State.COMPLETED); + return _state == State.COMPLETED; } /** @@ -340,10 +340,10 @@ public final class QuestState // since no flag had been skipped until now, the least significant bits must all // be set to 1, up until "old" number of bits. - completedStateFlags |= ((1 << old) - 1); + completedStateFlags |= (1 << old) - 1; // now, just set the bit corresponding to the passed cond to 1 (current step) - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } } @@ -352,7 +352,7 @@ public final class QuestState else if (cond < old) { // note, this also unsets the flag indicating that there exist skips - completedStateFlags &= ((1 << cond) - 1); + completedStateFlags &= (1 << cond) - 1; // now, check if this resulted in no steps being skipped any more if (completedStateFlags == ((1 << cond) - 1)) @@ -372,7 +372,7 @@ public final class QuestState // Just mark this state and we are done. else { - completedStateFlags |= (1 << (cond - 1)); + completedStateFlags |= 1 << (cond - 1); set("__compltdStateFlags", String.valueOf(completedStateFlags)); } @@ -463,7 +463,7 @@ public final class QuestState */ public boolean isCond(int condition) { - return (getInt("cond") == condition); + return getInt("cond") == condition; } /** @@ -523,7 +523,7 @@ public final class QuestState */ public boolean isSet(String variable) { - return (get(variable) != null); + return get(variable) != null; } /** @@ -578,7 +578,7 @@ public final class QuestState public boolean isMemoState(int memoState) { - return (getInt("memoState") == memoState); + return getInt("memoState") == memoState; } /** @@ -823,7 +823,7 @@ public final class QuestState public boolean isNowAvailable() { final String val = get("restartTime"); - return (val != null) && (!Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis())); + return (val == null) || !Util.isDigit(val) || (Long.parseLong(val) <= System.currentTimeMillis()); } public void setSimulated(boolean simulated) diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/stats/TraitType.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/stats/TraitType.java index e7a799703d..890e7b48b8 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/stats/TraitType.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/stats/TraitType.java @@ -83,7 +83,7 @@ public enum TraitType { _type = type; } - + public int getType() { return _type; diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java index 4433e97b28..f431bdab71 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneCuboid.java @@ -49,13 +49,13 @@ public class ZoneCuboid extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_r.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _r.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _r.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -65,9 +65,9 @@ public class ZoneCuboid extends L2ZoneForm final int _x2 = _r.x + _r.width; final int _y1 = _r.y; final int _y2 = _r.y + _r.height; - double test, shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); + double test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); + double shortestDist = Math.pow(_x1 - x, 2) + Math.pow(_y1 - y, 2); - test = Math.pow(_x1 - x, 2) + Math.pow(_y2 - y, 2); if (test < shortestDist) { shortestDist = test; diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java index afdfd3fade..5f3b143379 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneCylinder.java @@ -43,11 +43,7 @@ public class ZoneCylinder extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - if (((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) > _radS) || (z < _z1) || (z > _z2)) - { - return false; - } - return true; + return ((Math.pow(_x - x, 2) + Math.pow(_y - y, 2)) <= _radS) && (z >= _z1) && (z <= _z2); } @Override @@ -130,9 +126,7 @@ public class ZoneCylinder extends L2ZoneForm final double angle = (2 * Math.PI) / count; for (int i = 0; i < count; i++) { - final int x = (int) (Math.cos(angle * i) * _rad); - final int y = (int) (Math.sin(angle * i) * _rad); - dropDebugItem(Inventory.ADENA_ID, 1, _x + x, _y + y, z); + dropDebugItem(Inventory.ADENA_ID, 1, _x + (int) (Math.cos(angle * i) * _rad), _y + (int) (Math.sin(angle * i) * _rad), z); } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java index 2340c1b218..d1ef507961 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/form/ZoneNPoly.java @@ -51,13 +51,13 @@ public class ZoneNPoly extends L2ZoneForm @Override public boolean isInsideZone(int x, int y, int z) { - return (_p.contains(x, y) && (z >= _z1) && (z <= _z2)); + return _p.contains(x, y) && (z >= _z1) && (z <= _z2); } @Override public boolean intersectsRectangle(int ax1, int ax2, int ay1, int ay2) { - return (_p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1))); + return _p.intersects(Math.min(ax1, ax2), Math.min(ay1, ay2), Math.abs(ax2 - ax1), Math.abs(ay2 - ay1)); } @Override @@ -95,25 +95,15 @@ public class ZoneNPoly extends L2ZoneForm @Override public void visualizeZone(int z) { - final int[] _x = _p.xpoints; - final int[] _y = _p.ypoints; - for (int i = 0; i < _p.npoints; i++) { - int nextIndex = i + 1; - // ending point to first one - if (nextIndex == _x.length) - { - nextIndex = 0; - } - final int vx = _x[nextIndex] - _x[i]; - final int vy = _y[nextIndex] - _y[i]; - float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)); - lenght /= STEP; + final int nextIndex = (i + 1) == _p.xpoints.length ? 0 : i + 1; + final int vx = _p.xpoints[nextIndex] - _p.xpoints[i]; + final int vy = _p.ypoints[nextIndex] - _p.ypoints[i]; + final float lenght = (float) Math.sqrt((vx * vx) + (vy * vy)) / STEP; for (int o = 1; o <= lenght; o++) { - final float k = o / lenght; - dropDebugItem(Inventory.ADENA_ID, 1, (int) (_x[i] + (k * vx)), (int) (_y[i] + (k * vy)), z); + dropDebugItem(Inventory.ADENA_ID, 1, (int) (_p.xpoints[i] + ((o / lenght) * vx)), (int) (_p.ypoints[i] + ((o / lenght) * vy)), z); } } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java index 09ea4b531a..904a7f2919 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2CastleZone.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public final class L2CastleZone extends L2ResidenceZone { - public L2CastleZone(int id) { super(id); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java index ec9a75b975..a1a99b7051 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2NoRestartZone.java @@ -99,7 +99,7 @@ public class L2NoRestartZone extends L2ZoneType return; } - if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.getInstance().getStartedTime()) > getRestartAllowedTime())) + if (((System.currentTimeMillis() - player.getLastAccess()) > getRestartTime()) && ((System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis()) > getRestartAllowedTime())) { player.teleToLocation(TeleportWhereType.TOWN); } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java index 45e377e22a..b3b1c77f42 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2NoSummonFriendZone.java @@ -26,7 +26,6 @@ import com.l2jmobius.gameserver.model.zone.ZoneId; */ public class L2NoSummonFriendZone extends L2ZoneType { - public L2NoSummonFriendZone(int id) { super(id); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java index cb7760aee0..9ab43dd1cd 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/zone/type/L2ResidenceHallTeleportZone.java @@ -71,12 +71,7 @@ public class L2ResidenceHallTeleportZone extends L2ResidenceTeleportZone @Override public void run() { - int index = 0; - if (getSpawns().size() > 1) - { - index = Rnd.get(getSpawns().size()); - } - + final int index = getSpawns().size() > 1 ? Rnd.get(getSpawns().size()) : 0; final Location loc = getSpawns().get(index); if (loc == null) { diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java index e63f1883f1..46037463d5 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/BlowFishKeygen.java @@ -26,7 +26,6 @@ public class BlowFishKeygen { private static final int CRYPT_KEYS_SIZE = 20; private static final byte[][] CRYPT_KEYS = new byte[CRYPT_KEYS_SIZE][16]; - static { // init the GS encryption keys on class load @@ -54,7 +53,6 @@ public class BlowFishKeygen // block instantiation private BlowFishKeygen() { - } /** diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/IncomingPackets.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/IncomingPackets.java index 98362130f8..85b3fad9fd 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/IncomingPackets.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/IncomingPackets.java @@ -208,7 +208,6 @@ public enum IncomingPackets implements IIncomingPackets EX_PACKET(0xD0, ExPacket::new, ConnectionState.values()); // This packet has its own connection state checking so we allow all of them public static final IncomingPackets[] PACKET_ARRAY; - static { final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java index 8681078d71..cf476ab880 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/game/AuthRequest.java @@ -56,5 +56,4 @@ public class AuthRequest extends BaseSendablePacket { return getBytes(); } - } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java index 69264263b4..2603512fdf 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/game/ReplyCharacters.java @@ -25,7 +25,6 @@ import com.l2jmobius.commons.network.BaseSendablePacket; */ public class ReplyCharacters extends BaseSendablePacket { - public ReplyCharacters(String account, int chars, List timeToDel) { writeC(0x08); @@ -43,5 +42,4 @@ public class ReplyCharacters extends BaseSendablePacket { return getBytes(); } - } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java index 113caaea70..ed3375e8d2 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/AuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class AuthResponse extends BaseRecievePacket { - private final int _serverId; private final String _serverName; @@ -52,5 +51,4 @@ public class AuthResponse extends BaseRecievePacket { return _serverName; } - } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java index 6945db648c..721ff58f8e 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/ChangePasswordResponse.java @@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; public class ChangePasswordResponse extends BaseRecievePacket { - public ChangePasswordResponse(byte[] decrypt) { super(decrypt); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java index d937c4762e..6f43b2976d 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/InitLS.java @@ -43,5 +43,4 @@ public class InitLS extends BaseRecievePacket final int size = readD(); _key = readB(size); } - } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java index fe2c0b2d88..bbf888d495 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/KickPlayer.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class KickPlayer extends BaseRecievePacket { - private final String _account; /** @@ -39,5 +38,4 @@ public class KickPlayer extends BaseRecievePacket { return _account; } - } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java index f50e7a95e6..ae76f77fb7 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/LoginServerFail.java @@ -20,7 +20,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; public class LoginServerFail extends BaseRecievePacket { - private static final String[] REASONS = { "None", @@ -52,5 +51,4 @@ public class LoginServerFail extends BaseRecievePacket { return _reason; } - } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java index a87742fab7..c747b9bb56 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/loginserverpackets/login/PlayerAuthResponse.java @@ -23,7 +23,6 @@ import com.l2jmobius.commons.network.BaseRecievePacket; */ public class PlayerAuthResponse extends BaseRecievePacket { - private final String _account; private final boolean _authed; @@ -35,7 +34,7 @@ public class PlayerAuthResponse extends BaseRecievePacket super(decrypt); _account = readS(); - _authed = (readC() != 0); + _authed = readC() != 0; } /** @@ -53,5 +52,4 @@ public class PlayerAuthResponse extends BaseRecievePacket { return _authed; } - } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/DateRange.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/DateRange.java index e825d08b90..3b8acae352 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/DateRange.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/DateRange.java @@ -43,10 +43,7 @@ public class DateRange { try { - final Date start = format.parse(date[0]); - final Date end = format.parse(date[1]); - - return new DateRange(start, end); + return new DateRange(format.parse(date[0]), format.parse(date[1])); } catch (ParseException e) { @@ -63,7 +60,8 @@ public class DateRange public boolean isWithinRange(Date date) { - return date.after(_startDate) && date.before(_endDate); + return (date.equals(_startDate) || date.after(_startDate)) // + && (date.equals(_endDate) || date.before(_endDate)); } public Date getEndDate() diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/ScriptDocument.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/ScriptDocument.java index 00b292822c..eacfe5baf8 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/ScriptDocument.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/ScriptDocument.java @@ -63,7 +63,6 @@ public class ScriptDocument { // Parser with specified options can't be built _log.log(Level.WARNING, "", pce); - } catch (IOException ioe) { @@ -90,5 +89,4 @@ public class ScriptDocument { return _name; } - } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/ScriptEngine.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/ScriptEngine.java index 41525b111f..bdef90d7b6 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/ScriptEngine.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/script/ScriptEngine.java @@ -41,16 +41,16 @@ public class ScriptEngine s = parserFactories.get(name); if (s == null) // if the shape factory is not there even now { - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } catch (ClassNotFoundException e) { // We'll throw an exception to indicate that // the shape could not be created - throw (new ParserNotCreatedException()); + throw new ParserNotCreatedException(); } } - return (s.create()); + return s.create(); } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/taskmanager/Task.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/taskmanager/Task.java index ecbef18add..d76a02c101 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/taskmanager/Task.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/taskmanager/Task.java @@ -43,6 +43,5 @@ public abstract class Task public void onDestroy() { - } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java index 7f86a2bfb3..6b73502977 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java @@ -104,7 +104,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.warning("Cannot updated the Global Task " + id + ": " + e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Cannot updated the Global Task " + id + ": " + e.getMessage(), e); } if ((type == TYPE_SHEDULED) || (type == TYPE_TIME)) @@ -116,15 +116,7 @@ public final class TaskManager @Override public boolean equals(Object object) { - if (this == object) - { - return true; - } - if (!(object instanceof ExecutedTask)) - { - return false; - } - return id == ((ExecutedTask) object).id; + return (this == object) || ((object instanceof ExecutedTask) && (id == ((ExecutedTask) object).id)); } @Override @@ -169,7 +161,6 @@ public final class TaskManager _currentTasks.remove(this); } - } private void initializate() @@ -182,8 +173,7 @@ public final class TaskManager public void registerTask(Task task) { - final int key = task.getName().hashCode(); - _tasks.computeIfAbsent(key, k -> + _tasks.computeIfAbsent(task.getName().hashCode(), k -> { task.initializate(); return task; @@ -217,7 +207,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.SEVERE, "Error while loading Global Task table: ", e); + LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error while loading Global Task table: " + e.getMessage(), e); } } @@ -256,7 +246,7 @@ public final class TaskManager task.scheduled = ThreadPool.schedule(task, diff); return true; } - LOGGER.info("Task " + task.getId() + " is obsoleted."); + LOGGER.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted."); } catch (Exception e) { @@ -280,7 +270,7 @@ public final class TaskManager if (hour.length != 3) { - LOGGER.warning("Task " + task.getId() + " has incorrect parameters"); + LOGGER.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters"); return false; } @@ -296,7 +286,7 @@ public final class TaskManager } catch (Exception e) { - LOGGER.log(Level.WARNING, "Bad parameter on task " + task.getId() + ": ", e); + LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Bad parameter on task " + task.getId() + ": " + e.getMessage(), e); return false; } @@ -348,7 +338,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the unique task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the unique task: " + e.getMessage(), e); } return false; } @@ -374,7 +364,7 @@ public final class TaskManager } catch (SQLException e) { - LOGGER.log(Level.WARNING, "Cannot add the task: ", e); + LOGGER.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the task: " + e.getMessage(), e); } return false; } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java index e23716eba1..f005fca2ea 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/FloodProtectorAction.java @@ -94,7 +94,7 @@ public final class FloodProtectorAction if ((curTick < _nextGameTick) || _punishmentInProgress) { - if (_config.LOG_FLOODING && !_logged && (_log.getLevel() == Level.WARNING)) + if (_config.LOG_FLOODING && !_logged && _log.isLoggable(Level.WARNING)) { log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeController.MILLIS_IN_TICK), " ms after previous command"); _logged = true; @@ -124,12 +124,9 @@ public final class FloodProtectorAction return false; } - if (_count.get() > 0) + if ((_count.get() > 0) && _config.LOG_FLOODING && _log.isLoggable(Level.WARNING)) { - if (_config.LOG_FLOODING && (_log.getLevel() == Level.WARNING)) - { - log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); - } + log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms"); } _nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL; @@ -145,7 +142,7 @@ public final class FloodProtectorAction { Disconnection.of(_client).defaultSequence(false); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log("kicked for flooding"); } @@ -157,7 +154,7 @@ public final class FloodProtectorAction private void banAccount() { PunishmentManager.getInstance().startPunishment(new PunishmentTask(_client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - if (_log.getLevel() == Level.WARNING) + if (_log.isLoggable(Level.WARNING)) { log(" banned for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } @@ -168,18 +165,20 @@ public final class FloodProtectorAction */ private void jailChar() { - if (_client.getActiveChar() != null) + if (_client.getActiveChar() == null) { - final int charId = _client.getActiveChar().getObjectId(); - if (charId > 0) - { - PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); - } - - if (_log.getLevel() == Level.WARNING) - { - log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); - } + return; + } + + final int charId = _client.getActiveChar().getObjectId(); + if (charId > 0) + { + PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName())); + } + + if (_log.isLoggable(Level.WARNING)) + { + log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins"); } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/GMAudit.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/GMAudit.java index ab7aa87ed6..c2ee25069b 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/GMAudit.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/GMAudit.java @@ -32,7 +32,6 @@ import com.l2jmobius.Config; public class GMAudit { private static final Logger _log = Logger.getLogger(GMAudit.class.getName()); - static { new File("log/GMAudit").mkdirs(); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/LinePointIterator.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/LinePointIterator.java index 2208c5092d..168255fafd 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/LinePointIterator.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/LinePointIterator.java @@ -65,7 +65,7 @@ public final class LinePointIterator _first = false; return true; } - else if (_dx >= _dy) + if (_dx >= _dy) { if (_srcX != _dstX) { @@ -81,21 +81,18 @@ public final class LinePointIterator return true; } } - else + else if (_srcY != _dstY) { - if (_srcY != _dstY) + _srcY += _sy; + + _error += _dx; + if (_error >= _dy) { - _srcY += _sy; - - _error += _dx; - if (_error >= _dy) - { - _srcX += _sx; - _error -= _dy; - } - - return true; + _srcX += _sx; + _error -= _dy; } + + return true; } return false; diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java index 771bbb5fc7..c9dd0c3840 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/LinePointIterator3D.java @@ -75,7 +75,7 @@ public final class LinePointIterator3D _first = false; return true; } - else if ((_dx >= _dy) && (_dx >= _dz)) + if ((_dx >= _dy) && (_dx >= _dz)) { if (_srcX != _dstX) { @@ -121,28 +121,25 @@ public final class LinePointIterator3D return true; } } - else + else if (_srcZ != _dstZ) { - if (_srcZ != _dstZ) + _srcZ += _sz; + + _error += _dx; + if (_error >= _dz) { - _srcZ += _sz; - - _error += _dx; - if (_error >= _dz) - { - _srcX += _sx; - _error -= _dz; - } - - _error2 += _dy; - if (_error2 >= _dz) - { - _srcY += _sy; - _error2 -= _dz; - } - - return true; + _srcX += _sx; + _error -= _dz; } + + _error2 += _dy; + if (_error2 >= _dz) + { + _srcY += _sy; + _error2 -= _dz; + } + + return true; } return false; diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/PrimeFinder.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/PrimeFinder.java index a454fd5289..e032195067 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/PrimeFinder.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/util/PrimeFinder.java @@ -1,18 +1,13 @@ /* - * This file is part of the L2J Mobius project. + * Copyright (c) 1999 CERN - European Organization for Nuclear Research. * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear in + * supporting documentation. CERN makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without expressed or implied warranty. */ package com.l2jmobius.gameserver.util; @@ -331,7 +326,6 @@ public final class PrimeFinder 800076929, 1600153859 }; - static { // initializer // The above prime numbers are formatted for human readability.