Code style changes.

This commit is contained in:
MobiusDev
2016-04-26 19:21:19 +00:00
parent 6a13705766
commit fc070c9238
768 changed files with 3338 additions and 4252 deletions

View File

@ -281,7 +281,7 @@ public class AirShipManager
}
}
public static final AirShipManager getInstance()
public static AirShipManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -246,7 +246,7 @@ public final class AntiFeedManager
return Config.L2JMOD_DUALBOX_CHECK_WHITELIST.containsKey(addrHash) ? max + Config.L2JMOD_DUALBOX_CHECK_WHITELIST.get(addrHash) : max;
}
public static final AntiFeedManager getInstance()
public static AntiFeedManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -37,7 +37,7 @@ public class BoatManager
public static final int GLUDIN_HARBOR = 2;
public static final int RUNE_HARBOR = 3;
public static final BoatManager getInstance()
public static BoatManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -313,7 +313,7 @@ public final class CastleManager implements InstanceListManager
return count;
}
public static final CastleManager getInstance()
public static CastleManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -91,7 +91,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
{
_mode = ManorMode.MODIFIABLE;
}
else if ((hour == Config.ALT_MANOR_REFRESH_TIME) && ((min >= Config.ALT_MANOR_REFRESH_MIN) && (min < maintenanceMin)))
else if ((hour == Config.ALT_MANOR_REFRESH_TIME) && (min >= Config.ALT_MANOR_REFRESH_MIN) && (min < maintenanceMin))
{
_mode = ManorMode.MAINTENANCE;
}
@ -279,7 +279,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
}
}
// Schedule mode change
ThreadPoolManager.getInstance().scheduleGeneral(this::changeMode, (_nextModeChange.getTimeInMillis() - System.currentTimeMillis()));
ThreadPoolManager.getInstance().scheduleGeneral(this::changeMode, _nextModeChange.getTimeInMillis() - System.currentTimeMillis());
}
public final void changeMode()
@ -552,7 +552,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
public final List<SeedProduction> getSeedProduction(int castleId, boolean nextPeriod)
{
return (nextPeriod) ? _productionNext.get(castleId) : _production.get(castleId);
return nextPeriod ? _productionNext.get(castleId) : _production.get(castleId);
}
public final SeedProduction getSeedProduct(int castleId, int seedId, boolean nextPeriod)
@ -569,7 +569,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
public final List<CropProcure> getCropProcure(int castleId, boolean nextPeriod)
{
return (nextPeriod) ? _procureNext.get(castleId) : _procure.get(castleId);
return nextPeriod ? _procureNext.get(castleId) : _procure.get(castleId);
}
public final CropProcure getCropProcure(int castleId, int cropId, boolean nextPeriod)
@ -597,7 +597,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
}
for (CropProcure crop : procure)
{
total += (crop.getPrice() * crop.getStartAmount());
total += crop.getPrice() * crop.getStartAmount();
}
return total;
}
@ -813,7 +813,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
// -------------------------------------------------------
// Static methods
// -------------------------------------------------------
public static final CastleManorManager getInstance()
public static CastleManorManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -365,7 +365,7 @@ public class ClanEntryManager
sortBy = Util.constrain(sortBy, 1, CLAN_COMPARATOR.size() - 1);
//@formatter:off
return _clanList.values().stream()
.filter((p -> (((clanLevel < 0) && (karma >= 0) && (karma != p.getKarma())) || ((clanLevel >= 0) && (karma < 0) && (clanLevel != p.getClanLevel())) || ((clanLevel >= 0) && (karma >= 0) && ((clanLevel != p.getClanLevel()) || (karma != p.getKarma()))))))
.filter(p -> (((clanLevel < 0) && (karma >= 0) && (karma != p.getKarma())) || ((clanLevel >= 0) && (karma < 0) && (clanLevel != p.getClanLevel())) || ((clanLevel >= 0) && (karma >= 0) && ((clanLevel != p.getClanLevel()) || (karma != p.getKarma())))))
.sorted(descending ? CLAN_COMPARATOR.get(sortBy).reversed() : CLAN_COMPARATOR.get(sortBy))
.collect(Collectors.toList());
//@formatter:on

