Minor code improvements.

This commit is contained in:
MobiusDev
2016-12-11 20:32:47 +00:00
parent 6a2ccc62e4
commit 70f0330eb0
182 changed files with 1006 additions and 1328 deletions

View File

@@ -656,7 +656,7 @@ public interface IXmlReader
* @param node
* @return {@code true} if the node is an element type, {@code false} otherwise
*/
public static boolean isNode(Node node)
static boolean isNode(Node node)
{
return node.getNodeType() == Node.ELEMENT_NODE;
}
@@ -665,7 +665,7 @@ public interface IXmlReader
* @param node
* @return {@code true} if the node is an element type, {@code false} otherwise
*/
public static boolean isText(Node node)
static boolean isText(Node node)
{
return node.getNodeType() == Node.TEXT_NODE;
}

View File

@@ -303,7 +303,7 @@ public final class Rnd
protected static volatile long SEED_UNIQUIFIER = 8682522807148012L;
public static final Random directRandom()
public static Random directRandom()
{
return rnd.directRandom();
}
@@ -313,7 +313,7 @@ public final class Rnd
* @return A random double number from 0 to 1
* @see com.l2jmobius.commons.util.Rnd#nextDouble()
*/
public static final double get()
public static double get()
{
return rnd.nextDouble();
}
@@ -323,7 +323,7 @@ public final class Rnd
* @param n The superior limit (exclusive)
* @return A random integer number from 0 to n-1
*/
public static final int get(int n)
public static int get(int n)
{
return rnd.get(n);
}
@@ -334,7 +334,7 @@ public final class Rnd
* @param max The maximum value
* @return A random integer number from min to max
*/
public static final int get(int min, int max)
public static int get(int min, int max)
{
return rnd.get(min, max);
}
@@ -345,12 +345,12 @@ public final class Rnd
* @param max The maximum value
* @return A random long number from min to max
*/
public static final long get(long min, long max)
public static long get(long min, long max)
{
return rnd.get(min, max);
}
public static final RandomContainer newInstance(RandomType type)
public static RandomContainer newInstance(RandomType type)
{
switch (type)
{
@@ -375,7 +375,7 @@ public final class Rnd
* @return A random boolean state (true or false)
* @see java.util.Random#nextBoolean()
*/
public static final boolean nextBoolean()
public static boolean nextBoolean()
{
return rnd.nextBoolean();
}
@@ -385,7 +385,7 @@ public final class Rnd
* @param array The array to be filled with random byte numbers
* @see java.util.Random#nextBytes(byte[] bytes)
*/
public static final void nextBytes(byte[] array)
public static void nextBytes(byte[] array)
{
rnd.nextBytes(array);
}
@@ -395,7 +395,7 @@ public final class Rnd
* @return A random double number from 0 to 1
* @see java.util.Random#nextDouble()
*/
public static final double nextDouble()
public static double nextDouble()
{
return rnd.nextDouble();
}
@@ -405,7 +405,7 @@ public final class Rnd
* @return A random integer number from 0 to 1
* @see java.util.Random#nextFloat()
*/
public static final float nextFloat()
public static float nextFloat()
{
return rnd.nextFloat();
}
@@ -415,7 +415,7 @@ public final class Rnd
* @return A random gaussian double number from 0 to 1
* @see java.util.Random#nextGaussian()
*/
public static final double nextGaussian()
public static double nextGaussian()
{
return rnd.nextGaussian();
}
@@ -425,7 +425,7 @@ public final class Rnd
* @return A random integer number from Integer.MIN_VALUE to Integer.MAX_VALUE
* @see java.util.Random#nextInt()
*/
public static final int nextInt()
public static int nextInt()
{
return rnd.nextInt();
}
@@ -435,7 +435,7 @@ public final class Rnd
* @return int
* @see com.l2jmobius.commons.util.Rnd#get(int n)
*/
public static final int nextInt(int n)
public static int nextInt(int n)
{
return get(n);
}
@@ -445,7 +445,7 @@ public final class Rnd
* @return A random integer number from Long.MIN_VALUE to Long.MAX_VALUE
* @see java.util.Random#nextLong()
*/
public static final long nextLong()
public static long nextLong()
{
return rnd.nextLong();
}

View File

@@ -621,6 +621,6 @@ public class GeoData
private static class SingletonHolder
{
protected final static GeoData _instance = new GeoData();
protected static final GeoData _instance = new GeoData();
}
}

View File

@@ -222,17 +222,14 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
intention = AI_INTENTION_ACTIVE;
}
else
else if (npc.getSpawn() != null)
{
if (npc.getSpawn() != null)
final Location loc = npc.getSpawn().getLocation();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius(loc, range + range, true, false))
{
final Location loc = npc.getSpawn().getLocation();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius(loc, range + range, true, false))
{
intention = AI_INTENTION_ACTIVE;
}
intention = AI_INTENTION_ACTIVE;
}
}
}

View File

@@ -84,7 +84,7 @@ public class ActionData implements IGameXmlReader
* Gets the single instance of ActionData.
* @return single instance of ActionData
*/
public static final ActionData getInstance()
public static ActionData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -128,7 +128,7 @@ public class AlchemyData implements IGameXmlReader
* Gets the single instance of AlchemyData.
* @return single instance of AlchemyData
*/
public static final AlchemyData getInstance()
public static AlchemyData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -160,7 +160,7 @@ public class CubicData implements IGameXmlReader
* Gets the single instance of CubicData.
* @return single instance of CubicData
*/
public static final CubicData getInstance()
public static CubicData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -128,7 +128,7 @@ public class DailyMissionData implements IGameXmlReader
* Gets the single instance of DailyMissionData.
* @return single instance of DailyMissionData
*/
public static final DailyMissionData getInstance()
public static DailyMissionData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -110,7 +110,7 @@ public class EnchantItemHPBonusData implements IGameXmlReader
* Gets the single instance of EnchantHPBonusData.
* @return single instance of EnchantHPBonusData
*/
public static final EnchantItemHPBonusData getInstance()
public static EnchantItemHPBonusData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -191,7 +191,7 @@ public class EnsoulData implements IGameXmlReader
* Gets the single instance of EnsoulData.
* @return single instance of EnsoulData
*/
public static final EnsoulData getInstance()
public static EnsoulData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -60,7 +60,7 @@ public class NpcData implements IGameXmlReader
private final Map<Integer, L2NpcTemplate> _npcs = new HashMap<>();
private final Map<String, Integer> _clans = new HashMap<>();
private final static List<Integer> _masterMonsterIDs = new ArrayList<>();
private static final List<Integer> _masterMonsterIDs = new ArrayList<>();
protected NpcData()
{
@@ -525,49 +525,46 @@ public class NpcData implements IGameXmlReader
aiSkillScopes.add(shortOrLongRangeScope);
}
}
else if (skill.hasEffectType(L2EffectType.DISPEL, L2EffectType.DISPEL_BY_SLOT))
{
aiSkillScopes.add(AISkillScope.NEGATIVE);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.HEAL))
{
aiSkillScopes.add(AISkillScope.HEAL);
}
else if (skill.hasEffectType(L2EffectType.PHYSICAL_ATTACK, L2EffectType.PHYSICAL_ATTACK_HP_LINK, L2EffectType.MAGICAL_ATTACK, L2EffectType.DEATH_LINK, L2EffectType.HP_DRAIN))
{
aiSkillScopes.add(AISkillScope.ATTACK);
aiSkillScopes.add(AISkillScope.UNIVERSAL);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.SLEEP))
{
aiSkillScopes.add(AISkillScope.IMMOBILIZE);
}
else if (skill.hasEffectType(L2EffectType.BLOCK_ACTIONS, L2EffectType.ROOT))
{
aiSkillScopes.add(AISkillScope.IMMOBILIZE);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.MUTE, L2EffectType.BLOCK_CONTROL))
{
aiSkillScopes.add(AISkillScope.COT);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.DMG_OVER_TIME, L2EffectType.DMG_OVER_TIME_PERCENT))
{
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.RESURRECTION))
{
aiSkillScopes.add(AISkillScope.RES);
}
else
{
if (skill.hasEffectType(L2EffectType.DISPEL, L2EffectType.DISPEL_BY_SLOT))
{
aiSkillScopes.add(AISkillScope.NEGATIVE);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.HEAL))
{
aiSkillScopes.add(AISkillScope.HEAL);
}
else if (skill.hasEffectType(L2EffectType.PHYSICAL_ATTACK, L2EffectType.PHYSICAL_ATTACK_HP_LINK, L2EffectType.MAGICAL_ATTACK, L2EffectType.DEATH_LINK, L2EffectType.HP_DRAIN))
{
aiSkillScopes.add(AISkillScope.ATTACK);
aiSkillScopes.add(AISkillScope.UNIVERSAL);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.SLEEP))
{
aiSkillScopes.add(AISkillScope.IMMOBILIZE);
}
else if (skill.hasEffectType(L2EffectType.BLOCK_ACTIONS, L2EffectType.ROOT))
{
aiSkillScopes.add(AISkillScope.IMMOBILIZE);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.MUTE, L2EffectType.BLOCK_CONTROL))
{
aiSkillScopes.add(AISkillScope.COT);
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.DMG_OVER_TIME, L2EffectType.DMG_OVER_TIME_PERCENT))
{
aiSkillScopes.add(shortOrLongRangeScope);
}
else if (skill.hasEffectType(L2EffectType.RESURRECTION))
{
aiSkillScopes.add(AISkillScope.RES);
}
else
{
aiSkillScopes.add(AISkillScope.UNIVERSAL);
}
aiSkillScopes.add(AISkillScope.UNIVERSAL);
}
}

