Code style changes.
This commit is contained in:
@@ -411,12 +411,9 @@ public class Auction
|
||||
{
|
||||
returnItem(b.getClanName(), b.getBid(), true); // 10 % tax
|
||||
}
|
||||
else
|
||||
else if (L2World.getInstance().getPlayer(b.getName()) != null)
|
||||
{
|
||||
if (L2World.getInstance().getPlayer(b.getName()) != null)
|
||||
{
|
||||
L2World.getInstance().getPlayer(b.getName()).sendMessage("Congratulation you have won ClanHall!");
|
||||
}
|
||||
L2World.getInstance().getPlayer(b.getName()).sendMessage("Congratulation you have won ClanHall!");
|
||||
}
|
||||
ClanTable.getInstance().getClanByName(b.getClanName()).setAuctionBiddedAt(0, true);
|
||||
}
|
||||
|
@@ -535,7 +535,7 @@ public final class BlockCheckerEngine
|
||||
_redPoints += _numOfBoxes / 2;
|
||||
_bluePoints += _numOfBoxes / 2;
|
||||
|
||||
getHolder().broadCastPacketToTeam((new ExCubeGameChangePoints((int) ((getStarterTime() - System.currentTimeMillis()) / 1000), getBluePoints(), getRedPoints())));
|
||||
getHolder().broadCastPacketToTeam(new ExCubeGameChangePoints((int) ((getStarterTime() - System.currentTimeMillis()) / 1000), getBluePoints(), getRedPoints()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -335,16 +335,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();
|
||||
@@ -592,7 +589,7 @@ public final class Castle extends AbstractResidence
|
||||
if (door.isDead())
|
||||
{
|
||||
door.doRevive();
|
||||
door.setCurrentHp((isDoorWeak) ? (door.getMaxHp() / 2) : (door.getMaxHp()));
|
||||
door.setCurrentHp(isDoorWeak ? (door.getMaxHp() / 2) : door.getMaxHp());
|
||||
}
|
||||
|
||||
if (door.getOpen())
|
||||
@@ -701,26 +698,20 @@ 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 ((lease - _function.get(type).getLease()) > 0)
|
||||
{
|
||||
_function.remove(type);
|
||||
_function.put(type, new CastleFunction(type, lvl, lease, 0, rate, -1, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((lvl == 0) && (lease == 0))
|
||||
{
|
||||
removeFunction(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((lease - _function.get(type).getLease()) > 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;
|
||||
}
|
||||
@@ -785,7 +776,7 @@ public final class Castle extends AbstractResidence
|
||||
|
||||
public void setDoorUpgrade(int doorId, int ratio, boolean save)
|
||||
{
|
||||
final L2DoorInstance door = (getDoors().isEmpty()) ? DoorData.getInstance().getDoor(doorId) : getDoor(doorId);
|
||||
final L2DoorInstance door = getDoors().isEmpty() ? DoorData.getInstance().getDoor(doorId) : getDoor(doorId);
|
||||
if (door == null)
|
||||
{
|
||||
return;
|
||||
@@ -1126,7 +1117,7 @@ public final class Castle extends AbstractResidence
|
||||
public void giveResidentialSkills(L2PcInstance player)
|
||||
{
|
||||
super.giveResidentialSkills(player);
|
||||
player.addSkill((getSide() == CastleSide.DARK ? CommonSkill.ABILITY_OF_DARKNESS.getSkill() : CommonSkill.ABILITY_OF_LIGHT.getSkill()));
|
||||
player.addSkill(getSide() == CastleSide.DARK ? CommonSkill.ABILITY_OF_DARKNESS.getSkill() : CommonSkill.ABILITY_OF_LIGHT.getSkill());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -488,26 +488,20 @@ public abstract class ClanHall
|
||||
{
|
||||
_functions.put(type, new ClanHallFunction(type, lvl, lease, 0, rate, 0, false));
|
||||
}
|
||||
else if ((lvl == 0) && (lease == 0))
|
||||
{
|
||||
removeFunction(type);
|
||||
}
|
||||
else if ((lease - _functions.get(type).getLease()) > 0)
|
||||
{
|
||||
_functions.remove(type);
|
||||
_functions.put(type, new ClanHallFunction(type, lvl, lease, 0, rate, -1, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((lvl == 0) && (lease == 0))
|
||||
{
|
||||
removeFunction(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((lease - _functions.get(type).getLease()) > 0)
|
||||
{
|
||||
_functions.remove(type);
|
||||
_functions.put(type, new ClanHallFunction(type, lvl, lease, 0, rate, -1, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
_functions.get(type).setLease(lease);
|
||||
_functions.get(type).setLvl(lvl);
|
||||
_functions.get(type).dbSave();
|
||||
}
|
||||
}
|
||||
_functions.get(type).setLease(lease);
|
||||
_functions.get(type).setLvl(lvl);
|
||||
_functions.get(type).dbSave();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -582,7 +582,7 @@ public final class Fort extends AbstractResidence
|
||||
long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis();
|
||||
while (initial > (Config.FS_UPDATE_FRQ * 60000L))
|
||||
{
|
||||
initial -= (Config.FS_UPDATE_FRQ * 60000L);
|
||||
initial -= Config.FS_UPDATE_FRQ * 60000L;
|
||||
}
|
||||
initial = (Config.FS_UPDATE_FRQ * 60000L) - initial;
|
||||
if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600)))
|
||||
@@ -675,26 +675,20 @@ 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 ((lease - _function.get(type).getLease()) > 0)
|
||||
{
|
||||
_function.remove(type);
|
||||
_function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((lvl == 0) && (lease == 0))
|
||||
{
|
||||
removeFunction(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((lease - _function.get(type).getLease()) > 0)
|
||||
{
|
||||
_function.remove(type);
|
||||
_function.put(type, new FortFunction(type, lvl, lease, 0, rate, -1, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
_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;
|
||||
}
|
||||
|
@@ -464,7 +464,7 @@ public class FortSiege implements Siegable
|
||||
*/
|
||||
public boolean checkIfInZone(int x, int y, int z)
|
||||
{
|
||||
return (isInProgress() && (getFort().checkIfInZone(x, y, z))); // Fort zone during siege
|
||||
return isInProgress() && getFort().checkIfInZone(x, y, z); // Fort zone during siege
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -474,7 +474,7 @@ public class FortSiege implements Siegable
|
||||
@Override
|
||||
public boolean checkIsAttacker(L2Clan clan)
|
||||
{
|
||||
return (getAttackerClan(clan) != null);
|
||||
return getAttackerClan(clan) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -460,7 +460,7 @@ public class Hero
|
||||
final StringBuilder fList = new StringBuilder(500);
|
||||
int counter = 0;
|
||||
int breakat = 0;
|
||||
for (int i = ((page - 1) * perpage); i < list.size(); i++)
|
||||
for (int i = (page - 1) * perpage; i < list.size(); i++)
|
||||
{
|
||||
breakat = i;
|
||||
final StatsSet diaryEntry = list.get(i);
|
||||
@@ -548,7 +548,7 @@ public class Hero
|
||||
final StringBuilder fList = new StringBuilder(500);
|
||||
int counter = 0;
|
||||
int breakat = 0;
|
||||
for (int i = ((page - 1) * perpage); i < heroFights.size(); i++)
|
||||
for (int i = (page - 1) * perpage; i < heroFights.size(); i++)
|
||||
{
|
||||
breakat = i;
|
||||
final StatsSet fight = heroFights.get(i);
|
||||
|
@@ -638,13 +638,13 @@ public final class Instance
|
||||
spawnDat.startRespawn();
|
||||
}
|
||||
spawnDat.setInstanceId(getId());
|
||||
if (allowRandomWalk == null)
|
||||
if (allowRandomWalk != null)
|
||||
{
|
||||
spawnDat.setIsNoRndWalk(!_allowRandomWalk);
|
||||
spawnDat.setIsNoRndWalk(!allowRandomWalk);
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnDat.setIsNoRndWalk(!allowRandomWalk);
|
||||
spawnDat.setIsNoRndWalk(!_allowRandomWalk);
|
||||
}
|
||||
|
||||
spawnDat.setAreaName(areaName);
|
||||
@@ -887,7 +887,7 @@ public final class Instance
|
||||
|
||||
public void addEjectDeadTask(L2PcInstance player)
|
||||
{
|
||||
if ((player != null))
|
||||
if (player != null)
|
||||
{
|
||||
_ejectDeadTasks.put(player.getObjectId(), ThreadPoolManager.getInstance().scheduleGeneral(() ->
|
||||
{
|
||||
|
@@ -541,7 +541,7 @@ public class L2Event
|
||||
return "The event has been successfully finished.";
|
||||
}
|
||||
|
||||
private static final Map<L2PcInstance, Integer> sortByValue(Map<L2PcInstance, Integer> unsortMap)
|
||||
private static Map<L2PcInstance, Integer> sortByValue(Map<L2PcInstance, Integer> unsortMap)
|
||||
{
|
||||
final List<Entry<L2PcInstance, Integer>> list = new LinkedList<>(unsortMap.entrySet());
|
||||
|
||||
|
@@ -106,7 +106,7 @@ public class Message
|
||||
_receiverId = receiverId;
|
||||
_subject = subject;
|
||||
_content = text;
|
||||
_expiration = (isCod ? System.currentTimeMillis() + (COD_EXPIRATION * 3600000) : System.currentTimeMillis() + (EXPIRATION * 3600000));
|
||||
_expiration = isCod ? System.currentTimeMillis() + (COD_EXPIRATION * 3600000) : System.currentTimeMillis() + (EXPIRATION * 3600000);
|
||||
_hasAttachments = false;
|
||||
_unread = true;
|
||||
_deletedBySender = false;
|
||||
@@ -214,7 +214,7 @@ public class Message
|
||||
}
|
||||
}
|
||||
|
||||
public static final PreparedStatement getStatement(Message msg, Connection con) throws SQLException
|
||||
public static PreparedStatement getStatement(Message msg, Connection con) throws SQLException
|
||||
{
|
||||
final PreparedStatement stmt = con.prepareStatement("INSERT INTO messages (messageId, senderId, receiverId, subject, content, expiration, reqAdena, hasAttachments, isUnread, isDeletedBySender, isDeletedByReceiver, sendBySystem, isReturned, itemId, enchantLvl, elementals) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
|
@@ -29,37 +29,37 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
*/
|
||||
public interface Siegable
|
||||
{
|
||||
public void startSiege();
|
||||
void startSiege();
|
||||
|
||||
public void endSiege();
|
||||
void endSiege();
|
||||
|
||||
public L2SiegeClan getAttackerClan(int clanId);
|
||||
L2SiegeClan getAttackerClan(int clanId);
|
||||
|
||||
public L2SiegeClan getAttackerClan(L2Clan clan);
|
||||
L2SiegeClan getAttackerClan(L2Clan clan);
|
||||
|
||||
public List<L2SiegeClan> getAttackerClans();
|
||||
List<L2SiegeClan> getAttackerClans();
|
||||
|
||||
public List<L2PcInstance> getAttackersInZone();
|
||||
List<L2PcInstance> getAttackersInZone();
|
||||
|
||||
public boolean checkIsAttacker(L2Clan clan);
|
||||
boolean checkIsAttacker(L2Clan clan);
|
||||
|
||||
public L2SiegeClan getDefenderClan(int clanId);
|
||||
L2SiegeClan getDefenderClan(int clanId);
|
||||
|
||||
public L2SiegeClan getDefenderClan(L2Clan clan);
|
||||
L2SiegeClan getDefenderClan(L2Clan clan);
|
||||
|
||||
public List<L2SiegeClan> getDefenderClans();
|
||||
List<L2SiegeClan> getDefenderClans();
|
||||
|
||||
public boolean checkIsDefender(L2Clan clan);
|
||||
boolean checkIsDefender(L2Clan clan);
|
||||
|
||||
public List<L2Npc> getFlag(L2Clan clan);
|
||||
List<L2Npc> getFlag(L2Clan clan);
|
||||
|
||||
public Calendar getSiegeDate();
|
||||
Calendar getSiegeDate();
|
||||
|
||||
public boolean giveFame();
|
||||
boolean giveFame();
|
||||
|
||||
public int getFameFrequency();
|
||||
int getFameFrequency();
|
||||
|
||||
public int getFameAmount();
|
||||
int getFameAmount();
|
||||
|
||||
public void updateSiege();
|
||||
void updateSiege();
|
||||
}
|
||||
|
@@ -721,7 +721,7 @@ public class Siege implements Siegable
|
||||
*/
|
||||
public boolean checkIfInZone(int x, int y, int z)
|
||||
{
|
||||
return (isInProgress() && (getCastle().checkIfInZone(x, y, z))); // Castle zone during siege
|
||||
return isInProgress() && getCastle().checkIfInZone(x, y, z); // Castle zone during siege
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -732,7 +732,7 @@ public class Siege implements Siegable
|
||||
@Override
|
||||
public boolean checkIsAttacker(L2Clan clan)
|
||||
{
|
||||
return (getAttackerClan(clan) != null);
|
||||
return getAttackerClan(clan) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -743,7 +743,7 @@ public class Siege implements Siegable
|
||||
@Override
|
||||
public boolean checkIsDefender(L2Clan clan)
|
||||
{
|
||||
return (getDefenderClan(clan) != null);
|
||||
return getDefenderClan(clan) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -752,7 +752,7 @@ public class Siege implements Siegable
|
||||
*/
|
||||
public boolean checkIsDefenderWaiting(L2Clan clan)
|
||||
{
|
||||
return (getDefenderWaitingClan(clan) != null);
|
||||
return getDefenderWaitingClan(clan) != null;
|
||||
}
|
||||
|
||||
/** Clear all registered siege clans from database for castle */
|
||||
@@ -1420,12 +1420,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)
|
||||
@@ -1615,7 +1612,7 @@ public class Siege implements Siegable
|
||||
|
||||
public final int getAttackerRespawnDelay()
|
||||
{
|
||||
return (SiegeManager.getInstance().getAttackerRespawnDelay());
|
||||
return SiegeManager.getInstance().getAttackerRespawnDelay();
|
||||
}
|
||||
|
||||
public final Castle getCastle()
|
||||
|
@@ -484,7 +484,7 @@ public class TvTEvent
|
||||
// Check to which team the player should be added
|
||||
if (_teams[0].getParticipatedPlayerCount() == _teams[1].getParticipatedPlayerCount())
|
||||
{
|
||||
teamId = (byte) (Rnd.get(2));
|
||||
teamId = (byte) Rnd.get(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -889,17 +889,14 @@ public class TvTEvent
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if ((Config.TVT_EVENT_FIGHTER_BUFFS != null) && !Config.TVT_EVENT_FIGHTER_BUFFS.isEmpty())
|
||||
{
|
||||
if ((Config.TVT_EVENT_FIGHTER_BUFFS != null) && !Config.TVT_EVENT_FIGHTER_BUFFS.isEmpty())
|
||||
for (Entry<Integer, Integer> e : Config.TVT_EVENT_FIGHTER_BUFFS.entrySet())
|
||||
{
|
||||
for (Entry<Integer, Integer> e : Config.TVT_EVENT_FIGHTER_BUFFS.entrySet())
|
||||
final Skill skill = SkillData.getInstance().getSkill(e.getKey(), e.getValue());
|
||||
if (skill != null)
|
||||
{
|
||||
final Skill skill = SkillData.getInstance().getSkill(e.getKey(), e.getValue());
|
||||
if (skill != null)
|
||||
{
|
||||
skill.applyEffects(playerInstance, playerInstance);
|
||||
}
|
||||
skill.applyEffects(playerInstance, playerInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -911,7 +908,7 @@ public class TvTEvent
|
||||
* @param skill
|
||||
* @return true if player valid for skill
|
||||
*/
|
||||
public static final boolean checkForTvTSkill(L2PcInstance source, L2PcInstance target, Skill skill)
|
||||
public static boolean checkForTvTSkill(L2PcInstance source, L2PcInstance target, Skill skill)
|
||||
{
|
||||
if (!isStarted())
|
||||
{
|
||||
@@ -1073,7 +1070,7 @@ public class TvTEvent
|
||||
*/
|
||||
public static TvTEventTeam getParticipantTeam(int playerObjectId)
|
||||
{
|
||||
return (_teams[0].containsPlayer(playerObjectId) ? _teams[0] : (_teams[1].containsPlayer(playerObjectId) ? _teams[1] : null));
|
||||
return _teams[0].containsPlayer(playerObjectId) ? _teams[0] : (_teams[1].containsPlayer(playerObjectId) ? _teams[1] : null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1083,7 +1080,7 @@ public class TvTEvent
|
||||
*/
|
||||
public static TvTEventTeam getParticipantEnemyTeam(int playerObjectId)
|
||||
{
|
||||
return (_teams[0].containsPlayer(playerObjectId) ? _teams[1] : (_teams[1].containsPlayer(playerObjectId) ? _teams[0] : null));
|
||||
return _teams[0].containsPlayer(playerObjectId) ? _teams[1] : (_teams[1].containsPlayer(playerObjectId) ? _teams[0] : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -229,21 +229,18 @@ public class TvTManager
|
||||
{
|
||||
nextMsg = delay;
|
||||
}
|
||||
// start
|
||||
else if (TvTEvent.isInactive())
|
||||
{
|
||||
startReg();
|
||||
}
|
||||
else if (TvTEvent.isParticipating())
|
||||
{
|
||||
startEvent();
|
||||
}
|
||||
else
|
||||
{
|
||||
// start
|
||||
if (TvTEvent.isInactive())
|
||||
{
|
||||
startReg();
|
||||
}
|
||||
else if (TvTEvent.isParticipating())
|
||||
{
|
||||
startEvent();
|
||||
}
|
||||
else
|
||||
{
|
||||
endEvent();
|
||||
}
|
||||
endEvent();
|
||||
}
|
||||
|
||||
if (delay > 0)
|
||||
@@ -276,16 +273,13 @@ public class TvTManager
|
||||
TvTEvent.sysMsgToAllParticipants("TvT Event: " + (time / 60) + " minute(s) until the event is finished!");
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (TvTEvent.isParticipating())
|
||||
{
|
||||
if (TvTEvent.isParticipating())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers("TvT Event: " + time + " second(s) until registration is closed!");
|
||||
}
|
||||
else if (TvTEvent.isStarted())
|
||||
{
|
||||
TvTEvent.sysMsgToAllParticipants("TvT Event: " + time + " second(s) until the event is finished!");
|
||||
}
|
||||
Broadcast.toAllOnlinePlayers("TvT Event: " + time + " second(s) until registration is closed!");
|
||||
}
|
||||
else if (TvTEvent.isStarted())
|
||||
{
|
||||
TvTEvent.sysMsgToAllParticipants("TvT Event: " + time + " second(s) until the event is finished!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -220,7 +220,7 @@ public final class AuctionableHall extends ClanHall
|
||||
{
|
||||
ps.setInt(1, getOwnerId());
|
||||
ps.setLong(2, getPaidUntil());
|
||||
ps.setInt(3, (getPaid()) ? 1 : 0);
|
||||
ps.setInt(3, getPaid() ? 1 : 0);
|
||||
ps.setInt(4, getId());
|
||||
ps.execute();
|
||||
}
|
||||
|
@@ -100,7 +100,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
|
||||
while (rset.next())
|
||||
{
|
||||
final int id = rset.getInt("attacker_id");
|
||||
_attackers.put(id, (new L2SiegeClan(id, SiegeClanType.ATTACKER)));
|
||||
_attackers.put(id, new L2SiegeClan(id, SiegeClanType.ATTACKER));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user