View File

@ -172,7 +172,7 @@ public final class ClanHallAuctionManager
}
}
public static final ClanHallAuctionManager getInstance()
public static ClanHallAuctionManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -109,7 +109,7 @@ public final class ClanHallManager
}
}
public static final Map<Integer, ClanHall> getAllClanHalls()
public static Map<Integer, ClanHall> getAllClanHalls()
{
return _allClanHalls;
}
@ -138,7 +138,7 @@ public final class ClanHallManager
return _allAuctionableClanHalls;
}
public static final void addClanHall(ClanHall hall)
public static void addClanHall(ClanHall hall)
{
_allClanHalls.put(hall.getId(), hall);
}

View File

@ -236,7 +236,7 @@ public final class CommissionManager
return;
}
final long registrationFee = (long) Math.max(MIN_REGISTRATION_AND_SALE_FEE, (totalPrice * REGISTRATION_FEE_PER_DAY) * durationInDays);
final long registrationFee = (long) Math.max(MIN_REGISTRATION_AND_SALE_FEE, totalPrice * REGISTRATION_FEE_PER_DAY * durationInDays);
if (!player.getInventory().reduceAdena("Commission Registration Fee", registrationFee, player, null))
{
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA_TO_REGISTER_THE_ITEM);
@ -382,7 +382,7 @@ public final class CommissionManager
if (deleteItemFromDB(commissionId))
{
final long saleFee = (long) Math.max(MIN_REGISTRATION_AND_SALE_FEE, (totalPrice * SALE_FEE_PER_DAY) * commissionItem.getDurationInDays());
final long saleFee = (long) Math.max(MIN_REGISTRATION_AND_SALE_FEE, totalPrice * SALE_FEE_PER_DAY * commissionItem.getDurationInDays());
final Message mail = new Message(itemInstance.getOwnerId(), itemInstance, MailType.COMMISSION_ITEM_SOLD);
final Mail attachement = mail.createAttachments();

View File

@ -136,7 +136,7 @@ public final class CoupleManager
return _couples;
}
public static final CoupleManager getInstance()
public static CoupleManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -412,7 +412,7 @@ public final class CursedWeaponsManager
}
}
public static final CursedWeaponsManager getInstance()
public static CursedWeaponsManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -88,14 +88,11 @@ public final class DuelManager
return;
}
}
else
else if ((playerA.getPvpFlag() != 0) || (playerB.getPvpFlag() != 0))
{
if ((playerA.getPvpFlag() != 0) || (playerB.getPvpFlag() != 0))
{
playerA.sendMessage(engagedInPvP);
playerB.sendMessage(engagedInPvP);
return;
}
playerA.sendMessage(engagedInPvP);
playerB.sendMessage(engagedInPvP);
return;
}
final int duelId = _currentDuelId.incrementAndGet();
_duels.put(duelId, new Duel(playerA, playerB, partyDuel, duelId));
@ -195,7 +192,7 @@ public final class DuelManager
{
reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_POLYMORPHED;
}
else if (target.isDead() || target.isAlikeDead() || ((target.getCurrentHp() < (target.getMaxHp() / 2)) || (target.getCurrentMp() < (target.getMaxMp() / 2))))
else if (target.isDead() || target.isAlikeDead() || (target.getCurrentHp() < (target.getMaxHp() / 2)) || (target.getCurrentMp() < (target.getMaxMp() / 2)))
{
reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_S_HP_OR_MP_IS_BELOW_50;
}
@ -239,7 +236,7 @@ public final class DuelManager
return true;
}
public static final DuelManager getInstance()
public static DuelManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -33,7 +33,7 @@ public final class EventShrineManager
ENABLE_SHRINES = enabled;
}
public static final EventShrineManager getInstance()
public static EventShrineManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -195,7 +195,7 @@ public final class FortManager implements InstanceListManager
}
}
public static final FortManager getInstance()
public static FortManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -260,7 +260,7 @@ public final class FortSiegeManager
public boolean isCombat(int itemId)
{
return (itemId == 9819);
return itemId == 9819;
}
public boolean activateCombatFlag(L2PcInstance player, L2ItemInstance item)
@ -321,7 +321,7 @@ public final class FortSiegeManager
}
}
public static final FortSiegeManager getInstance()
public static FortSiegeManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -1537,7 +1537,7 @@ public final class FourSepulchersManager
{
continue;
}
((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout((min == 90 ? NpcStringId.GAME_OVER_THE_TELEPORT_WILL_APPEAR_MOMENTARILY : NpcStringId.MINUTE_S_HAVE_PASSED));
((L2SepulcherNpcInstance) temp.getLastSpawn()).sayInShout(min == 90 ? NpcStringId.GAME_OVER_THE_TELEPORT_WILL_APPEAR_MOMENTARILY : NpcStringId.MINUTE_S_HAVE_PASSED);
}
}
else if (_inEntryTime)
@ -1571,7 +1571,7 @@ public final class FourSepulchersManager
player.sendPacket(html);
}
public static final FourSepulchersManager getInstance()
public static FourSepulchersManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -130,7 +130,7 @@ public final class GlobalVariablesManager extends AbstractVariables
* Gets the single instance of {@code GlobalVariablesManager}.
* @return single instance of {@code GlobalVariablesManager}
*/
public static final GlobalVariablesManager getInstance()
public static GlobalVariablesManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -132,13 +132,13 @@ public final class GraciaSeedsManager
public void updateSodState()
{
final Quest quest = QuestManager.getInstance().getQuest(ENERGY_SEEDS);
if (quest == null)
if (quest != null)
{
_log.warning(getClass().getSimpleName() + ": missing EnergySeeds Quest!");
quest.notifyEvent("StopSoDAi", null, null);
}
else
{
quest.notifyEvent("StopSoDAi", null, null);
_log.warning(getClass().getSimpleName() + ": missing EnergySeeds Quest!");
}
}
@ -155,13 +155,13 @@ public final class GraciaSeedsManager
}
saveData(SODTYPE);
final Quest esQuest = QuestManager.getInstance().getQuest(ENERGY_SEEDS);
if (esQuest == null)
if (esQuest != null)
{
_log.warning(getClass().getSimpleName() + ": missing EnergySeeds Quest!");
esQuest.notifyEvent("StartSoDAi", null, null);
}
else
{
esQuest.notifyEvent("StartSoDAi", null, null);
_log.warning(getClass().getSimpleName() + ": missing EnergySeeds Quest!");
}
}
@ -199,7 +199,7 @@ public final class GraciaSeedsManager
}
case 2:
{
return ((_SoDLastStateChangeDate.getTimeInMillis() + Config.SOD_STAGE_2_LENGTH) - System.currentTimeMillis());
return (_SoDLastStateChangeDate.getTimeInMillis() + Config.SOD_STAGE_2_LENGTH) - System.currentTimeMillis();
}
case 3:
{
@ -228,7 +228,7 @@ public final class GraciaSeedsManager
* Gets the single instance of {@code GraciaSeedsManager}.
* @return single instance of {@code GraciaSeedsManager}
*/
public static final GraciaSeedsManager getInstance()
public static GraciaSeedsManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -204,7 +204,7 @@ public final class InstanceManager implements IXmlReader
{
return _instanceIdNames.get(id);
}
return ("UnknownInstance");
return "UnknownInstance";
}
@Override
@ -253,7 +253,7 @@ public final class InstanceManager implements IXmlReader
{
for (InstanceWorld temp : _instanceWorlds.values())
{
if ((temp != null) && (temp.isAllowed(player.getObjectId())))
if ((temp != null) && temp.isAllowed(player.getObjectId()))
{
return temp;
}
@ -384,7 +384,7 @@ public final class InstanceManager implements IXmlReader
* Gets the single instance of {@code InstanceManager}.
* @return single instance of {@code InstanceManager}
*/
public static final InstanceManager getInstance()
public static InstanceManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -102,7 +102,7 @@ public final class ItemAuctionManager
throw new Exception("Dublicated instanceId " + instanceId);
}
_managerInstances.put(instanceId, (new ItemAuctionInstance(instanceId, _auctionIds, nb)));
_managerInstances.put(instanceId, new ItemAuctionInstance(instanceId, _auctionIds, nb));
}
}
}
@ -133,7 +133,7 @@ public final class ItemAuctionManager
return _auctionIds.getAndIncrement();
}
public static final void deleteAuction(int auctionId)
public static void deleteAuction(int auctionId)
{
try (Connection con = DatabaseFactory.getInstance().getConnection())
{
@ -159,7 +159,7 @@ public final class ItemAuctionManager
* Gets the single instance of {@code ItemAuctionManager}.
* @return single instance of {@code ItemAuctionManager}
*/
public static final ItemAuctionManager getInstance()
public static ItemAuctionManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -218,8 +218,8 @@ public final class ItemsOnGroundManager implements Runnable
ps.setInt(5, item.getX());
ps.setInt(6, item.getY());
ps.setInt(7, item.getZ());
ps.setLong(8, (item.isProtected() ? -1 : item.getDropTime())); // item is protected or AutoDestroyed
ps.setLong(9, (item.isEquipable() ? 1 : 0)); // set equip-able
ps.setLong(8, item.isProtected() ? -1 : item.getDropTime()); // item is protected or AutoDestroyed
ps.setLong(9, item.isEquipable() ? 1 : 0); // set equip-able
ps.execute();
ps.clearParameters();
}
@ -239,7 +239,7 @@ public final class ItemsOnGroundManager implements Runnable
* Gets the single instance of {@code ItemsOnGroundManager}.
* @return single instance of {@code ItemsOnGroundManager}
*/
public static final ItemsOnGroundManager getInstance()
public static ItemsOnGroundManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -200,7 +200,7 @@ public class JumpManager
return;
}
final Track t = getTrack(player.getJumpTrackId());
if (!((t.x == 0) && (t.y == 0) && (t.z == 0)))
if ((t.x != 0) || (t.y != 0) || (t.z != 0))
{
player.broadcastPacket(new FlyToLocation(player, t.x, t.y, t.z, FlyType.DUMMY));
player.setXYZ(t.x, t.y, t.z);
@ -226,7 +226,7 @@ public class JumpManager
player.setXYZ(n.getX(), n.getY(), n.getZ());
}
public static final JumpManager getInstance()
public static JumpManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -258,7 +258,7 @@ public final class MapRegionManager implements IXmlReader
if (castle == null)
{
castle = CastleManager.getInstance().getCastle(player);
if (!((castle != null) && castle.getSiege().isInProgress() && (castle.getSiege().getDefenderClan(player.getClan()) != null)))
if ((castle == null) || !castle.getSiege().isInProgress() || (castle.getSiege().getDefenderClan(player.getClan()) == null))
{
castle = null;
}
@ -279,7 +279,7 @@ public final class MapRegionManager implements IXmlReader
if (fort == null)
{
fort = FortManager.getInstance().getFort(player);
if (!((fort != null) && fort.getSiege().isInProgress() && (fort.getOwnerClan() == player.getClan())))
if ((fort == null) || !fort.getSiege().isInProgress() || (fort.getOwnerClan() != player.getClan()))
{
fort = null;
}
@ -406,7 +406,7 @@ public final class MapRegionManager implements IXmlReader
{
try
{
final L2PcInstance player = ((L2PcInstance) activeChar);
final L2PcInstance player = (L2PcInstance) activeChar;
final L2MapRegion region = _regions.get(point);
if (region.getBannedRace().containsKey(player.getRace()))

View File

@ -121,7 +121,7 @@ public final class MercTicketManager
for (int i2 = 0; i2 < 50; i2 += 10)
{
// Simplified if statement;
if (((itemId >= ITEM_IDS[i2 + (i * GUARDIAN_TYPES_COUNT)]) && (itemId <= ITEM_IDS[i2 + 9 + (i * GUARDIAN_TYPES_COUNT)])))
if ((itemId >= ITEM_IDS[i2 + (i * GUARDIAN_TYPES_COUNT)]) && (itemId <= ITEM_IDS[i2 + 9 + (i * GUARDIAN_TYPES_COUNT)]))
{
return i + 1;
}
@ -182,7 +182,7 @@ public final class MercTicketManager
if (NPC_IDS[i] == npcId) // Find the index of the item used
{
// only handle tickets if a siege is not ongoing in this npc's castle
if ((castle != null) && !(castle.getSiege().isInProgress()))
if ((castle != null) && !castle.getSiege().isInProgress())
{
itemId = ITEM_IDS[i];
// create the ticket in the gameworld
@ -346,7 +346,7 @@ public final class MercTicketManager
final L2DefenderInstance npc = new L2DefenderInstance(template);
npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
npc.setDecayed(false);
npc.spawnMe(x, y, (z + 20));
npc.spawnMe(x, y, z + 20);
if (despawnDelay > 0)
{
npc.scheduleDespawn(despawnDelay);
@ -413,7 +413,7 @@ public final class MercTicketManager
* Gets the single instance of {@code MercTicketManager}.
* @return single instance of {@code MercTicketManager}
*/
public static final MercTicketManager getInstance()
public static MercTicketManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -85,7 +85,7 @@ public final class PcCafePointsManager
* Gets the single instance of {@code PcCafePointsManager}.
* @return single instance of {@code PcCafePointsManager}
*/
public static final PcCafePointsManager getInstance()
public static PcCafePointsManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -108,12 +108,12 @@ public final class PetitionManager
{
if ((currPetition.getPetitioner() != null) && (currPetition.getPetitioner().getObjectId() == player.getObjectId()))
{
return (currPetition.endPetitionConsultation(PetitionState.PETITIONER_CANCEL));
return currPetition.endPetitionConsultation(PetitionState.PETITIONER_CANCEL);
}
if ((currPetition.getResponder() != null) && (currPetition.getResponder().getObjectId() == player.getObjectId()))
{
return (currPetition.endPetitionConsultation(PetitionState.RESPONDER_CANCEL));
return currPetition.endPetitionConsultation(PetitionState.RESPONDER_CANCEL);
}
}
@ -160,7 +160,7 @@ public final class PetitionManager
if ((currPetition.getResponder() != null) && (currPetition.getResponder().getObjectId() == player.getObjectId()))
{
return (currPetition.endPetitionConsultation(PetitionState.COMPLETED));
return currPetition.endPetitionConsultation(PetitionState.COMPLETED);
}
}
@ -309,7 +309,7 @@ public final class PetitionManager
}
currPetition.setResponder(respondingAdmin);
return (currPetition.endPetitionConsultation(PetitionState.RESPONDER_REJECT));
return currPetition.endPetitionConsultation(PetitionState.RESPONDER_REJECT);
}
public boolean sendActivePetitionMessage(L2PcInstance player, String messageText)
@ -374,8 +374,8 @@ public final class PetitionManager
continue;
}
StringUtil.append(htmlContent, "<tr><td width=\"270\"><table width=\"270\" cellpadding=\"2\" bgcolor=", (color ? "131210" : "444444"), "><tr><td width=\"130\">", dateFormat.format(new Date(currPetition.getSubmitTime())));
StringUtil.append(htmlContent, "</td><td width=\"140\" align=right><font color=\"", (currPetition.getPetitioner().isOnline() ? "00FF00" : "999999"), "\">", currPetition.getPetitioner().getName(), "</font></td></tr>");
StringUtil.append(htmlContent, "<tr><td width=\"270\"><table width=\"270\" cellpadding=\"2\" bgcolor=", color ? "131210" : "444444", "><tr><td width=\"130\">", dateFormat.format(new Date(currPetition.getSubmitTime())));
StringUtil.append(htmlContent, "</td><td width=\"140\" align=right><font color=\"", currPetition.getPetitioner().isOnline() ? "00FF00" : "999999", "\">", currPetition.getPetitioner().getName(), "</font></td></tr>");
StringUtil.append(htmlContent, "<tr><td width=\"130\">");
if (currPetition.getState() != PetitionState.IN_PROCESS)
{
@ -432,7 +432,7 @@ public final class PetitionManager
html.replace("%time%", dateFormat.format(new Date(currPetition.getSubmitTime())));
html.replace("%type%", currPetition.getTypeAsString());
html.replace("%petitioner%", currPetition.getPetitioner().getName());
html.replace("%online%", (currPetition.getPetitioner().isOnline() ? "00FF00" : "999999"));
html.replace("%online%", currPetition.getPetitioner().isOnline() ? "00FF00" : "999999");
html.replace("%text%", currPetition.getContent());
activeChar.sendPacket(html);
@ -442,7 +442,7 @@ public final class PetitionManager
* Gets the single instance of {@code PetitionManager}.
* @return single instance of {@code PetitionManager}
*/
public static final PetitionManager getInstance()
public static PetitionManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -124,7 +124,7 @@ public class PremiumManager
}
}
public static final PremiumManager getInstance()
public static PremiumManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -123,7 +123,7 @@ public final class PunishmentManager
* Gets the single instance of {@code PunishmentManager}.
* @return single instance of {@code PunishmentManager}
*/
public static final PunishmentManager getInstance()
public static PunishmentManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -187,7 +187,7 @@ public final class QuestManager extends ScriptManager<Quest>
if (Config.ALT_DEV_SHOW_QUESTS_LOAD_IN_LOGS)
{
_log.info("Loaded quest " + Util.splitWords((quest.getName().contains("_") ? quest.getName().substring(quest.getName().indexOf('_') + 1) : quest.getName())) + ".");
_log.info("Loaded quest " + Util.splitWords(quest.getName().contains("_") ? quest.getName().substring(quest.getName().indexOf('_') + 1) : quest.getName()) + ".");
}
}

View File

@ -242,7 +242,7 @@ public class RaidBossSpawnManager
}
else
{
_schedules.put(bossId, ThreadPoolManager.getInstance().scheduleGeneral(new SpawnSchedule(bossId), (respawnTime - Calendar.getInstance().getTimeInMillis())));
_schedules.put(bossId, ThreadPoolManager.getInstance().scheduleGeneral(new SpawnSchedule(bossId), respawnTime - Calendar.getInstance().getTimeInMillis()));
}
_spawns.put(bossId, spawnDat);

View File

@ -239,7 +239,7 @@ public final class SiegeGuardManager
ps.setInt(4, y);
ps.setInt(5, z);
ps.setInt(6, heading);
ps.setInt(7, (isHire == 1 ? 0 : 600));
ps.setInt(7, isHire == 1 ? 0 : 600);
ps.setInt(8, isHire);
ps.execute();
}