View File

@@ -121,7 +121,7 @@ public class OptionData implements IGameXmlReader
* Gets the single instance of OptionsData.
* @return single instance of OptionsData
*/
public static final OptionData getInstance()
public static OptionData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -182,7 +182,7 @@ public final class PlayerTemplateData implements IGameXmlReader
return _playerTemplates.get(ClassId.getClassId(classId));
}
public static final PlayerTemplateData getInstance()
public static PlayerTemplateData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -101,7 +101,7 @@ public final class ResidenceFunctionsData implements IGameXmlReader
return _functions.get(id);
}
public static final ResidenceFunctionsData getInstance()
public static ResidenceFunctionsData getInstance()
{
return SingletonHolder.INSTANCE;
}

View File

@@ -103,7 +103,7 @@ public class SayuneData implements IGameXmlReader
* Gets the single instance of SayuneData.
* @return single instance of SayuneData
*/
public static final SayuneData getInstance()
public static SayuneData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -115,7 +115,7 @@ public class SiegeScheduleData implements IGameXmlReader
return _scheduleData;
}
public static final SiegeScheduleData getInstance()
public static SiegeScheduleData getInstance()
{
return SingletonHolder._instance;
}

View File

@@ -490,7 +490,7 @@ public class SkillData implements IGameXmlReader
final String stringGeneralValue = String.valueOf(generalValue);
if (stringGeneralValue.startsWith("@"))
{
Map<Integer, Map<Integer, Object>> variableValue = variableValues.get(stringGeneralValue);
final Map<Integer, Map<Integer, Object>> variableValue = variableValues.get(stringGeneralValue);
if (variableValue != null)
{
values = variableValue;
@@ -546,11 +546,11 @@ public class SkillData implements IGameXmlReader
{
for (int j = fromSubLevel; j <= toSubLevel; j++)
{
Map<Integer, Object> subValues = values.computeIfAbsent(i, k -> new HashMap<>());
Map<String, Double> variables = new HashMap<>();
final Map<Integer, Object> subValues = values.computeIfAbsent(i, k -> new HashMap<>());
final Map<String, Double> variables = new HashMap<>();
variables.put("index", (i - fromLevel) + 1d);
variables.put("subIndex", (j - fromSubLevel) + 1d);
Object base = values.getOrDefault(i, Collections.emptyMap()).get(-1);
final Object base = values.getOrDefault(i, Collections.emptyMap()).get(-1);
if ((base != null) && !(base instanceof StatsSet))
{
variables.put("base", Double.parseDouble(String.valueOf(base)));

View File

@@ -101,7 +101,7 @@ public class MerchantPriceConfigTable implements InstanceListManager
}
}
final MerchantPriceConfig defaultMpc = this.getMerchantPriceConfig(defaultPriceConfigId);
final MerchantPriceConfig defaultMpc = getMerchantPriceConfig(defaultPriceConfigId);
if (defaultMpc == null)
{
throw new IllegalStateException("'defaultPriceConfig' points to an non-loaded priceConfig");

View File

@@ -1253,7 +1253,7 @@ public abstract class DocumentBase
final char ch = value.isEmpty() ? ' ' : value.charAt(0);
if ((ch == '#') || (ch == '-') || Character.isDigit(ch))
{
set.set(name, String.valueOf(getValue(value, level)));
set.set(name, getValue(value, level));
}
else
{

View File

@@ -170,7 +170,7 @@ public enum CategoryType
* @param categoryName
* @return A {@code CategoryType} if category was found, {@code null} if category was not found
*/
public static final CategoryType findByName(String categoryName)
public static CategoryType findByName(String categoryName)
{
for (CategoryType type : values())
{

View File

@@ -28,7 +28,7 @@ public enum IllegalActionPunishmentType
KICKBAN,
JAIL;
public static final IllegalActionPunishmentType findByName(String name)
public static IllegalActionPunishmentType findByName(String name)
{
for (IllegalActionPunishmentType type : values())
{

View File

@@ -113,7 +113,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
// Send debug message
if (Config.DEBUG)
{
LOGGER.info(getClass().getSimpleName() + ": Current mode " + _mode.toString());
LOGGER.info(getClass().getSimpleName() + ": Current mode " + _mode);
}
}
else
@@ -432,7 +432,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
scheduleModeChange();
if (Config.DEBUG)
{
LOGGER.info(getClass().getSimpleName() + ": Manor mode changed to " + _mode.toString() + "!");
LOGGER.info(getClass().getSimpleName() + ": Manor mode changed to " + _mode + "!");
}
}

View File

@@ -89,7 +89,7 @@ public class ClanHallAuctionManager extends AbstractEventManager<AbstractEvent<?
//@formatter:on
}
public static final ClanHallAuctionManager getInstance()
public static ClanHallAuctionManager getInstance()
{
return SingletonHolder.INSTANCE;
}

View File

@@ -92,14 +92,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));

View File

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

View File

@@ -72,7 +72,7 @@ public class ServerRestartManager
{
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
ThreadPoolManager.getInstance().scheduleGeneral(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
_log.info("Scheduled server restart at " + lastRestart.getTime().toString() + ".");
_log.info("Scheduled server restart at " + lastRestart.getTime() + ".");
}
}
catch (Exception e)

View File

@@ -1391,15 +1391,12 @@ public class L2Clan implements IIdentifiable, INamable
temp.getPlayerInstance().sendSkillList();
}
}
else
else if (temp.getPledgeType() == subType)
{
if (temp.getPledgeType() == subType)
{
temp.getPlayerInstance().addSkill(newSkill, false); // Skill is not saved to player DB
temp.getPlayerInstance().sendPacket(new ExSubPledgeSkillAdd(subType, newSkill.getId(), newSkill.getLevel()));
temp.getPlayerInstance().sendPacket(sm);
temp.getPlayerInstance().sendSkillList();
}
temp.getPlayerInstance().addSkill(newSkill, false); // Skill is not saved to player DB
temp.getPlayerInstance().sendPacket(new ExSubPledgeSkillAdd(subType, newSkill.getId(), newSkill.getLevel()));
temp.getPlayerInstance().sendPacket(sm);
temp.getPlayerInstance().sendSkillList();
}
}
}

View File

@@ -312,6 +312,6 @@ public final class L2SkillLearn
public String toString()
{
final Skill skill = SkillData.getInstance().getSkill(_skillId, _skillLvl);
return "[" + skill.toString() + " treeId: " + _treeId + " row: " + _row + " column: " + _column + " pointsRequired:" + _pointsRequired + "]";
return "[" + skill + " treeId: " + _treeId + " row: " + _row + " column: " + _column + " pointsRequired:" + _pointsRequired + "]";
}
}

View File

@@ -558,23 +558,18 @@ public class L2Attackable extends L2Npc
}
rewards.remove(partyPlayer); // Remove the L2PcInstance from the L2Attackable rewards
}
else
else if (Util.checkIfInRange(Config.ALT_PARTY_RANGE, this, partyPlayer, true))
{
// Add L2PcInstance of the party (that have attacked or not) to members that can be rewarded
// and in range of the monster.
if (Util.checkIfInRange(Config.ALT_PARTY_RANGE, this, partyPlayer, true))
rewardedMembers.add(partyPlayer);
if (partyPlayer.getLevel() > partyLvl)
{
rewardedMembers.add(partyPlayer);
if (partyPlayer.getLevel() > partyLvl)
if (attackerParty.isInCommandChannel())
{
if (attackerParty.isInCommandChannel())
{
partyLvl = attackerParty.getCommandChannel().getLevel();
}
else
{
partyLvl = partyPlayer.getLevel();
}
partyLvl = attackerParty.getCommandChannel().getLevel();
}
else
{
partyLvl = partyPlayer.getLevel();
}
}
}

View File

@@ -331,17 +331,14 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
addSkill(skill);
}
}
else
else if (isSummon())
{
if (isSummon())
// Copy the skills of the L2Summon from its template to the L2Character Instance
// The skills list can be affected by spell effects so it's necessary to make a copy
// to avoid that a spell affecting a L2Summon, affects others L2Summon of the same type too.
for (Skill skill : template.getSkills().values())
{
// Copy the skills of the L2Summon from its template to the L2Character Instance
// The skills list can be affected by spell effects so it's necessary to make a copy
// to avoid that a spell affecting a L2Summon, affects others L2Summon of the same type too.
for (Skill skill : template.getSkills().values())
{
addSkill(skill);
}
addSkill(skill);
}
}
@@ -1125,12 +1122,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return;
}
}
else
else if (_disableRangedAttackEndTime > GameTimeController.getInstance().getGameTicks())
{
if (_disableRangedAttackEndTime > GameTimeController.getInstance().getGameTicks())
{
return;
}
return;
}
}
@@ -1635,7 +1629,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* @param itemObjId the item object ID
* @return if the item has a reuse time stamp, the remaining time, otherwise -1
*/
public synchronized final long getItemRemainingReuseTime(int itemObjId)
public final synchronized long getItemRemainingReuseTime(int itemObjId)
{
final TimeStamp reuseStamp = (_reuseTimeStampsItems != null) ? _reuseTimeStampsItems.get(itemObjId) : null;
return reuseStamp != null ? reuseStamp.getRemaining() : -1;
@@ -1706,7 +1700,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* Removes a skill reuse time stamp.
* @param skill the skill to remove
*/
public synchronized final void removeTimeStamp(Skill skill)
public final synchronized void removeTimeStamp(Skill skill)
{
if (_reuseTimeStampsSkills != null)
{
@@ -1717,7 +1711,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/**
* Removes all skill reuse time stamps.
*/
public synchronized final void resetTimeStamps()
public final synchronized void resetTimeStamps()
{
if (_reuseTimeStampsSkills != null)
{
@@ -1730,7 +1724,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* @param hashCode the skill hash code
* @return if the skill has a reuse time stamp, the remaining time, otherwise -1
*/
public synchronized final long getSkillRemainingReuseTime(long hashCode)
public final synchronized long getSkillRemainingReuseTime(long hashCode)
{
final TimeStamp reuseStamp = (_reuseTimeStampsSkills != null) ? _reuseTimeStampsSkills.get(hashCode) : null;
return reuseStamp != null ? reuseStamp.getRemaining() : -1;
@@ -1741,7 +1735,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* @param hashCode the skill hash code
* @return {@code true} if the skill is under reuse time, {@code false} otherwise
*/
public synchronized final boolean hasSkillReuse(long hashCode)
public final synchronized boolean hasSkillReuse(long hashCode)
{
final TimeStamp reuseStamp = (_reuseTimeStampsSkills != null) ? _reuseTimeStampsSkills.get(hashCode) : null;
return (reuseStamp != null) && reuseStamp.hasNotPassed();
@@ -1752,7 +1746,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* @param hashCode the skill hash code
* @return if the skill has a reuse time stamp, the skill reuse time stamp, otherwise {@code null}
*/
public synchronized final TimeStamp getSkillReuseTimeStamp(long hashCode)
public final synchronized TimeStamp getSkillReuseTimeStamp(long hashCode)
{
return _reuseTimeStampsSkills != null ? _reuseTimeStampsSkills.get(hashCode) : null;
}
@@ -1809,7 +1803,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
/**
* Removes all the disabled skills.
*/
public synchronized final void resetDisabledSkills()
public final synchronized void resetDisabledSkills()
{
if (_disabledSkills != null)
{
@@ -3018,12 +3012,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
{
player.broadcastCharInfo();
}
else
else if (su.hasUpdates())
{
if (su.hasUpdates())
{
broadcastPacket(su);
}
broadcastPacket(su);
}
if (hasServitors() && isAffected(EffectFlag.SERVITOR_SHARE))
{

View File

@@ -651,12 +651,9 @@ public class L2Npc extends L2Character
return temp;
}
}
else
else if (HtmCache.getInstance().isLoadable(temp))
{
if (HtmCache.getInstance().isLoadable(temp))
{
return temp;
}
return temp;
}
// If the file is not found, the standard message "I have nothing to say to you" is returned

View File

@@ -850,16 +850,13 @@ public abstract class L2Summon extends L2Playable
activeChar.sendPacket(new PetItemList(getInventory().getItems()));
}
}
else if (isPet())
{
activeChar.sendPacket(new ExPetInfo(this, activeChar, 0));
}
else
{
if (isPet())
{
activeChar.sendPacket(new ExPetInfo(this, activeChar, 0));
}
else
{
activeChar.sendPacket(new SummonInfo(this, activeChar, 0));
}
activeChar.sendPacket(new SummonInfo(this, activeChar, 0));
}
}

View File

@@ -92,12 +92,9 @@ public class DoppelgangerInstance extends L2Npc
getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, getSummoner());
}
}
else
else if (getAI().getIntention() == CtrlIntention.AI_INTENTION_FOLLOW)
{
if (getAI().getIntention() == CtrlIntention.AI_INTENTION_FOLLOW)
{
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
}

View File

@@ -371,9 +371,9 @@ public class L2FortManagerInstance extends L2MerchantInstance
break;
}
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Provides additional HP recovery for clan members in the fortress.<font color=\"00FFFF\">" + String.valueOf(percent) + "%</font>");
html.replace("%apply%", "recovery hp " + String.valueOf(percent));
html.replace("%cost%", cost + "</font>Adena /" + (Config.FS_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Provides additional HP recovery for clan members in the fortress.<font color=\"00FFFF\">" + percent + "%</font>");
html.replace("%apply%", "recovery hp " + percent);
sendHtmlMessage(player, html);
return;
}
@@ -394,9 +394,9 @@ public class L2FortManagerInstance extends L2MerchantInstance
cost = Config.FS_MPREG2_FEE;
break;
}
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_MPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Provides additional MP recovery for clan members in the fortress.<font color=\"00FFFF\">" + String.valueOf(percent) + "%</font>");
html.replace("%apply%", "recovery mp " + String.valueOf(percent));
html.replace("%cost%", cost + "</font>Adena /" + (Config.FS_MPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Provides additional MP recovery for clan members in the fortress.<font color=\"00FFFF\">" + percent + "%</font>");
html.replace("%apply%", "recovery mp " + percent);
sendHtmlMessage(player, html);
return;
}
@@ -417,9 +417,9 @@ public class L2FortManagerInstance extends L2MerchantInstance
cost = Config.FS_EXPREG2_FEE;
break;
}
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_EXPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Restores the Exp of any clan member who is resurrected in the fortress.<font color=\"00FFFF\">" + String.valueOf(percent) + "%</font>");
html.replace("%apply%", "recovery exp " + String.valueOf(percent));
html.replace("%cost%", cost + "</font>Adena /" + (Config.FS_EXPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Restores the Exp of any clan member who is resurrected in the fortress.<font color=\"00FFFF\">" + percent + "%</font>");
html.replace("%apply%", "recovery exp " + percent);
sendHtmlMessage(player, html);
return;
}
@@ -440,7 +440,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
if (getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getLvl() == Integer.parseInt(val))
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/functions-used.htm");
html.replace("%val%", String.valueOf(val) + "%");
html.replace("%val%", val + "%");
sendHtmlMessage(player, html);
return;
}
@@ -485,7 +485,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
if (getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getLvl() == Integer.parseInt(val))
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/functions-used.htm");
html.replace("%val%", String.valueOf(val) + "%");
html.replace("%val%", val + "%");
sendHtmlMessage(player, html);
return;
}
@@ -530,7 +530,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
if (getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getLvl() == Integer.parseInt(val))
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/functions-used.htm");
html.replace("%val%", String.valueOf(val) + "%");
html.replace("%val%", val + "%");
sendHtmlMessage(player, html);
return;
}
@@ -566,7 +566,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
final String mp = "[<a action=\"bypass -h npc_%objectId%_manage recovery edit_mp 40\">40%</a>][<a action=\"bypass -h npc_%objectId%_manage recovery edit_mp 50\">50%</a>]";
if (getFort().getFortFunction(Fort.FUNC_RESTORE_HP) != null)
{
html.replace("%hp_recovery%", String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getLvl()) + "%</font> (<font color=\"FFAABB\">" + String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getLease()) + "</font>Adena /" + String.valueOf(Config.FS_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%hp_recovery%", getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getLvl() + "%</font> (<font color=\"FFAABB\">" + getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getLease() + "</font>Adena /" + (Config.FS_HPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%hp_period%", "Withdraw the fee for the next time at " + format.format(getFort().getFortFunction(Fort.FUNC_RESTORE_HP).getEndTime()));
html.replace("%change_hp%", "[<a action=\"bypass -h npc_%objectId%_manage recovery hp_cancel\">Deactivate</a>]" + hp);
}
@@ -578,7 +578,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
}
if (getFort().getFortFunction(Fort.FUNC_RESTORE_EXP) != null)
{
html.replace("%exp_recovery%", String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getLvl()) + "%</font> (<font color=\"FFAABB\">" + String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getLease()) + "</font>Adena /" + String.valueOf(Config.FS_EXPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%exp_recovery%", getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getLvl() + "%</font> (<font color=\"FFAABB\">" + getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getLease() + "</font>Adena /" + (Config.FS_EXPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%exp_period%", "Withdraw the fee for the next time at " + format.format(getFort().getFortFunction(Fort.FUNC_RESTORE_EXP).getEndTime()));
html.replace("%change_exp%", "[<a action=\"bypass -h npc_%objectId%_manage recovery exp_cancel\">Deactivate</a>]" + exp);
}
@@ -590,7 +590,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
}
if (getFort().getFortFunction(Fort.FUNC_RESTORE_MP) != null)
{
html.replace("%mp_recovery%", String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getLvl()) + "%</font> (<font color=\"FFAABB\">" + String.valueOf(getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getLease()) + "</font>Adena /" + String.valueOf(Config.FS_MPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%mp_recovery%", getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getLvl() + "%</font> (<font color=\"FFAABB\">" + getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getLease() + "</font>Adena /" + (Config.FS_MPREG_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%mp_period%", "Withdraw the fee for the next time at " + format.format(getFort().getFortFunction(Fort.FUNC_RESTORE_MP).getEndTime()));
html.replace("%change_mp%", "[<a action=\"bypass -h npc_%objectId%_manage recovery mp_cancel\">Deactivate</a>]" + mp);
}
@@ -645,9 +645,9 @@ public class L2FortManagerInstance extends L2MerchantInstance
cost = Config.FS_SUPPORT2_FEE;
break;
}
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_SUPPORT_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%cost%", cost + "</font>Adena /" + (Config.FS_SUPPORT_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Enables the use of supplementary magic.");
html.replace("%apply%", "other support " + String.valueOf(stage));
html.replace("%apply%", "other support " + stage);
sendHtmlMessage(player, html);
return;
}
@@ -668,9 +668,9 @@ public class L2FortManagerInstance extends L2MerchantInstance
cost = Config.FS_TELE2_FEE;
break;
}
html.replace("%cost%", String.valueOf(cost) + "</font>Adena /" + String.valueOf(Config.FS_TELE_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Teleports clan members in a fort to the target <font color=\"00FFFF\">Stage " + String.valueOf(stage) + "</font> staging area");
html.replace("%apply%", "other tele " + String.valueOf(stage));
html.replace("%cost%", cost + "</font>Adena /" + (Config.FS_TELE_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day</font>)");
html.replace("%use%", "Teleports clan members in a fort to the target <font color=\"00FFFF\">Stage " + stage + "</font> staging area");
html.replace("%apply%", "other tele " + stage);
sendHtmlMessage(player, html);
return;
}
@@ -691,7 +691,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
if (getFort().getFortFunction(Fort.FUNC_TELEPORT).getLvl() == Integer.parseInt(val))
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/functions-used.htm");
html.replace("%val%", "Stage " + String.valueOf(val));
html.replace("%val%", "Stage " + val);
sendHtmlMessage(player, html);
return;
}
@@ -736,7 +736,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
if (getFort().getFortFunction(Fort.FUNC_SUPPORT).getLvl() == Integer.parseInt(val))
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/functions-used.htm");
html.replace("%val%", "Stage " + String.valueOf(val));
html.replace("%val%", "Stage " + val);
sendHtmlMessage(player, html);
return;
}
@@ -774,7 +774,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
final String support = "[<a action=\"bypass -h npc_%objectId%_manage other edit_support 1\">Level 1</a>][<a action=\"bypass -h npc_%objectId%_manage other edit_support 2\">Level 2</a>]";
if (getFort().getFortFunction(Fort.FUNC_TELEPORT) != null)
{
html.replace("%tele%", "Stage " + String.valueOf(getFort().getFortFunction(Fort.FUNC_TELEPORT).getLvl()) + "</font> (<font color=\"FFAABB\">" + String.valueOf(getFort().getFortFunction(Fort.FUNC_TELEPORT).getLease()) + "</font>Adena /" + String.valueOf(Config.FS_TELE_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%tele%", "Stage " + getFort().getFortFunction(Fort.FUNC_TELEPORT).getLvl() + "</font> (<font color=\"FFAABB\">" + getFort().getFortFunction(Fort.FUNC_TELEPORT).getLease() + "</font>Adena /" + (Config.FS_TELE_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%tele_period%", "Withdraw the fee for the next time at " + format.format(getFort().getFortFunction(Fort.FUNC_TELEPORT).getEndTime()));
html.replace("%change_tele%", "[<a action=\"bypass -h npc_%objectId%_manage other tele_cancel\">Deactivate</a>]" + tele);
}
@@ -786,7 +786,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
}
if (getFort().getFortFunction(Fort.FUNC_SUPPORT) != null)
{
html.replace("%support%", "Stage " + String.valueOf(getFort().getFortFunction(Fort.FUNC_SUPPORT).getLvl()) + "</font> (<font color=\"FFAABB\">" + String.valueOf(getFort().getFortFunction(Fort.FUNC_SUPPORT).getLease()) + "</font>Adena /" + String.valueOf(Config.FS_SUPPORT_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%support%", "Stage " + getFort().getFortFunction(Fort.FUNC_SUPPORT).getLvl() + "</font> (<font color=\"FFAABB\">" + getFort().getFortFunction(Fort.FUNC_SUPPORT).getLease() + "</font>Adena /" + (Config.FS_SUPPORT_FEE_RATIO / 1000 / 60 / 60 / 24) + " Day)");
html.replace("%support_period%", "Withdraw the fee for the next time at " + format.format(getFort().getFortFunction(Fort.FUNC_SUPPORT).getEndTime()));
html.replace("%change_support%", "[<a action=\"bypass -h npc_%objectId%_manage other support_cancel\">Deactivate</a>]" + support);
}
@@ -850,19 +850,16 @@ public class L2FortManagerInstance extends L2MerchantInstance
{
player.doCast(skill);
}
else if (!((skill.getMpConsume() + skill.getMpInitialConsume()) > getCurrentMp()))
{
doCast(skill);
}
else
{
if (!((skill.getMpConsume() + skill.getMpInitialConsume()) > getCurrentMp()))
{
this.doCast(skill);
}
else
{
html.setFile(player.getHtmlPrefix(), "data/html/fortress/support-no_mana.htm");
html.replace("%mp%", String.valueOf((int) getCurrentMp()));
sendHtmlMessage(player, html);
return;
}
html.setFile(player.getHtmlPrefix(), "data/html/fortress/support-no_mana.htm");
html.replace("%mp%", String.valueOf((int) getCurrentMp()));
sendHtmlMessage(player, html);
return;
}
html.setFile(player.getHtmlPrefix(), "data/html/fortress/support-done.htm");
html.replace("%mp%", String.valueOf((int) getCurrentMp()));

View File

@@ -146,18 +146,15 @@ public class L2NpcInstance extends L2Npc
sm.addInt(minLevel);
player.sendPacket(sm);
}
else if (player.getClassId().level() == 1)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN_PLEASE_COME_BACK_AFTER_S1ND_CLASS_CHANGE);
sm.addInt(2);
player.sendPacket(sm);
}
else
{
if (player.getClassId().level() == 1)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN_PLEASE_COME_BACK_AFTER_S1ND_CLASS_CHANGE);
sm.addInt(2);
player.sendPacket(sm);
}
else
{
player.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN);
}
player.sendPacket(SystemMessageId.THERE_ARE_NO_OTHER_SKILLS_TO_LEARN);
}
}
else