View File

@ -294,7 +294,7 @@ public final class SiegeManager
}
}
public static final SiegeManager getInstance()
public static SiegeManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -22,7 +22,7 @@ import com.l2jmobius.gameserver.model.zone.type.L2TownZone;
public final class TownManager
{
public static final int getTownCastle(int townId)
public static int getTownCastle(int townId)
{
switch (townId)
{
@ -69,7 +69,7 @@ public final class TownManager
}
}
public static final boolean townHasCastleInSiege(int townId)
public static boolean townHasCastleInSiege(int townId)
{
final int castleIndex = getTownCastle(townId);
@ -84,12 +84,12 @@ public final class TownManager
return false;
}
public static final boolean townHasCastleInSiege(int x, int y)
public static boolean townHasCastleInSiege(int x, int y)
{
return townHasCastleInSiege(MapRegionManager.getInstance().getMapRegionLocId(x, y));
}
public static final L2TownZone getTown(int townId)
public static L2TownZone getTown(int townId)
{
for (L2TownZone temp : ZoneManager.getInstance().getAllZones(L2TownZone.class))
{
@ -108,7 +108,7 @@ public final class TownManager
* @param z
* @return
*/
public static final L2TownZone getTown(int x, int y, int z)
public static L2TownZone getTown(int x, int y, int z)
{
for (L2ZoneType temp : ZoneManager.getInstance().getZones(x, y, z))
{

View File

@ -285,36 +285,33 @@ public final class WalkingManager implements IXmlReader
ThreadPoolManager.getInstance().scheduleGeneral(new StartMovingTask(npc, routeName), 60000);
}
}
else
// walk was stopped due to some reason (arrived to node, script action, fight or something else), resume it
else if (_activeRoutes.containsKey(npc.getObjectId()) && ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) || (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)))
{
if (_activeRoutes.containsKey(npc.getObjectId()) && ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE) || (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)))
final WalkInfo walk = _activeRoutes.get(npc.getObjectId());
if (walk == null)
{
final WalkInfo walk = _activeRoutes.get(npc.getObjectId());
if (walk == null)
{
return;
}
// Prevent call simultaneously from scheduled task and onArrived() or temporarily stop walking for resuming in future
if (walk.isBlocked() || walk.isSuspended())
{
npc.sendDebugMessage("Failed to continue moving along route '" + routeName + "' (operation is blocked)");
return;
}
walk.setBlocked(true);
final L2NpcWalkerNode node = walk.getCurrentNode();
npc.sendDebugMessage("Route '" + routeName + "', continuing to node " + walk.getCurrentNodeId());
npc.setIsRunning(node.runToLocation());
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, node);
walk.setBlocked(false);
walk.setStoppedByAttack(false);
return;
}
else
// Prevent call simultaneously from scheduled task and onArrived() or temporarily stop walking for resuming in future
if (walk.isBlocked() || walk.isSuspended())
{
npc.sendDebugMessage("Failed to continue moving along route '" + routeName + "' (wrong AI state - " + npc.getAI().getIntention() + ")");
npc.sendDebugMessage("Failed to continue moving along route '" + routeName + "' (operation is blocked)");
return;
}
walk.setBlocked(true);
final L2NpcWalkerNode node = walk.getCurrentNode();
npc.sendDebugMessage("Route '" + routeName + "', continuing to node " + walk.getCurrentNodeId());
npc.setIsRunning(node.runToLocation());
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, node);
walk.setBlocked(false);
walk.setStoppedByAttack(false);
}
else
{
npc.sendDebugMessage("Failed to continue moving along route '" + routeName + "' (wrong AI state - " + npc.getAI().getIntention() + ")");
}
}
}
@ -455,7 +452,7 @@ public final class WalkingManager implements IXmlReader
}
}
public static final WalkingManager getInstance()
public static WalkingManager getInstance()
{
return SingletonHolder._instance;
}

View File

@ -515,11 +515,11 @@ public final class ZoneManager implements IXmlReader
*/
public <T extends L2ZoneType> T getZone(L2Object object, Class<T> type)
{
if (object == null)
if (object != null)
{
return null;
return getZone(object.getX(), object.getY(), object.getZ(), type);
}
return getZone(object.getX(), object.getY(), object.getZ(), type);
return null;
}
/**
@ -631,7 +631,7 @@ public final class ZoneManager implements IXmlReader
{
if ((temp instanceof L2ArenaZone) && temp.isCharacterInZone(character))
{
return ((L2ArenaZone) temp);
return (L2ArenaZone) temp;
}
}
@ -654,7 +654,7 @@ public final class ZoneManager implements IXmlReader
{
if ((temp instanceof L2OlympiadStadiumZone) && temp.isCharacterInZone(character))
{
return ((L2OlympiadStadiumZone) temp);
return (L2OlympiadStadiumZone) temp;
}
}
return null;
@ -734,7 +734,7 @@ public final class ZoneManager implements IXmlReader
* Gets the single instance of ZoneManager.
* @return single instance of ZoneManager
*/
public static final ZoneManager getInstance()
public static ZoneManager getInstance()
{
return SingletonHolder._instance;
}