View File

@@ -49,16 +49,13 @@ public final class L2ObservationInstance extends L2Npc
filename = "data/html/observation/" + getId() + "-Oracle-" + val + ".htm";
}
}
else if (val == 0)
{
filename = "data/html/observation/" + getId() + ".htm";
}
else
{
if (val == 0)
{
filename = "data/html/observation/" + getId() + ".htm";
}
else
{
filename = "data/html/observation/" + getId() + "-" + val + ".htm";
}
filename = "data/html/observation/" + getId() + "-" + val + ".htm";
}
final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());

View File

@@ -3287,20 +3287,17 @@ public final class L2PcInstance extends L2Playable
sendPacket(sm);
}
}
else if (process.equalsIgnoreCase("Sweeper") || process.equalsIgnoreCase("Quest"))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
sm.addItemName(itemId);
sendPacket(sm);
}
else
{
if (process.equalsIgnoreCase("Sweeper") || process.equalsIgnoreCase("Quest"))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
sm.addItemName(itemId);
sendPacket(sm);
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S1);
sm.addItemName(itemId);
sendPacket(sm);
}
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_OBTAINED_S1);
sm.addItemName(itemId);
sendPacket(sm);
}
}
@@ -3967,18 +3964,15 @@ public final class L2PcInstance extends L2Playable
{
client.cleanMe(true);
}
else
else if (client.getChannel().isActive())
{
if (client.getChannel().isActive())
if (closeClient)
{
if (closeClient)
{
client.close(LeaveWorld.STATIC_PACKET);
}
else
{
client.close(ServerClose.STATIC_PACKET);
}
client.close(LeaveWorld.STATIC_PACKET);
}
else
{
client.close(ServerClose.STATIC_PACKET);
}
}
}
@@ -4372,13 +4366,9 @@ public final class L2PcInstance extends L2Playable
}
}
else
else if (target != null) // _interactTarget=null should never happen but one never knows ^^;
{
// _interactTarget=null should never happen but one never knows ^^;
if (target != null)
{
target.onAction(this);
}
target.onAction(this);
}
}
@@ -5257,19 +5247,16 @@ public final class L2PcInstance extends L2Playable
player.setPvpKills(player.getPvpKills() + 1);
}
else if ((getReputation() > 0) && (getPkKills() == 0))
{
player.setReputation(0);
player.setPkKills(player.getPkKills() + 1);
}
else
{
if ((getReputation() > 0) && (getPkKills() == 0))
{
player.setReputation(0);
player.setPkKills(player.getPkKills() + 1);
}
else
{
// Calculate new karma and increase pk count
player.setReputation(player.getReputation() - Formulas.calculateKarmaGain(player.getPkKills(), killedPlayable.isSummon()));
player.setPkKills(player.getPkKills() + 1);
}
// Calculate new karma and increase pk count
player.setReputation(player.getReputation() - Formulas.calculateKarmaGain(player.getPkKills(), killedPlayable.isSummon()));
player.setPkKills(player.getPkKills() + 1);
}
final UserInfo ui = new UserInfo(this, false);
@@ -9288,7 +9275,7 @@ public final class L2PcInstance extends L2Playable
public void sendSkillList(int lastLearnedSkillId)
{
boolean isDisabled = false;
SkillList sl = new SkillList();
final SkillList sl = new SkillList();
for (Skill s : getSkillList())
{
@@ -9969,16 +9956,13 @@ public final class L2PcInstance extends L2Playable
{
reviver.sendPacket(SystemMessageId.RESURRECTION_HAS_ALREADY_BEEN_PROPOSED); // Resurrection is already been proposed.
}
else if (Pet)
{
reviver.sendPacket(SystemMessageId.A_PET_CANNOT_BE_RESURRECTED_WHILE_IT_S_OWNER_IS_IN_THE_PROCESS_OF_RESURRECTING); // A pet cannot be resurrected while it's owner is in the process of resurrecting.
}
else
{
if (Pet)
{
reviver.sendPacket(SystemMessageId.A_PET_CANNOT_BE_RESURRECTED_WHILE_IT_S_OWNER_IS_IN_THE_PROCESS_OF_RESURRECTING); // A pet cannot be resurrected while it's owner is in the process of resurrecting.
}
else
{
reviver.sendPacket(SystemMessageId.WHILE_A_PET_IS_BEING_RESURRECTED_IT_CANNOT_HELP_IN_RESURRECTING_ITS_MASTER); // While a pet is attempting to resurrect, it cannot help in resurrecting its master.
}
reviver.sendPacket(SystemMessageId.WHILE_A_PET_IS_BEING_RESURRECTED_IT_CANNOT_HELP_IN_RESURRECTING_ITS_MASTER); // While a pet is attempting to resurrect, it cannot help in resurrecting its master.
}
return;
}
@@ -10190,13 +10174,10 @@ public final class L2PcInstance extends L2Playable
}
}
}
else
else if (_teleportWatchdog != null)
{
if (_teleportWatchdog != null)
{
_teleportWatchdog.cancel(false);
_teleportWatchdog = null;
}
_teleportWatchdog.cancel(false);
_teleportWatchdog = null;
}
}

View File

@@ -214,7 +214,7 @@ public class L2PetInstance extends L2Summon
}
}
public synchronized static L2PetInstance spawnPet(L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control)
public static synchronized L2PetInstance spawnPet(L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control)
{
if (L2World.getInstance().getPet(owner.getObjectId()) != null)
{

View File

@@ -162,7 +162,7 @@ public final class L2StaticObjectInstance extends L2Character
public void setMeshIndex(int meshIndex)
{
_meshIndex = meshIndex;
this.broadcastPacket(new StaticObject(this));
broadcastPacket(new StaticObject(this));
}
/**

View File

@@ -257,7 +257,7 @@ public enum PlayerClass
_type = pType;
}
public static final EnumSet<PlayerClass> getSet(Race race, ClassLevel level)
public static EnumSet<PlayerClass> getSet(Race race, ClassLevel level)
{
final EnumSet<PlayerClass> allOf = EnumSet.noneOf(PlayerClass.class);

View File

@@ -80,7 +80,8 @@ public class CubicInstance
double commulativeChance = 0;
for (CubicSkill cubicSkill : _template.getSkills())
{
if ((commulativeChance += cubicSkill.getTriggerRate()) > random)
commulativeChance += cubicSkill.getTriggerRate();
if (commulativeChance > random)
{
final Skill skill = cubicSkill.getSkill();
if ((skill != null) && (Rnd.get(100) < cubicSkill.getSuccessRate()))

View File

@@ -24,7 +24,7 @@ import com.l2jmobius.gameserver.model.cubic.conditions.ICubicCondition;
*/
public interface ICubicConditionHolder
{
public boolean validateConditions(CubicInstance cubic, L2Character owner, L2Character target);
boolean validateConditions(CubicInstance cubic, L2Character owner, L2Character target);
public void addCondition(ICubicCondition condition);
void addCondition(ICubicCondition condition);
}

View File

@@ -24,5 +24,5 @@ import com.l2jmobius.gameserver.model.cubic.CubicInstance;
*/
public interface ICubicCondition
{
public boolean test(CubicInstance cubic, L2Character owner, L2Character target);
boolean test(CubicInstance cubic, L2Character owner, L2Character target);
}

View File

@@ -353,16 +353,13 @@ public final class Castle extends AbstractResidence
}
_treasury -= amount;
}
else if ((_treasury + amount) > Inventory.MAX_ADENA)
{
_treasury = Inventory.MAX_ADENA;
}
else
{
if ((_treasury + amount) > Inventory.MAX_ADENA)
{
_treasury = Inventory.MAX_ADENA;
}
else
{
_treasury += amount;
}
_treasury += amount;
}
try (Connection con = DatabaseFactory.getInstance().getConnection();
@@ -750,26 +747,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;

View File

@@ -920,20 +920,17 @@ public class Duel
}
}
else
else if (player == _playerA)
{
if (player == _playerA)
{
_surrenderRequest = 1;
_playerA.setDuelState(DUELSTATE_DEAD);
_playerB.setDuelState(DUELSTATE_WINNER);
}
else if (player == _playerB)
{
_surrenderRequest = 2;
_playerB.setDuelState(DUELSTATE_DEAD);
_playerA.setDuelState(DUELSTATE_WINNER);
}
_surrenderRequest = 1;
_playerA.setDuelState(DUELSTATE_DEAD);
_playerB.setDuelState(DUELSTATE_WINNER);
}
else if (player == _playerB)
{
_surrenderRequest = 2;
_playerB.setDuelState(DUELSTATE_DEAD);
_playerA.setDuelState(DUELSTATE_WINNER);
}
}

View File

@@ -268,11 +268,7 @@ public final class Fort extends AbstractResidence
*/
public FortFunction getFortFunction(int type)
{
if (_function.get(type) != null)
{
return _function.get(type);
}
return null;
return _function.get(type);
}
public void endOfSiege(L2Clan clan)
@@ -690,26 +686,23 @@ public final class Fort extends AbstractResidence
{
_function.put(type, new FortFunction(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 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;

View File

@@ -169,7 +169,7 @@ public class FortSiege implements Siegable
}
else
{
_log.warning(getClass().getSimpleName() + ": Exception: ScheduleStartSiegeTask(): unknown siege time: " + String.valueOf(_time));
_log.warning(getClass().getSimpleName() + ": Exception: ScheduleStartSiegeTask(): unknown siege time: " + _time);
}
}
catch (Exception e)

View File

@@ -1454,12 +1454,9 @@ public class Siege implements Siegable
return;
}
}
else
else if (getAttackerClans().size() >= SiegeManager.getInstance().getAttackerMaxClans())
{
if (getAttackerClans().size() >= SiegeManager.getInstance().getAttackerMaxClans())
{
return;
}
return;
}
if (!isUpdateRegistration)
@@ -1668,10 +1665,6 @@ public class Siege implements Siegable
public final Castle getCastle()
{
if (_castle == null)
{
return null;
}
return _castle;
}

View File

@@ -21,7 +21,7 @@ package com.l2jmobius.gameserver.model.eventengine;
*/
public interface IConditionalEventScheduler
{
public boolean test();
boolean test();
public void run();
void run();
}

View File

@@ -25,5 +25,5 @@ import com.l2jmobius.gameserver.model.holders.ItemHolder;
*/
public interface IEventDrop
{
public Collection<ItemHolder> calculateDrops();
Collection<ItemHolder> calculateDrops();
}

View File

@@ -2438,21 +2438,18 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
player.sendPacket(smsg);
}
// Otherwise, send message of object reward to client
else if (count > 1)
{
final SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
smsg.addItemName(item);
smsg.addLong(count);
player.sendPacket(smsg);
}
else
{
if (count > 1)
{
final SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
smsg.addItemName(item);
smsg.addLong(count);
player.sendPacket(smsg);
}
else
{
final SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
smsg.addItemName(item);
player.sendPacket(smsg);
}
final SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
smsg.addItemName(item);
player.sendPacket(smsg);
}
// send packets
player.sendPacket(new ExUserInfoInvenWeight(player));

View File

@@ -23,7 +23,7 @@ import com.l2jmobius.gameserver.model.html.IBypassFormatter;
*/
public class DefaultFormatter implements IBypassFormatter
{
public final static DefaultFormatter INSTANCE = new DefaultFormatter();
public static final DefaultFormatter INSTANCE = new DefaultFormatter();
@Override
public String formatBypass(String bypass, int page)

View File

@@ -402,12 +402,9 @@ public final class Instance implements IIdentifiable, INamable
door.openMe();
}
}
else
else if (door.isOpen())
{
if (door.isOpen())
{
door.closeMe();
}
door.closeMe();
}
}
}

View File

@@ -55,7 +55,7 @@ public final class AuctionDateGenerator
checkMinuteOfHour(0);
}
public synchronized final long nextDate(long date)
public final synchronized long nextDate(long date)
{
_calendar.setTimeInMillis(date);
_calendar.set(Calendar.MILLISECOND, 0);

View File

@@ -412,7 +412,7 @@ public final class ItemAuctionInstance
{
if (!_auction.setAuctionState(state, ItemAuctionState.STARTED))
{
throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.STARTED.toString() + ", expected: " + state.toString());
throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.STARTED + ", expected: " + state);
}
LOGGER.info(getClass().getSimpleName() + ": Auction " + _auction.getAuctionId() + " has started for instance " + _auction.getInstanceId());
@@ -470,7 +470,7 @@ public final class ItemAuctionInstance
if (!_auction.setAuctionState(state, ItemAuctionState.FINISHED))
{
throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.FINISHED.toString() + ", expected: " + state.toString());
throw new IllegalStateException("Could not set auction state: " + ItemAuctionState.FINISHED + ", expected: " + state);
}
onAuctionFinished(_auction);

View File

@@ -478,7 +478,7 @@ public abstract class ItemContainer
*/
public L2ItemInstance destroyItem(String process, L2ItemInstance item, L2PcInstance actor, Object reference)
{
return this.destroyItem(process, item, item.getCount(), actor, reference);
return destroyItem(process, item, item.getCount(), actor, reference);
}
/**
@@ -547,7 +547,7 @@ public abstract class ItemContainer
{
return null;
}
return this.destroyItem(process, item, count, actor, reference);
return destroyItem(process, item, count, actor, reference);
}
/**

View File

@@ -580,7 +580,7 @@ public class PcInventory extends Inventory
@Override
public L2ItemInstance destroyItem(String process, L2ItemInstance item, L2PcInstance actor, Object reference)
{
return this.destroyItem(process, item, item.getCount(), actor, reference);
return destroyItem(process, item, item.getCount(), actor, reference);
}
/**
@@ -631,7 +631,7 @@ public class PcInventory extends Inventory
{
return null;
}
return this.destroyItem(process, item, count, actor, reference);
return destroyItem(process, item, count, actor, reference);
}
/**
@@ -651,7 +651,7 @@ public class PcInventory extends Inventory
{
return null;
}
return this.destroyItem(process, item, count, actor, reference);
return destroyItem(process, item, count, actor, reference);
}
/**

View File

@@ -1430,7 +1430,7 @@ public final class L2ItemInstance extends L2Object
*/
public void updateDatabase()
{
this.updateDatabase(false);
updateDatabase(false);
}
/**

View File

@@ -782,7 +782,7 @@ public class SkillCaster implements Runnable
@Override
public String toString()
{
return super.toString() + " [caster: " + String.valueOf(_caster.get()) + " skill: " + String.valueOf(_skill) + " target: " + String.valueOf(_target.get()) + " type: " + String.valueOf(_castingType) + "]";
return super.toString() + " [caster: " + _caster.get() + " skill: " + _skill + " target: " + _target.get() + " type: " + _castingType + "]";
}
/**

View File

@@ -233,7 +233,8 @@ public class NpcSpawnTemplate implements Cloneable, IParameterized<StatsSet>
float cumulativeChance = 0;
for (ChanceLocation loc : _locations)
{
if (locRandom <= (cumulativeChance += loc.getChance()))
cumulativeChance += loc.getChance();
if (locRandom <= cumulativeChance)
{
return loc;
}

View File

@@ -439,7 +439,7 @@ public final class Formulas
* @param skill
* @return the hit time of the skill.
*/
public static final int calcHitTime(L2Character creature, Skill skill)
public static int calcHitTime(L2Character creature, Skill skill)
{
int skillTime = skill.getHitTime() - SKILL_LAUNCH_TIME;
@@ -457,7 +457,7 @@ public final class Formulas
return Math.max(skillTime, 0);
}
public static final int calcSkillCancelTime(L2Character creature, Skill skill)
public static int calcSkillCancelTime(L2Character creature, Skill skill)
{
// Fishing skills.
if ((skill.getId() == 1312) || (skill.getId() == 1314) || (skill.getId() == 1315))
@@ -474,7 +474,7 @@ public final class Formulas
* @param skill
* @return
*/
public static final double calcSkillTimeFactor(L2Character creature, Skill skill)
public static double calcSkillTimeFactor(L2Character creature, Skill skill)
{
double factor = 0;
if (skill.isPhysical() || skill.isDance()) // is_magic = 0 or 3
@@ -980,18 +980,15 @@ public final class Formulas
attack_attribute = 0;
defence_attribute = target.getDefenseElementValue(AttributeType.NONE_ARMOR);
}
else if (attacker.getAttackElement() == skill.getAttributeType())
{
attack_attribute = attacker.getAttackElementValue(attacker.getAttackElement()) + skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(attacker.getAttackElement());
}
else
{
if (attacker.getAttackElement() == skill.getAttributeType())
{
attack_attribute = attacker.getAttackElementValue(attacker.getAttackElement()) + skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(attacker.getAttackElement());
}
else
{
attack_attribute = skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(skill.getAttributeType());
}
attack_attribute = skill.getAttributeValue();
defence_attribute = target.getDefenseElementValue(skill.getAttributeType());
}
}
else

View File

@@ -569,5 +569,5 @@ public interface IStatsFunction
return Math.max(minValue, value);
}
public double calc(L2Character creature, Optional<Double> base, Stats stat);
double calc(L2Character creature, Optional<Double> base, Stats stat);
}

View File

@@ -32,7 +32,7 @@ public class ShieldDefenceFinalizer implements IStatsFunction
{
throwIfPresent(base);
double baseValue = calcWeaponPlusBaseValue(creature, stat);
final double baseValue = calcWeaponPlusBaseValue(creature, stat);
return Stats.defaultValue(creature, stat, baseValue);
}
}

View File

@@ -32,7 +32,7 @@ public class ShieldDefenceRateFinalizer implements IStatsFunction
{
throwIfPresent(base);
double baseValue = calcWeaponPlusBaseValue(creature, stat);
final double baseValue = calcWeaponPlusBaseValue(creature, stat);
return Stats.defaultValue(creature, stat, baseValue);
}
}

View File

@@ -125,16 +125,13 @@ public final class Attack implements IClientIncomingPacket
{
target.onAction(activeChar);
}
else if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
{
target.onForcedAttack(activeChar);
}
else
{
if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
{
target.onForcedAttack(activeChar);
}
else
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
}
}

View File

@@ -114,16 +114,13 @@ public final class AttackRequest implements IClientIncomingPacket
{
target.onAction(activeChar);
}
else if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
{
target.onForcedAttack(activeChar);
}
else
{
if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
{
target.onForcedAttack(activeChar);
}
else
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
}
}

View File

@@ -93,7 +93,7 @@ public final class RequestActionUse implements IClientIncomingPacket
if (!(Arrays.binarySearch(allowedActions, _actionId) >= 0))
{
client.sendPacket(ActionFailed.STATIC_PACKET);
_log.warning("Player " + activeChar + " used action which he does not have! Id = " + _actionId + " transform: " + String.valueOf(activeChar.getTransformation().orElse(null)));
_log.warning("Player " + activeChar + " used action which he does not have! Id = " + _actionId + " transform: " + activeChar.getTransformation().orElse(null));
return;
}
}

View File

@@ -106,12 +106,9 @@ public final class RequestAnswerJoinParty implements IClientIncomingPacket
party.removePartyMember(requestor, MessageType.NONE);
}
}
else
else if (party.getMemberCount() == 1)
{
if (party.getMemberCount() == 1)
{
party.removePartyMember(requestor, MessageType.NONE);
}
party.removePartyMember(requestor, MessageType.NONE);
}
party.setPendingInvitation(false);

View File

@@ -305,7 +305,7 @@ public final class RequestBypassToServer implements IClientIncomingPacket
sb.append("StackTrace:<br1>");
for (StackTraceElement ste : e.getStackTrace())
{
sb.append(ste.toString() + "<br1>");
sb.append(ste + "<br1>");
}
sb.append("</body></html>");
// item html

View File

@@ -90,12 +90,9 @@ public final class RequestConfirmSiegeWaitingList implements IClientIncomingPack
return;
}
}
else
else if ((castle.getSiege().checkIsDefenderWaiting(clan)) || (castle.getSiege().checkIsDefender(clan)))
{
if ((castle.getSiege().checkIsDefenderWaiting(clan)) || (castle.getSiege().checkIsDefender(clan)))
{
castle.getSiege().removeSiegeClan(_clanId);
}
castle.getSiege().removeSiegeClan(_clanId);
}
}

View File

@@ -202,16 +202,13 @@ public final class RequestEnchantItem implements IClientIncomingPacket
_logEnchant.info("Success, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
}
else if (support == null)
{
_logEnchant.info("Success, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
}
else
{
if (support == null)
{
_logEnchant.info("Success, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
}
else
{
_logEnchant.info("Success, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
_logEnchant.info("Success, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
}
@@ -268,16 +265,13 @@ public final class RequestEnchantItem implements IClientIncomingPacket
_logEnchant.info("Safe Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
}
else if (support == null)
{
_logEnchant.info("Safe Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
}
else
{
if (support == null)
{
_logEnchant.info("Safe Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
}
else
{
_logEnchant.info("Safe Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
_logEnchant.info("Safe Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
}
}
@@ -332,16 +326,13 @@ public final class RequestEnchantItem implements IClientIncomingPacket
_logEnchant.info("Blessed Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
}
else if (support == null)
{
_logEnchant.info("Blessed Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
}
else
{
if (support == null)
{
_logEnchant.info("Blessed Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
}
else
{
_logEnchant.info("Blessed Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
_logEnchant.info("Blessed Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
}
}
@@ -375,16 +366,13 @@ public final class RequestEnchantItem implements IClientIncomingPacket
_logEnchant.info("Unable to destroy, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
}
else if (support == null)
{
_logEnchant.info("Unable to destroy, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
}
else
{
if (support == null)
{
_logEnchant.info("Unable to destroy, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
}
else
{
_logEnchant.info("Unable to destroy, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
_logEnchant.info("Unable to destroy, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
}
return;
@@ -432,16 +420,13 @@ public final class RequestEnchantItem implements IClientIncomingPacket
_logEnchant.info("Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", +" + item.getEnchantLevel() + " " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
}
else if (support == null)
{
_logEnchant.info("Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
}
else
{
if (support == null)
{
_logEnchant.info("Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "]");
}
else
{
_logEnchant.info("Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
_logEnchant.info("Fail, Character:" + activeChar.getName() + " [" + activeChar.getObjectId() + "] Account:" + activeChar.getAccountName() + " IP:" + activeChar.getIPAddress() + ", " + item.getName() + "(" + item.getCount() + ") [" + item.getObjectId() + "], " + scroll.getName() + "(" + scroll.getCount() + ") [" + scroll.getObjectId() + "], " + support.getName() + "(" + support.getCount() + ") [" + support.getObjectId() + "]");
}
}
}

View File

@@ -68,31 +68,28 @@ public final class RequestPetitionCancel implements IClientIncomingPacket
activeChar.sendPacket(SystemMessageId.YOUR_PETITION_IS_BEING_PROCESSED);
}
}
else
else if (PetitionManager.getInstance().isPlayerPetitionPending(activeChar))
{
if (PetitionManager.getInstance().isPlayerPetitionPending(activeChar))
if (PetitionManager.getInstance().cancelActivePetition(activeChar))
{
if (PetitionManager.getInstance().cancelActivePetition(activeChar))
{
final int numRemaining = Config.MAX_PETITIONS_PER_PLAYER - PetitionManager.getInstance().getPlayerTotalPetitionCount(activeChar);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_PETITION_WAS_CANCELED_YOU_MAY_SUBMIT_S1_MORE_PETITION_S_TODAY);
sm.addString(String.valueOf(numRemaining));
activeChar.sendPacket(sm);
// Notify all GMs that the player's pending petition has been cancelled.
final String msgContent = activeChar.getName() + " has canceled a pending petition.";
AdminData.getInstance().broadcastToGMs(new CreatureSay(activeChar.getObjectId(), ChatType.HERO_VOICE, "Petition System", msgContent));
}
else
{
activeChar.sendPacket(SystemMessageId.FAILED_TO_CANCEL_PETITION_PLEASE_TRY_AGAIN_LATER);
}
final int numRemaining = Config.MAX_PETITIONS_PER_PLAYER - PetitionManager.getInstance().getPlayerTotalPetitionCount(activeChar);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_PETITION_WAS_CANCELED_YOU_MAY_SUBMIT_S1_MORE_PETITION_S_TODAY);
sm.addString(String.valueOf(numRemaining));
activeChar.sendPacket(sm);
// Notify all GMs that the player's pending petition has been cancelled.
final String msgContent = activeChar.getName() + " has canceled a pending petition.";
AdminData.getInstance().broadcastToGMs(new CreatureSay(activeChar.getObjectId(), ChatType.HERO_VOICE, "Petition System", msgContent));
}
else
{
activeChar.sendPacket(SystemMessageId.YOU_HAVE_NOT_SUBMITTED_A_PETITION);
activeChar.sendPacket(SystemMessageId.FAILED_TO_CANCEL_PETITION_PLEASE_TRY_AGAIN_LATER);
}
}
else
{
activeChar.sendPacket(SystemMessageId.YOU_HAVE_NOT_SUBMITTED_A_PETITION);
}
}
}

View File

@@ -114,7 +114,7 @@ public final class Say2 implements IClientIncomingPacket
ChatType chatType = ChatType.findByClientId(_type);
if (chatType == null)
{
_log.warning("Say2: Invalid type: " + _type + " Player : " + activeChar.getName() + " text: " + String.valueOf(_text));
_log.warning("Say2: Invalid type: " + _type + " Player : " + activeChar.getName() + " text: " + _text);
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
activeChar.logout();
return;
@@ -155,12 +155,9 @@ public final class Say2 implements IClientIncomingPacket
{
activeChar.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REPORTED_AS_AN_ILLEGAL_PROGRAM_USER_SO_CHATTING_IS_NOT_ALLOWED);
}
else
else if (Config.BAN_CHAT_CHANNELS.contains(chatType))
{
if (Config.BAN_CHAT_CHANNELS.contains(chatType))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
}
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
}
return;
}

View File

@@ -116,13 +116,10 @@ public final class SendWareHouseWithDrawList implements IClientIncomingPacket
return;
}
}
else
else if ((warehouse instanceof ClanWarehouse) && !player.isClanLeader())
{
if ((warehouse instanceof ClanWarehouse) && !player.isClanLeader())
{
player.sendPacket(SystemMessageId.ITEMS_LEFT_AT_THE_CLAN_HALL_WAREHOUSE_CAN_ONLY_BE_RETRIEVED_BY_THE_CLAN_LEADER_DO_YOU_WANT_TO_CONTINUE);
return;
}
player.sendPacket(SystemMessageId.ITEMS_LEFT_AT_THE_CLAN_HALL_WAREHOUSE_CAN_ONLY_BE_RETRIEVED_BY_THE_CLAN_LEADER_DO_YOU_WANT_TO_CONTINUE);
return;
}
int weight = 0;

View File

@@ -93,7 +93,8 @@ public class RequestExTryToPutShapeShiftingEnchantSupportItem implements IClient
return;
}
if ((stone = inventory.getItemByObjectId(stone.getObjectId())) == null)
stone = inventory.getItemByObjectId(stone.getObjectId());
if (stone == null)
{
client.sendPacket(ExShapeShiftingResult.FAILED);
player.removeRequest(ShapeShiftingItemRequest.class);

View File

@@ -91,7 +91,8 @@ public class RequestExTryToPutShapeShiftingTargetItem implements IClientIncoming
return;
}
if ((stone = inventory.getItemByObjectId(stone.getObjectId())) == null)
stone = inventory.getItemByObjectId(stone.getObjectId());
if (stone == null)
{
client.sendPacket(ExPutShapeShiftingTargetItemResult.FAILED);
player.removeRequest(ShapeShiftingItemRequest.class);

View File

@@ -105,7 +105,8 @@ public class RequestShapeShiftingItem implements IClientIncomingPacket
return;
}
if ((stone = inventory.getItemByObjectId(stone.getObjectId())) == null)
stone = inventory.getItemByObjectId(stone.getObjectId());
if (stone == null)
{
client.sendPacket(ExShapeShiftingResult.FAILED);
player.removeRequest(ShapeShiftingItemRequest.class);

View File

@@ -52,13 +52,13 @@ public class RequestTodoList implements IClientIncomingPacket
{
// case 1:
// {
// player.sendPacket(new ExTodoListInzone());
// break;
// player.sendPacket(new ExTodoListInzone());
// break;
// }
// case 2:
// {
// player.sendPacket(new ExTodoListInzone());
// break;
// player.sendPacket(new ExTodoListInzone());
// break;
// }
case 9:
{

View File

@@ -72,32 +72,29 @@ public class ConfirmMenteeAdd implements IClientIncomingPacket
mentee.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_DECLINED_S1_S_MENTORING_OFFER).addCharName(mentor));
mentor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_DECLINED_BECOMING_YOUR_MENTEE).addCharName(mentee));
}
else
else if (validate(mentor, mentee))
{
if (validate(mentor, mentee))
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
statement.setInt(1, mentee.getObjectId());
statement.setInt(2, mentor.getObjectId());
statement.execute();
MentorManager.getInstance().addMentor(mentor.getObjectId(), mentee.getObjectId());
// Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerMenteeAdd(mentor, mentee), mentor);
mentor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FROM_NOW_ON_S1_WILL_BE_YOUR_MENTEE).addCharName(mentee));
mentor.sendPacket(new ExMentorList(mentor));
mentee.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FROM_NOW_ON_S1_WILL_BE_YOUR_MENTOR).addCharName(mentor));
mentee.sendPacket(new ExMentorList(mentee));
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
statement.setInt(1, mentee.getObjectId());
statement.setInt(2, mentor.getObjectId());
statement.execute();
MentorManager.getInstance().addMentor(mentor.getObjectId(), mentee.getObjectId());
// Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerMenteeAdd(mentor, mentee), mentor);
mentor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FROM_NOW_ON_S1_WILL_BE_YOUR_MENTEE).addCharName(mentee));
mentor.sendPacket(new ExMentorList(mentor));
mentee.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FROM_NOW_ON_S1_WILL_BE_YOUR_MENTOR).addCharName(mentor));
mentee.sendPacket(new ExMentorList(mentee));
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
}
}

View File

@@ -25,14 +25,14 @@ import com.l2jmobius.gameserver.network.client.OutgoingPackets;
public class ExMagicAttackInfo implements IClientOutgoingPacket
{
// TODO: Enum
public final static int CRITICAL = 1;
public final static int CRITICAL_HEAL = 2;
public final static int OVERHIT = 3;
public final static int EVADED = 4;
public final static int BLOCKED = 5;
public final static int RESISTED = 6;
public final static int IMMUNE = 7;
public final static int IMMUNE2 = 8;
public static final int CRITICAL = 1;
public static final int CRITICAL_HEAL = 2;
public static final int OVERHIT = 3;
public static final int EVADED = 4;
public static final int BLOCKED = 5;
public static final int RESISTED = 6;
public static final int IMMUNE = 7;
public static final int IMMUNE2 = 8;
private final int _caster;
private final int _target;

View File

@@ -29,13 +29,13 @@ import com.l2jmobius.gameserver.network.client.OutgoingPackets;
public class ExPledgeRecruitBoardSearch implements IClientOutgoingPacket
{
final List<PledgeRecruitInfo> _clanList;
final private int _currentPage;
final private int _totalNumberOfPage;
final private int _clanOnCurrentPage;
final private int _startIndex;
final private int _endIndex;
private final int _currentPage;
private final int _totalNumberOfPage;
private final int _clanOnCurrentPage;
private final int _startIndex;
private final int _endIndex;
final static int CLAN_PER_PAGE = 12;
static final int CLAN_PER_PAGE = 12;
public ExPledgeRecruitBoardSearch(List<PledgeRecruitInfo> clanList, int currentPage)
{

View File

@@ -33,8 +33,8 @@ public class ExResponseBeautyList implements IClientOutgoingPacket
private final int _type;
private final Map<Integer, BeautyItem> _beautyItem;
public final static int SHOW_FACESHAPE = 1;
public final static int SHOW_HAIRSTYLE = 0;
public static final int SHOW_FACESHAPE = 1;
public static final int SHOW_HAIRSTYLE = 0;
public ExResponseBeautyList(L2PcInstance activeChar, int type)
{

View File

@@ -29,11 +29,11 @@ public class ExResponseBeautyRegistReset implements IClientOutgoingPacket
private final int _type;
private final int _result;
public final static int FAILURE = 0;
public final static int SUCCESS = 1;
public static final int FAILURE = 0;
public static final int SUCCESS = 1;
public final static int CHANGE = 0;
public final static int RESTORE = 1;
public static final int CHANGE = 0;
public static final int RESTORE = 1;
public ExResponseBeautyRegistReset(L2PcInstance activeChar, int type, int result)
{

View File

@@ -29,8 +29,8 @@ public class ExShowBeautyMenu implements IClientOutgoingPacket
private final int _type;
// TODO: Enum
public final static int MODIFY_APPEARANCE = 0;
public final static int RESTORE_APPEARANCE = 1;
public static final int MODIFY_APPEARANCE = 0;
public static final int RESTORE_APPEARANCE = 1;
public ExShowBeautyMenu(L2PcInstance activeChar, int type)
{

View File

@@ -224,14 +224,11 @@ public class ExShowScreenMessage implements IClientOutgoingPacket
{
packet.writeS(_text);
}
else
else if (_parameters != null)
{
if (_parameters != null)
for (String s : _parameters)
{
for (String s : _parameters)
{
packet.writeS(s);
}
packet.writeS(s);
}
}
return true;

View File

@@ -25,7 +25,7 @@ import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
*/
public class ExCuriousHouseRemainTime implements IClientOutgoingPacket
{
final private int _time;
private final int _time;
public ExCuriousHouseRemainTime(int time)
{

View File

@@ -276,24 +276,21 @@ public class CellNodeBuffer
{
weight = Config.HIGH_WEIGHT;
}
else
else if (isHighWeight(x + 1, y, geoZ))
{
if (isHighWeight(x + 1, y, geoZ))
{
weight = Config.MEDIUM_WEIGHT;
}
else if (isHighWeight(x - 1, y, geoZ))
{
weight = Config.MEDIUM_WEIGHT;
}
else if (isHighWeight(x, y + 1, geoZ))
{
weight = Config.MEDIUM_WEIGHT;
}
else if (isHighWeight(x, y - 1, geoZ))
{
weight = Config.MEDIUM_WEIGHT;
}
weight = Config.MEDIUM_WEIGHT;
}
else if (isHighWeight(x - 1, y, geoZ))
{
weight = Config.MEDIUM_WEIGHT;
}
else if (isHighWeight(x, y + 1, geoZ))
{
weight = Config.MEDIUM_WEIGHT;
}
else if (isHighWeight(x, y - 1, geoZ))
{
weight = Config.MEDIUM_WEIGHT;
}
newNode.setParent(_current);

View File

@@ -151,7 +151,7 @@ public final class JavaExecutionContext extends AbstractExecutionContext<JavaScr
out.println("----------------");
for (Diagnostic<? extends JavaFileObject> diagnostic : fileManagerDiagnostics.getDiagnostics())
{
out.println("\t" + diagnostic.getKind().toString() + ": " + diagnostic.getSource().getName() + ", Line " + diagnostic.getLineNumber() + ", Column " + diagnostic.getColumnNumber());
out.println("\t" + diagnostic.getKind() + ": " + diagnostic.getSource().getName() + ", Line " + diagnostic.getLineNumber() + ", Column " + diagnostic.getColumnNumber());
out.println("\t\tcode: " + diagnostic.getCode());
out.println("\t\tmessage: " + diagnostic.getMessage(null));
}
@@ -162,7 +162,7 @@ public final class JavaExecutionContext extends AbstractExecutionContext<JavaScr
out.println("-----------------------");
for (Diagnostic<? extends JavaFileObject> diagnostic : compilationDiagnostics.getDiagnostics())
{
out.println("\t" + diagnostic.getKind().toString() + ": " + diagnostic.getSource().getName() + ", Line " + diagnostic.getLineNumber() + ", Column " + diagnostic.getColumnNumber());
out.println("\t" + diagnostic.getKind() + ": " + diagnostic.getSource().getName() + ", Line " + diagnostic.getLineNumber() + ", Column " + diagnostic.getColumnNumber());
out.println("\t\tcode: " + diagnostic.getCode());
out.println("\t\tmessage: " + diagnostic.getMessage(null));
}

View File

@@ -47,7 +47,7 @@ public final class Evolve
{
protected static final Logger _log = Logger.getLogger(Evolve.class.getName());
public static final boolean doEvolve(L2PcInstance player, L2Npc npc, int itemIdtake, int itemIdgive, int petminlvl)
public static boolean doEvolve(L2PcInstance player, L2Npc npc, int itemIdtake, int itemIdgive, int petminlvl)
{
if ((itemIdtake == 0) || (itemIdgive == 0) || (petminlvl == 0))
{
@@ -158,7 +158,7 @@ public final class Evolve
return true;
}
public static final boolean doRestore(L2PcInstance player, L2Npc npc, int itemIdtake, int itemIdgive, int petminlvl)
public static boolean doRestore(L2PcInstance player, L2Npc npc, int itemIdtake, int itemIdgive, int petminlvl)
{
if ((itemIdtake == 0) || (itemIdgive == 0) || (petminlvl == 0))
{

View File

@@ -331,7 +331,7 @@ public class MinionList
* @param minionId The L2NpcTemplate Identifier of the Minion to spawn
* @return
*/
public static final L2MonsterInstance spawnMinion(L2MonsterInstance master, int minionId)
public static L2MonsterInstance spawnMinion(L2MonsterInstance master, int minionId)
{
// Get the template of the Minion to spawn
final L2NpcTemplate minionTemplate = NpcData.getInstance().getTemplate(minionId);
@@ -343,7 +343,7 @@ public class MinionList
return initializeNpcInstance(master, new L2MonsterInstance(minionTemplate));
}
protected static final L2MonsterInstance initializeNpcInstance(L2MonsterInstance master, L2MonsterInstance minion)
protected static L2MonsterInstance initializeNpcInstance(L2MonsterInstance master, L2MonsterInstance minion)
{
minion.stopAllEffects();
minion.setIsDead(false);

View File

@@ -345,7 +345,7 @@ public final class PrimeFinder
* @param desiredCapacity the capacity desired by the user.
* @return the capacity which should be used for a hashtable.
*/
public static final int nextPrime(int desiredCapacity)
public static int nextPrime(int desiredCapacity)
{
int i = Arrays.binarySearch(PRIME_CAPACITIES, desiredCapacity);
if (i < 0)

View File

@@ -493,7 +493,7 @@ public final class Util
if (Config.HTML_ACTION_CACHE_DEBUG)
{
LOGGER.info("Cached html bypass(" + scope.toString() + "): '" + bypass + "'");
LOGGER.info("Cached html bypass(" + scope + "): '" + bypass + "'");
}
player.addHtmlAction(scope, bypass);
bypassStart = htmlLower.indexOf("=\"bypass ", bypassEnd);
@@ -530,7 +530,7 @@ public final class Util
if (Config.HTML_ACTION_CACHE_DEBUG)
{
LOGGER.info("Cached html link(" + scope.toString() + "): '" + htmlLink + "'");
LOGGER.info("Cached html link(" + scope + "): '" + htmlLink + "'");
}
// let's keep an action cache with "link " lowercase literal kept
player.addHtmlAction(scope, "link " + htmlLink);
@@ -556,7 +556,7 @@ public final class Util
if (Config.HTML_ACTION_CACHE_DEBUG)
{
LOGGER.info("Set html action npc(" + scope.toString() + "): " + npcObjId);
LOGGER.info("Set html action npc(" + scope + "): " + npcObjId);
}
player.setHtmlActionOriginObjectId(scope, npcObjId);
buildHtmlBypassCache(player, scope, html);
@@ -645,32 +645,29 @@ public final class Util
activeChar.sendPacket(new ShowBoard(html, "1001"));
fillMultiEditContent(activeChar, fillMultiEdit);
}
else if (html.length() < 16250)
{
activeChar.sendPacket(new ShowBoard(html, "101"));
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
else if (html.length() < (16250 * 2))
{
activeChar.sendPacket(new ShowBoard(html.substring(0, 16250), "101"));
activeChar.sendPacket(new ShowBoard(html.substring(16250), "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
else if (html.length() < (16250 * 3))
{
activeChar.sendPacket(new ShowBoard(html.substring(0, 16250), "101"));
activeChar.sendPacket(new ShowBoard(html.substring(16250, 16250 * 2), "102"));
activeChar.sendPacket(new ShowBoard(html.substring(16250 * 2), "103"));
}
else
{
if (html.length() < 16250)
{
activeChar.sendPacket(new ShowBoard(html, "101"));
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
else if (html.length() < (16250 * 2))
{
activeChar.sendPacket(new ShowBoard(html.substring(0, 16250), "101"));
activeChar.sendPacket(new ShowBoard(html.substring(16250), "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
else if (html.length() < (16250 * 3))
{
activeChar.sendPacket(new ShowBoard(html.substring(0, 16250), "101"));
activeChar.sendPacket(new ShowBoard(html.substring(16250, 16250 * 2), "102"));
activeChar.sendPacket(new ShowBoard(html.substring(16250 * 2), "103"));
}
else
{
activeChar.sendPacket(new ShowBoard("<html><body><br><center>Error: HTML was too long!</center></body></html>", "101"));
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
activeChar.sendPacket(new ShowBoard("<html><body><br><center>Error: HTML was too long!</center></body></html>", "101"));
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
}

View File

@@ -51,7 +51,7 @@ public class EnchantFormatter extends Formatter
if (p instanceof L2PcInstance)
{
final L2PcInstance player = (L2PcInstance) p;
StringUtil.append(output, "Character:", player.getName(), " [" + String.valueOf(player.getObjectId()) + "] Account:", player.getAccountName());
StringUtil.append(output, "Character:", player.getName(), " [" + player.getObjectId() + "] Account:", player.getAccountName());
if ((player.getClient() != null) && !player.getClient().isDetached())
{
StringUtil.append(output, " IP:", player.getClient().getConnectionAddress().getHostAddress());