瀏覽代碼

BETA: Cleanup of Olympiad classes and little typo fix.

Rumen Nikiforov 12 年之前
父節點
當前提交
21df0de831

+ 114 - 67
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/AbstractOlympiadGame.java

@@ -51,7 +51,7 @@ public abstract class AbstractOlympiadGame
 {
 	protected static final Logger _log = Logger.getLogger(AbstractOlympiadGame.class.getName());
 	protected static final Logger _logResults = Logger.getLogger("olympiad");
-
+	
 	protected static final String POINTS = "olympiad_points";
 	protected static final String COMP_DONE = "competitions_done";
 	protected static final String COMP_WON = "competitions_won";
@@ -61,32 +61,32 @@ public abstract class AbstractOlympiadGame
 	protected static final String COMP_DONE_WEEK_CLASSED = "competitions_done_week_classed";
 	protected static final String COMP_DONE_WEEK_NON_CLASSED = "competitions_done_week_non_classed";
 	protected static final String COMP_DONE_WEEK_TEAM = "competitions_done_week_team";
-
+	
 	protected long _startTime = 0;
 	protected boolean _aborted = false;
 	protected final int _stadiumID;
-
+	
 	protected AbstractOlympiadGame(int id)
 	{
 		_stadiumID = id;
 	}
-
+	
 	public final boolean isAborted()
 	{
 		return _aborted;
 	}
-
+	
 	public final int getStadiumId()
 	{
 		return _stadiumID;
 	}
-
+	
 	protected boolean makeCompetitionStart()
 	{
 		_startTime = System.currentTimeMillis();
 		return !_aborted;
 	}
-
+	
 	protected final void addPointsToParticipant(Participant par, int points)
 	{
 		par.updateStat(POINTS, points);
@@ -97,11 +97,13 @@ public abstract class AbstractOlympiadGame
 		
 		for (Quest quest : QuestManager.getInstance().getAllManagedScripts())
 		{
-			if (quest != null && quest.isOlympiadUse())
+			if ((quest != null) && quest.isOlympiadUse())
+			{
 				quest.notifyOlympiadWin(par.getPlayer(), getType());
+			}
 		}
 	}
-
+	
 	protected final void removePointsFromParticipant(Participant par, int points)
 	{
 		par.updateStat(POINTS, -points);
@@ -112,29 +114,36 @@ public abstract class AbstractOlympiadGame
 		
 		for (Quest quest : QuestManager.getInstance().getAllManagedScripts())
 		{
-			if (quest != null && quest.isOlympiadUse())
+			if ((quest != null) && quest.isOlympiadUse())
+			{
 				quest.notifyOlympiadLose(par.getPlayer(), getType());
+			}
 		}
 	}
-
+	
 	/**
-	 * Function return null if player passed all checks
-	 * or SystemMessage with reason for broadcast to opponent(s).
+	 * Function return null if player passed all checks or SystemMessage with reason for broadcast to opponent(s).
 	 * @param player
 	 * @return
 	 */
 	protected static SystemMessage checkDefaulted(L2PcInstance player)
 	{
-		if (player == null || !player.isOnline())
+		if ((player == null) || !player.isOnline())
+		{
 			return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_ENDS_THE_GAME);
-
-		if (player.getClient() == null || player.getClient().isDetached())
+		}
+		
+		if ((player.getClient() == null) || player.getClient().isDetached())
+		{
 			return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_ENDS_THE_GAME);
-
+		}
+		
 		// safety precautions
 		if (player.inObserverMode() || TvTEvent.isPlayerParticipant(player.getObjectId()))
+		{
 			return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_DOES_NOT_MEET_THE_REQUIREMENTS_FOR_JOINING_THE_GAME);
-
+		}
+		
 		SystemMessage sm;
 		if (player.isDead())
 		{
@@ -165,23 +174,27 @@ public abstract class AbstractOlympiadGame
 			player.sendPacket(sm);
 			return SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_HAS_BEEN_CANCELLED_BECAUSE_THE_OTHER_PARTY_DOES_NOT_MEET_THE_REQUIREMENTS_FOR_JOINING_THE_GAME);
 		}
-
+		
 		return null;
 	}
-
+	
 	protected static final boolean portPlayerToArena(Participant par, Location loc, int id)
 	{
 		final L2PcInstance player = par.getPlayer();
-		if (player == null || !player.isOnline())
+		if ((player == null) || !player.isOnline())
+		{
 			return false;
-
+		}
+		
 		try
 		{
 			player.setLastCords(player.getX(), player.getY(), player.getZ());
 			if (player.isSitting())
+			{
 				player.standUp();
+			}
 			player.setTarget(null);
-
+			
 			player.setOlympiadGameId(id);
 			player.setIsInOlympiadMode(true);
 			player.setIsOlympiadStart(false);
@@ -198,14 +211,16 @@ public abstract class AbstractOlympiadGame
 		}
 		return true;
 	}
-
+	
 	protected static final void removals(L2PcInstance player, boolean removeParty)
 	{
 		try
 		{
 			if (player == null)
+			{
 				return;
-
+			}
+			
 			// Remove Buffs
 			player.stopAllEffectsExceptThoseThatLastThroughDeath();
 			
@@ -214,9 +229,13 @@ public abstract class AbstractOlympiadGame
 			{
 				player.getClan().removeSkillEffects(player);
 				if (player.getClan().getCastleId() > 0)
+				{
 					CastleManager.getInstance().getCastleByOwner(player.getClan()).removeResidentialSkills(player);
+				}
 				if (player.getClan().getFortId() > 0)
+				{
 					FortManager.getInstance().getFortByOwner(player.getClan()).removeResidentialSkills(player);
+				}
 			}
 			// Abort casting if player casting
 			player.abortAttack();
@@ -248,7 +267,9 @@ public abstract class AbstractOlympiadGame
 				summon.abortCast();
 				
 				if (summon instanceof L2PetInstance)
+				{
 					summon.unSummon(player);
+				}
 			}
 			
 			// stop any cubic that has been given by other player.
@@ -259,7 +280,9 @@ public abstract class AbstractOlympiadGame
 			{
 				final L2Party party = player.getParty();
 				if (party != null)
+				{
 					party.removePartyMember(player, messageType.Expelled);
+				}
 			}
 			// Remove Agathion
 			if (player.getAgathionId() > 0)
@@ -284,7 +307,9 @@ public abstract class AbstractOlympiadGame
 			for (L2Skill skill : player.getAllSkills())
 			{
 				if (skill.getReuseDelay() <= 900000)
+				{
 					player.enableSkill(skill);
+				}
 			}
 			
 			player.sendSkillList();
@@ -295,7 +320,7 @@ public abstract class AbstractOlympiadGame
 			_log.log(Level.WARNING, e.getMessage(), e);
 		}
 	}
-
+	
 	protected static final void cleanEffects(L2PcInstance player)
 	{
 		try
@@ -306,17 +331,21 @@ public abstract class AbstractOlympiadGame
 			player.abortAttack();
 			player.abortCast();
 			player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-
+			
 			if (player.isDead())
+			{
 				player.setIsDead(false);
+			}
 			
 			player.stopAllEffectsExceptThoseThatLastThroughDeath();
 			player.clearSouls();
 			player.clearCharges();
 			if (player.getAgathionId() > 0)
+			{
 				player.setAgathionId(0);
+			}
 			final L2Summon summon = player.getPet();
-			if (summon != null && !summon.isDead())
+			if ((summon != null) && !summon.isDead())
 			{
 				summon.setTarget(null);
 				summon.abortAttack();
@@ -324,7 +353,7 @@ public abstract class AbstractOlympiadGame
 				summon.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 				summon.stopAllEffectsExceptThoseThatLastThroughDeath();
 			}
-
+			
 			player.setCurrentCp(player.getMaxCp());
 			player.setCurrentHp(player.getMaxHp());
 			player.setCurrentMp(player.getMaxMp());
@@ -335,14 +364,16 @@ public abstract class AbstractOlympiadGame
 			_log.log(Level.WARNING, e.getMessage(), e);
 		}
 	}
-
+	
 	protected static final void playerStatusBack(L2PcInstance player)
 	{
 		try
 		{
-			if(player.isTransformed())
+			if (player.isTransformed())
+			{
 				player.untransform();
-
+			}
+			
 			player.setIsInOlympiadMode(false);
 			player.setIsOlympiadStart(false);
 			player.setOlympiadSide(-1);
@@ -354,9 +385,13 @@ public abstract class AbstractOlympiadGame
 			{
 				player.getClan().addSkillEffects(player);
 				if (player.getClan().getCastleId() > 0)
+				{
 					CastleManager.getInstance().getCastleByOwner(player.getClan()).giveResidentialSkills(player);
+				}
 				if (player.getClan().getFortId() > 0)
+				{
 					FortManager.getInstance().getFortByOwner(player.getClan()).giveResidentialSkills(player);
+				}
 			}
 			
 			// Add Hero Skills
@@ -368,40 +403,48 @@ public abstract class AbstractOlympiadGame
 				}
 			}
 			player.sendSkillList();
-
+			
 			// heal again after adding clan skills
 			player.setCurrentCp(player.getMaxCp());
 			player.setCurrentHp(player.getMaxHp());
 			player.setCurrentMp(player.getMaxMp());
 			player.getStatus().startHpMpRegeneration();
-
+			
 			if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
+			{
 				AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, player);
+			}
 		}
 		catch (Exception e)
 		{
 			_log.log(Level.WARNING, "portPlayersToArena()", e);
 		}
 	}
-
+	
 	protected static final void portPlayerBack(L2PcInstance player)
 	{
 		if (player == null)
+		{
 			return;
-
-		if (player.getLastX() == 0 && player.getLastY() == 0)
+		}
+		
+		if ((player.getLastX() == 0) && (player.getLastY() == 0))
+		{
 			return;
-
+		}
+		
 		player.setInstanceId(0);
 		player.teleToLocation(player.getLastX(), player.getLastY(), player.getLastZ());
 		player.setLastCords(0, 0, 0);
 	}
-
+	
 	public static final void rewardParticipant(L2PcInstance player, int[][] reward)
 	{
-		if (player == null || !player.isOnline() || reward == null)
+		if ((player == null) || !player.isOnline() || (reward == null))
+		{
 			return;
-
+		}
+		
 		try
 		{
 			SystemMessage sm;
@@ -409,69 +452,73 @@ public abstract class AbstractOlympiadGame
 			final InventoryUpdate iu = new InventoryUpdate();
 			for (int[] it : reward)
 			{
-				if (it == null || it.length != 2)
+				if ((it == null) || (it.length != 2))
+				{
 					continue;
-
+				}
+				
 				item = player.getInventory().addItem("Olympiad", it[0], it[1], player, null);
 				if (item == null)
+				{
 					continue;
-
+				}
+				
 				iu.addModifiedItem(item);
 				sm = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
 				sm.addItemName(it[0]);
 				sm.addNumber(it[1]);
 				player.sendPacket(sm);
 			}
-			player.sendPacket(iu);			
+			player.sendPacket(iu);
 		}
 		catch (Exception e)
 		{
 			_log.log(Level.WARNING, e.getMessage(), e);
 		}
 	}
-
+	
 	public abstract CompetitionType getType();
-
+	
 	public abstract String[] getPlayerNames();
-
+	
 	public abstract boolean containsParticipant(int playerId);
-
+	
 	public abstract void sendOlympiadInfo(L2Character player);
-
+	
 	public abstract void broadcastOlympiadInfo(L2OlympiadStadiumZone stadium);
-
+	
 	protected abstract void broadcastPacket(L2GameServerPacket packet);
-
+	
 	protected abstract boolean needBuffers();
-
+	
 	protected abstract boolean checkDefaulted();
-
+	
 	protected abstract void removals();
-
+	
 	protected abstract boolean portPlayersToArena(List<Location> spawns);
-
+	
 	protected abstract void cleanEffects();
-
+	
 	protected abstract void portPlayersBack();
-
+	
 	protected abstract void playersStatusBack();
-
+	
 	protected abstract void clearPlayers();
-
+	
 	protected abstract void handleDisconnect(L2PcInstance player);
-
+	
 	protected abstract void resetDamage();
-
+	
 	protected abstract void addDamage(L2PcInstance player, int damage);
-
+	
 	protected abstract boolean checkBattleStatus();
-
+	
 	protected abstract boolean haveWinner();
-
+	
 	protected abstract void validateWinner(L2OlympiadStadiumZone stadium);
-
+	
 	protected abstract int getDivider();
-
+	
 	protected abstract int[][] getReward();
 	
 	protected abstract String getWeeklyMatchType();

+ 12 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadAnnouncer.java

@@ -26,26 +26,26 @@ import com.l2jserver.gameserver.network.clientpackets.Say2;
 import com.l2jserver.gameserver.network.serverpackets.NpcSay;
 
 /**
- * 
  * @author DS
- *
  */
 public final class OlympiadAnnouncer implements Runnable
 {
 	private static final int OLY_MANAGER = 31688;
-
-	private List<L2Spawn> _managers = new FastList<>();
+	
+	private final List<L2Spawn> _managers = new FastList<>();
 	private int _currentStadium = 0;
-
+	
 	public OlympiadAnnouncer()
 	{
 		for (L2Spawn spawn : SpawnTable.getInstance().getSpawnTable())
 		{
-			if (spawn != null && spawn.getNpcid() == OLY_MANAGER)
+			if ((spawn != null) && (spawn.getNpcid() == OLY_MANAGER))
+			{
 				_managers.add(spawn);
+			}
 		}
 	}
-
+	
 	@Override
 	public void run()
 	{
@@ -53,10 +53,12 @@ public final class OlympiadAnnouncer implements Runnable
 		for (int i = OlympiadGameManager.getInstance().getNumberOfStadiums(); --i >= 0; _currentStadium++)
 		{
 			if (_currentStadium >= OlympiadGameManager.getInstance().getNumberOfStadiums())
+			{
 				_currentStadium = 0;
-
+			}
+			
 			task = OlympiadGameManager.getInstance().getOlympiadTask(_currentStadium);
-			if (task != null && task.getGame() != null && task.needAnnounce())
+			if ((task != null) && (task.getGame() != null) && task.needAnnounce())
 			{
 				NpcStringId npcString;
 				final String arenaId = String.valueOf(task.getGame().getStadiumId() + 1);
@@ -74,7 +76,7 @@ public final class OlympiadAnnouncer implements Runnable
 					default:
 						continue;
 				}
-
+				
 				L2Npc manager;
 				NpcSay packet;
 				for (L2Spawn spawn : _managers)

+ 11 - 11
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadGameClassed.java

@@ -20,9 +20,7 @@ import com.l2jserver.Config;
 import com.l2jserver.util.Rnd;
 
 /**
- * 
  * @author DS
- *
  */
 public class OlympiadGameClassed extends OlympiadGameNormal
 {
@@ -30,19 +28,19 @@ public class OlympiadGameClassed extends OlympiadGameNormal
 	{
 		super(id, opponents);
 	}
-
+	
 	@Override
 	public final CompetitionType getType()
 	{
 		return CompetitionType.CLASSED;
 	}
-
+	
 	@Override
 	protected final int getDivider()
 	{
 		return Config.ALT_OLY_DIVIDER_CLASSED;
 	}
-
+	
 	@Override
 	protected final int[][] getReward()
 	{
@@ -54,30 +52,32 @@ public class OlympiadGameClassed extends OlympiadGameNormal
 	{
 		return COMP_DONE_WEEK_CLASSED;
 	}
-
+	
 	protected static final OlympiadGameClassed createGame(int id, List<List<Integer>> classList)
 	{
-		if (classList == null || classList.isEmpty())
+		if ((classList == null) || classList.isEmpty())
+		{
 			return null;
-
+		}
+		
 		List<Integer> list;
 		Participant[] opponents;
 		while (!classList.isEmpty())
 		{
 			list = classList.get(Rnd.nextInt(classList.size()));
-			if (list == null || list.size() < 2)
+			if ((list == null) || (list.size() < 2))
 			{
 				classList.remove(list);
 				continue;
 			}
-
+			
 			opponents = OlympiadGameNormal.createListOfParticipants(list);
 			if (opponents == null)
 			{
 				classList.remove(list);
 				continue;
 			}
-
+			
 			return new OlympiadGameClassed(id, opponents);
 		}
 		return null;

+ 42 - 26
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadGameManager.java

@@ -24,27 +24,30 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.zone.type.L2OlympiadStadiumZone;
 
 /**
- * 
  * @author GodKratos, DS
  */
 public class OlympiadGameManager implements Runnable
 {
 	private static final Logger _log = Logger.getLogger(OlympiadGameManager.class.getName());
-
+	
 	private volatile boolean _battleStarted = false;
 	private final OlympiadGameTask[] _tasks;
-
+	
 	protected OlympiadGameManager()
 	{
 		final Collection<L2OlympiadStadiumZone> zones = ZoneManager.getInstance().getAllZones(L2OlympiadStadiumZone.class);
-		if (zones == null || zones.isEmpty())
+		if ((zones == null) || zones.isEmpty())
+		{
 			throw new Error("No olympiad stadium zones defined !");
-
+		}
+		
 		_tasks = new OlympiadGameTask[zones.size()];
 		int i = 0;
 		for (L2OlympiadStadiumZone zone : zones)
+		{
 			_tasks[i++] = new OlympiadGameTask(zone);
-
+		}
+		
 		_log.log(Level.INFO, "Olympiad System: Loaded " + _tasks.length + " stadiums.");
 	}
 	
@@ -52,34 +55,35 @@ public class OlympiadGameManager implements Runnable
 	{
 		return SingletonHolder._instance;
 	}
-
+	
 	protected final boolean isBattleStarted()
 	{
 		return _battleStarted;
 	}
-
+	
 	protected final void startBattle()
 	{
 		_battleStarted = true;
 	}
-
+	
 	@Override
 	public final void run()
 	{
 		if (Olympiad.getInstance().isOlympiadEnd())
+		{
 			return;
+		}
 		
 		if (Olympiad.getInstance().inCompPeriod())
 		{
 			OlympiadGameTask task;
 			AbstractOlympiadGame newGame;
-
+			
 			List<List<Integer>> readyClassed = OlympiadManager.getInstance().hasEnoughRegisteredClassed();
 			boolean readyNonClassed = OlympiadManager.getInstance().hasEnoughRegisteredNonClassed();
 			boolean readyTeams = OlympiadManager.getInstance().hasEnoughRegisteredTeams();
-
 			
-			if (readyClassed != null || readyNonClassed || readyTeams)
+			if ((readyClassed != null) || readyNonClassed || readyTeams)
 			{
 				// set up the games queue
 				for (int i = 0; i < _tasks.length; i++)
@@ -91,10 +95,10 @@ public class OlympiadGameManager implements Runnable
 						{
 							// Fair arena distribution
 							// 0,2,4,6,8.. arenas checked for classed or teams first
-							if ((readyClassed != null || readyTeams) && (i % 2) == 0)
+							if (((readyClassed != null) || readyTeams) && ((i % 2) == 0))
 							{
 								// 0,4,8.. arenas checked for teams first
-								if (readyTeams && (i % 4) == 0)
+								if (readyTeams && ((i % 4) == 0))
 								{
 									newGame = OlympiadGameTeams.createGame(i, OlympiadManager.getInstance().getRegisteredTeamsBased());
 									if (newGame != null)
@@ -130,10 +134,12 @@ public class OlympiadGameManager implements Runnable
 							}
 						}
 					}
-
+					
 					// stop generating games if no more participants
-					if (readyClassed == null && !readyNonClassed && !readyTeams)
+					if ((readyClassed == null) && !readyNonClassed && !readyTeams)
+					{
 						break;
+					}
 				}
 			}
 		}
@@ -142,48 +148,58 @@ public class OlympiadGameManager implements Runnable
 			// not in competition period
 			if (isAllTasksFinished())
 			{
-				OlympiadManager.getInstance().clearRegistered();				
+				OlympiadManager.getInstance().clearRegistered();
 				_battleStarted = false;
 				_log.log(Level.INFO, "Olympiad System: All current games finished.");
 			}
 		}
 	}
-
+	
 	public final boolean isAllTasksFinished()
 	{
 		for (OlympiadGameTask task : _tasks)
 		{
 			if (task.isRunning())
+			{
 				return false;
+			}
 		}
 		return true;
 	}
-
+	
 	public final OlympiadGameTask getOlympiadTask(int id)
 	{
-		if (id < 0 || id >= _tasks.length)
+		if ((id < 0) || (id >= _tasks.length))
+		{
 			return null;
-
+		}
+		
 		return _tasks[id];
 	}
-
+	
 	public final int getNumberOfStadiums()
 	{
 		return _tasks.length;
 	}
-
+	
 	public final void notifyCompetitorDamage(L2PcInstance player, int damage)
 	{
 		if (player == null)
+		{
 			return;
-
+		}
+		
 		final int id = player.getOlympiadGameId();
-		if (id < 0 || id >= _tasks.length)
+		if ((id < 0) || (id >= _tasks.length))
+		{
 			return;
-
+		}
+		
 		final AbstractOlympiadGame game = _tasks[id].getGame();
 		if (game != null)
+		{
 			game.addDamage(player, damage);
+		}
 	}
 	
 	private static class SingletonHolder

+ 7 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadGameNonClassed.java

@@ -19,9 +19,7 @@ import java.util.List;
 import com.l2jserver.Config;
 
 /**
- * 
  * @author DS
- *
  */
 public class OlympiadGameNonClassed extends OlympiadGameNormal
 {
@@ -29,25 +27,25 @@ public class OlympiadGameNonClassed extends OlympiadGameNormal
 	{
 		super(id, opponents);
 	}
-
+	
 	@Override
 	public final CompetitionType getType()
 	{
 		return CompetitionType.NON_CLASSED;
 	}
-
+	
 	@Override
 	protected final int getDivider()
 	{
 		return Config.ALT_OLY_DIVIDER_NON_CLASSED;
 	}
-
+	
 	@Override
 	protected final int[][] getReward()
 	{
 		return Config.ALT_OLY_NONCLASSED_REWARD;
 	}
-
+	
 	@Override
 	protected final String getWeeklyMatchType()
 	{
@@ -58,8 +56,10 @@ public class OlympiadGameNonClassed extends OlympiadGameNormal
 	{
 		final Participant[] opponents = OlympiadGameNormal.createListOfParticipants(list);
 		if (opponents == null)
+		{
 			return null;
-
+		}
+		
 		return new OlympiadGameNonClassed(id, opponents);
 	}
 }

+ 25 - 12
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadGameNormal.java

@@ -415,9 +415,13 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 					}
 				}
 				if (winside == 1)
+				{
 					result = new ExOlympiadMatchResult(tie, winside, list1, list2);
+				}
 				else
+				{
 					result = new ExOlympiadMatchResult(tie, winside, list2, list1);
+				}
 				stadium.broadcastPacket(result);
 				return;
 			}
@@ -442,13 +446,13 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 					_playerOne.updateStat(COMP_WON, 1);
 					addPointsToParticipant(_playerOne, pointDiff);
 					list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints + pointDiff, pointDiff));
-										
+					
 					_playerTwo.updateStat(COMP_LOST, 1);
 					removePointsFromParticipant(_playerTwo, pointDiff);
 					list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - pointDiff, -pointDiff));
-
+					
 					winside = 1;
-
+					
 					rewardParticipant(_playerOne.getPlayer(), getReward());
 					
 					if (Config.ALT_OLY_LOG_FIGHTS)
@@ -476,12 +480,12 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 					
 					_playerTwo.updateStat(COMP_WON, 1);
 					addPointsToParticipant(_playerTwo, pointDiff);
-					list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints + pointDiff, pointDiff));					
+					list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints + pointDiff, pointDiff));
 					
 					_playerOne.updateStat(COMP_LOST, 1);
 					removePointsFromParticipant(_playerOne, pointDiff);
 					list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - pointDiff, -pointDiff));
-
+					
 					winside = 2;
 					
 					rewardParticipant(_playerTwo.getPlayer(), getReward());
@@ -508,9 +512,9 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 					stadium.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_GAME_ENDED_IN_A_TIE));
 					
 					_playerOne.updateStat(COMP_LOST, 1);
-					removePointsFromParticipant(_playerOne, pointDiff);					
+					removePointsFromParticipant(_playerOne, pointDiff);
 					list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - pointDiff, -pointDiff));
-
+					
 					_playerTwo.updateStat(COMP_LOST, 1);
 					removePointsFromParticipant(_playerTwo, pointDiff);
 					list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - pointDiff, -pointDiff));
@@ -543,9 +547,13 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 				_playerTwo.updateStat(getWeeklyMatchType(), 1);
 				
 				if (winside == 1)
+				{
 					result = new ExOlympiadMatchResult(tie, winside, list1, list2);
+				}
 				else
+				{
 					result = new ExOlympiadMatchResult(tie, winside, list2, list1);
+				}
 				stadium.broadcastPacket(result);
 				return;
 			}
@@ -605,7 +613,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 				
 				addPointsToParticipant(_playerOne, pointDiff);
 				list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints + pointDiff, pointDiff));
-
+				
 				removePointsFromParticipant(_playerTwo, pointDiff);
 				list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - pointDiff, -pointDiff));
 				winner = _playerOne.getName() + " won";
@@ -627,10 +635,10 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 				
 				addPointsToParticipant(_playerTwo, pointDiff);
 				list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints + pointDiff, pointDiff));
-
+				
 				removePointsFromParticipant(_playerOne, pointDiff);
 				list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - pointDiff, -pointDiff));
-
+				
 				winner = _playerTwo.getName() + " won";
 				winside = 2;
 				
@@ -648,10 +656,11 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 				
 				int value = Math.min(playerOnePoints / getDivider(), Config.ALT_OLY_MAX_POINTS);
 				
-				removePointsFromParticipant(_playerOne, Math.min(playerOnePoints / getDivider(), Config.ALT_OLY_MAX_POINTS));
+				removePointsFromParticipant(_playerOne, value);
 				list1.add(new OlympiadInfo(_playerOne.getName(), _playerOne.getClanName(), _playerOne.getClanId(), _playerOne.getBaseClass(), _damageP1, playerOnePoints - value, -value));
 				
-				removePointsFromParticipant(_playerTwo, Math.min(playerTwoPoints / getDivider(), Config.ALT_OLY_MAX_POINTS));
+				value = Math.min(playerTwoPoints / getDivider(), Config.ALT_OLY_MAX_POINTS);
+				removePointsFromParticipant(_playerTwo, value);
 				list2.add(new OlympiadInfo(_playerTwo.getName(), _playerTwo.getClanName(), _playerTwo.getClanId(), _playerTwo.getBaseClass(), _damageP2, playerTwoPoints - value, -value));
 				
 				tie = true;
@@ -665,9 +674,13 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
 			_playerTwo.updateStat(getWeeklyMatchType(), 1);
 			
 			if (winside == 1)
+			{
 				result = new ExOlympiadMatchResult(tie, winside, list1, list2);
+			}
 			else
+			{
 				result = new ExOlympiadMatchResult(tie, winside, list2, list1);
+			}
 			stadium.broadcastPacket(result);
 			
 			if (Config.ALT_OLY_LOG_FIGHTS)

+ 115 - 52
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadGameTask.java

@@ -30,18 +30,61 @@ public final class OlympiadGameTask implements Runnable
 {
 	protected static final Logger _log = Logger.getLogger(OlympiadGameTask.class.getName());
 	protected static final long BATTLE_PERIOD = Config.ALT_OLY_BATTLE; // 6 mins
-
-	public static final int[] TELEPORT_TO_ARENA = { 120, 60, 30, 15, 10, 5, 4, 3, 2, 1, 0 };
-	public static final int[] BATTLE_START_TIME_FIRST = { 60, 50, 40, 30, 20, 10, 0 };
-	public static final int[] BATTLE_START_TIME_SECOND = { 10, 5, 4, 3, 2, 1, 0 };
-	public static final int[] TELEPORT_TO_TOWN = { 40, 30, 20, 10, 5, 4, 3, 2, 1, 0 };
-
+	
+	public static final int[] TELEPORT_TO_ARENA =
+	{
+		120,
+		60,
+		30,
+		15,
+		10,
+		5,
+		4,
+		3,
+		2,
+		1,
+		0
+	};
+	public static final int[] BATTLE_START_TIME_FIRST =
+	{
+		60,
+		50,
+		40,
+		30,
+		20,
+		10,
+		0
+	};
+	public static final int[] BATTLE_START_TIME_SECOND =
+	{
+		10,
+		5,
+		4,
+		3,
+		2,
+		1,
+		0
+	};
+	public static final int[] TELEPORT_TO_TOWN =
+	{
+		40,
+		30,
+		20,
+		10,
+		5,
+		4,
+		3,
+		2,
+		1,
+		0
+	};
+	
 	private final L2OlympiadStadiumZone _zone;
 	private AbstractOlympiadGame _game;
 	private GameState _state = GameState.IDLE;
 	private boolean _needAnnounce = false;
 	private int _countDown = 0;
-
+	
 	private static enum GameState
 	{
 		BEGIN,
@@ -56,33 +99,33 @@ public final class OlympiadGameTask implements Runnable
 		CLEANUP,
 		IDLE
 	}
-
+	
 	public OlympiadGameTask(L2OlympiadStadiumZone zone)
 	{
 		_zone = zone;
 		zone.registerTask(this);
 	}
-
+	
 	public final boolean isRunning()
 	{
 		return _state != GameState.IDLE;
 	}
-
+	
 	public final boolean isGameStarted()
 	{
-		return _state.ordinal() >= GameState.GAME_STARTED.ordinal() && _state.ordinal() <= GameState.CLEANUP.ordinal();
+		return (_state.ordinal() >= GameState.GAME_STARTED.ordinal()) && (_state.ordinal() <= GameState.CLEANUP.ordinal());
 	}
-
+	
 	public final boolean isBattleStarted()
 	{
 		return _state == GameState.BATTLE_IN_PROGRESS;
 	}
-
+	
 	public final boolean isBattleFinished()
 	{
 		return _state == GameState.TELEPORT_TO_TOWN;
 	}
-
+	
 	public final boolean needAnnounce()
 	{
 		if (_needAnnounce)
@@ -92,31 +135,31 @@ public final class OlympiadGameTask implements Runnable
 		}
 		return false;
 	}
-
+	
 	public final L2OlympiadStadiumZone getZone()
 	{
 		return _zone;
 	}
-
+	
 	public final AbstractOlympiadGame getGame()
 	{
 		return _game;
 	}
-
+	
 	public final void attachGame(AbstractOlympiadGame game)
 	{
-		if (game!= null && _state != GameState.IDLE)
+		if ((game != null) && (_state != GameState.IDLE))
 		{
 			_log.log(Level.WARNING, "Attempt to overwrite non-finished game in state " + _state);
 			return;
 		}
-
+		
 		_game = game;
 		_state = GameState.BEGIN;
 		_needAnnounce = false;
 		ThreadPoolManager.getInstance().executeTask(this);
 	}
-
+	
 	@Override
 	public final void run()
 	{
@@ -125,7 +168,7 @@ public final class OlympiadGameTask implements Runnable
 			int delay = 1; // schedule next call after 1s
 			switch (_state)
 			{
-				// Game created
+			// Game created
 				case BEGIN:
 				{
 					_state = GameState.TELEPORT_TO_ARENA;
@@ -141,10 +184,12 @@ public final class OlympiadGameTask implements Runnable
 						sm.addNumber(_countDown);
 						_game.broadcastPacket(sm);
 					}
-
+					
 					delay = getDelay(TELEPORT_TO_ARENA);
 					if (_countDown <= 0)
+					{
 						_state = GameState.GAME_STARTED;
+					}
 					break;
 				}
 				// Game start, port players to arena
@@ -155,7 +200,7 @@ public final class OlympiadGameTask implements Runnable
 						_state = GameState.GAME_STOPPED;
 						break;
 					}
-
+					
 					_state = GameState.BATTLE_COUNTDOWN_FIRST;
 					_countDown = BATTLE_START_TIME_FIRST[0];
 					delay = 5;
@@ -170,17 +215,17 @@ public final class OlympiadGameTask implements Runnable
 						sm.addNumber(_countDown);
 						_zone.broadcastPacket(sm);
 					}
-
+					
 					delay = getDelay(BATTLE_START_TIME_FIRST);
 					if (_countDown <= 0)
 					{
 						openDoors();
-
+						
 						_state = GameState.BATTLE_COUNTDOWN_SECOND;
 						_countDown = BATTLE_START_TIME_SECOND[0];
 						delay = getDelay(BATTLE_START_TIME_SECOND);
 					}
-
+					
 					break;
 				}
 				// Battle start countdown, second part (10-0)
@@ -192,11 +237,13 @@ public final class OlympiadGameTask implements Runnable
 						sm.addNumber(_countDown);
 						_zone.broadcastPacket(sm);
 					}
-
+					
 					delay = getDelay(BATTLE_START_TIME_SECOND);
 					if (_countDown <= 0)
+					{
 						_state = GameState.BATTLE_STARTED;
-
+					}
+					
 					break;
 				}
 				// Beginning of the battle
@@ -205,17 +252,21 @@ public final class OlympiadGameTask implements Runnable
 					_countDown = 0;
 					_state = GameState.BATTLE_IN_PROGRESS; // set state first, used in zone update
 					if (!startBattle())
+					{
 						_state = GameState.GAME_STOPPED;
-
+					}
+					
 					break;
 				}
 				// Checks during battle
 				case BATTLE_IN_PROGRESS:
 				{
 					_countDown += 1000;
-					if (checkBattle() || _countDown > Config.ALT_OLY_BATTLE)
+					if (checkBattle() || (_countDown > Config.ALT_OLY_BATTLE))
+					{
 						_state = GameState.GAME_STOPPED;
-
+					}
+					
 					break;
 				}
 				// End of the battle
@@ -236,11 +287,13 @@ public final class OlympiadGameTask implements Runnable
 						sm.addNumber(_countDown);
 						_game.broadcastPacket(sm);
 					}
-
+					
 					delay = getDelay(TELEPORT_TO_TOWN);
 					if (_countDown <= 0)
+					{
 						_state = GameState.CLEANUP;
-
+					}
+					
 					break;
 				}
 				// Removals
@@ -269,22 +322,24 @@ public final class OlympiadGameTask implements Runnable
 					return;
 				}
 			}
-
+			
 			_log.log(Level.WARNING, "Exception in " + _state + ", trying to port players back: " + e.getMessage(), e);
 			_state = GameState.GAME_STOPPED;
 			ThreadPoolManager.getInstance().scheduleGeneral(this, 1000);
 		}
 	}
-
+	
 	private final int getDelay(int[] times)
 	{
 		int time;
-		for (int i = 0; i < times.length - 1; i++)
+		for (int i = 0; i < (times.length - 1); i++)
 		{
 			time = times[i];
 			if (time >= _countDown)
+			{
 				continue;
-
+			}
+			
 			final int delay = _countDown - time;
 			_countDown = time;
 			return delay;
@@ -293,7 +348,7 @@ public final class OlympiadGameTask implements Runnable
 		_countDown = -1;
 		return 1;
 	}
-
+	
 	/**
 	 * Second stage: check for defaulted, port players to arena, announce game.
 	 * @return true if no participants defaulted.
@@ -304,15 +359,21 @@ public final class OlympiadGameTask implements Runnable
 		{
 			// Checking for opponents and teleporting to arena
 			if (_game.checkDefaulted())
+			{
 				return false;
-
+			}
+			
 			_zone.closeDoors();
 			if (_game.needBuffers())
+			{
 				_zone.spawnBuffers();
+			}
 			
 			if (!_game.portPlayersToArena(_zone.getSpawns()))
+			{
 				return false;
-
+			}
+			
 			_game.removals();
 			_needAnnounce = true;
 			OlympiadGameManager.getInstance().startBattle(); // inform manager
@@ -324,7 +385,7 @@ public final class OlympiadGameTask implements Runnable
 		}
 		return false;
 	}
-
+	
 	/**
 	 * Third stage: open doors.
 	 */
@@ -340,7 +401,7 @@ public final class OlympiadGameTask implements Runnable
 			_log.log(Level.WARNING, e.getMessage(), e);
 		}
 	}
-
+	
 	/**
 	 * Fourth stage: last checks, remove buffers, start competition itself.
 	 * @return true if all participants online and ready on the stadium.
@@ -350,8 +411,10 @@ public final class OlympiadGameTask implements Runnable
 		try
 		{
 			if (_game.needBuffers())
+			{
 				_zone.deleteBuffers();
-
+			}
+			
 			if (_game.checkBattleStatus() && _game.makeCompetitionStart())
 			{
 				// game successfully started
@@ -367,10 +430,10 @@ public final class OlympiadGameTask implements Runnable
 		}
 		return false;
 	}
-
+	
 	/**
 	 * Fifth stage: battle is running, returns true if winner found.
-	 * @return 
+	 * @return
 	 */
 	private final boolean checkBattle()
 	{
@@ -382,10 +445,10 @@ public final class OlympiadGameTask implements Runnable
 		{
 			_log.log(Level.WARNING, e.getMessage(), e);
 		}
-
+		
 		return true;
 	}
-
+	
 	/**
 	 * Sixth stage: winner's validations
 	 */
@@ -399,7 +462,7 @@ public final class OlympiadGameTask implements Runnable
 		{
 			_log.log(Level.WARNING, e.getMessage(), e);
 		}
-
+		
 		try
 		{
 			_zone.updateZoneStatusForCharactersInside();
@@ -408,7 +471,7 @@ public final class OlympiadGameTask implements Runnable
 		{
 			_log.log(Level.WARNING, e.getMessage(), e);
 		}
-
+		
 		try
 		{
 			_game.cleanEffects();
@@ -418,7 +481,7 @@ public final class OlympiadGameTask implements Runnable
 			_log.log(Level.WARNING, e.getMessage(), e);
 		}
 	}
-
+	
 	/**
 	 * Seventh stage: game cleanup (port players back, closing doors, etc)
 	 */
@@ -432,7 +495,7 @@ public final class OlympiadGameTask implements Runnable
 		{
 			_log.log(Level.WARNING, e.getMessage(), e);
 		}
-
+		
 		try
 		{
 			_game.portPlayersBack();
@@ -450,7 +513,7 @@ public final class OlympiadGameTask implements Runnable
 		{
 			_log.log(Level.WARNING, e.getMessage(), e);
 		}
-
+		
 		try
 		{
 			_zone.closeDoors();

文件差異過大導致無法顯示
+ 239 - 139
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadGameTeams.java


+ 88 - 53
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/OlympiadManager.java

@@ -41,19 +41,19 @@ public class OlympiadManager
 	private final List<Integer> _nonClassBasedRegisters;
 	private final Map<Integer, List<Integer>> _classBasedRegisters;
 	private final List<List<Integer>> _teamsBasedRegisters;
-
+	
 	protected OlympiadManager()
 	{
 		_nonClassBasedRegisters = new FastList<Integer>().shared();
 		_classBasedRegisters = new FastMap<Integer, List<Integer>>().shared();
 		_teamsBasedRegisters = new FastList<List<Integer>>().shared();
 	}
-
+	
 	public static final OlympiadManager getInstance()
 	{
 		return SingletonHolder._instance;
 	}
-
+	
 	public final List<Integer> getRegisteredNonClassBased()
 	{
 		return _nonClassBasedRegisters;
@@ -74,11 +74,13 @@ public class OlympiadManager
 		List<List<Integer>> result = null;
 		for (Map.Entry<Integer, List<Integer>> classList : _classBasedRegisters.entrySet())
 		{
-			if (classList.getValue() != null && classList.getValue().size() >= Config.ALT_OLY_CLASSED)
+			if ((classList.getValue() != null) && (classList.getValue().size() >= Config.ALT_OLY_CLASSED))
 			{
 				if (result == null)
+				{
 					result = new FastList<>();
-
+				}
+				
 				result.add(classList.getValue());
 			}
 		}
@@ -107,14 +109,14 @@ public class OlympiadManager
 	{
 		return isRegistered(noble, noble, false);
 	}
-
+	
 	private final boolean isRegistered(L2PcInstance noble, L2PcInstance player, boolean showMessage)
 	{
 		final Integer objId = Integer.valueOf(noble.getObjectId());
 		// party may be already dispersed
 		for (List<Integer> team : _teamsBasedRegisters)
 		{
-			if (team != null && team.contains(objId))
+			if ((team != null) && team.contains(objId))
 			{
 				if (showMessage)
 				{
@@ -125,7 +127,7 @@ public class OlympiadManager
 				return true;
 			}
 		}
-
+		
 		if (_nonClassBasedRegisters.contains(objId))
 		{
 			if (showMessage)
@@ -138,7 +140,7 @@ public class OlympiadManager
 		}
 		
 		final List<Integer> classed = _classBasedRegisters.get(noble.getBaseClass());
-		if (classed != null && classed.contains(objId))
+		if ((classed != null) && classed.contains(objId))
 		{
 			if (showMessage)
 			{
@@ -151,29 +153,35 @@ public class OlympiadManager
 		
 		return false;
 	}
-
+	
 	public final boolean isRegisteredInComp(L2PcInstance noble)
 	{
 		return isRegistered(noble, noble, false) || isInCompetition(noble, noble, false);
 	}
-
+	
 	private final boolean isInCompetition(L2PcInstance noble, L2PcInstance player, boolean showMessage)
 	{
 		if (!Olympiad._inCompPeriod)
+		{
 			return false;
-
+		}
+		
 		AbstractOlympiadGame game;
-		for (int i = OlympiadGameManager.getInstance().getNumberOfStadiums(); --i >=0;)
+		for (int i = OlympiadGameManager.getInstance().getNumberOfStadiums(); --i >= 0;)
 		{
 			game = OlympiadGameManager.getInstance().getOlympiadTask(i).getGame();
 			if (game == null)
+			{
 				continue;
+			}
 			
 			if (game.containsParticipant(noble.getObjectId()))
 			{
 				if (!showMessage)
+				{
 					return true;
-
+				}
+				
 				switch (game.getType())
 				{
 					case CLASSED:
@@ -203,7 +211,7 @@ public class OlympiadManager
 		}
 		return false;
 	}
-
+	
 	public final boolean registerNoble(L2PcInstance player, CompetitionType type)
 	{
 		if (!Olympiad._inCompPeriod)
@@ -224,23 +232,27 @@ public class OlympiadManager
 			player.sendPacket(SystemMessageId.MAX_OLY_WEEKLY_MATCHES_REACHED);
 			return false;
 		}
-
+		
 		switch (type)
 		{
 			case CLASSED:
 			{
 				if (!checkNoble(player, player))
+				{
 					return false;
+				}
 				
 				if (Olympiad.getInstance().getRemainingWeeklyMatchesClassed(charId) < 1)
 				{
 					player.sendPacket(SystemMessageId.MAX_OLY_WEEKLY_MATCHES_REACHED_60_NON_CLASSED_30_CLASSED_10_TEAM);
 					return false;
 				}
-
+				
 				List<Integer> classed = _classBasedRegisters.get(player.getBaseClass());
 				if (classed != null)
+				{
 					classed.add(charId);
+				}
 				else
 				{
 					classed = new FastList<Integer>().shared();
@@ -254,14 +266,16 @@ public class OlympiadManager
 			case NON_CLASSED:
 			{
 				if (!checkNoble(player, player))
+				{
 					return false;
+				}
 				
 				if (Olympiad.getInstance().getRemainingWeeklyMatchesNonClassed(charId) < 1)
 				{
 					player.sendPacket(SystemMessageId.MAX_OLY_WEEKLY_MATCHES_REACHED_60_NON_CLASSED_30_CLASSED_10_TEAM);
 					return false;
 				}
-
+				
 				_nonClassBasedRegisters.add(charId);
 				player.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_NO_CLASS_GAMES);
 				break;
@@ -269,7 +283,7 @@ public class OlympiadManager
 			case TEAMS:
 			{
 				final L2Party party = player.getParty();
-				if (party == null || party.getMemberCount() != 3)
+				if ((party == null) || (party.getMemberCount() != 3))
 				{
 					player.sendPacket(SystemMessageId.PARTY_REQUIREMENTS_NOT_MET);
 					return false;
@@ -279,7 +293,7 @@ public class OlympiadManager
 					player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_REQUEST_TEAM_MATCH);
 					return false;
 				}
-
+				
 				int teamPoints = 0;
 				ArrayList<Integer> team = new ArrayList<>(party.getMemberCount());
 				for (L2PcInstance noble : party.getMembers())
@@ -292,9 +306,11 @@ public class OlympiadManager
 							for (L2PcInstance unreg : party.getMembers())
 							{
 								if (unreg == noble)
+								{
 									break;
-
-								AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, unreg);		
+								}
+								
+								AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, unreg);
 							}
 						}
 						return false;
@@ -316,11 +332,13 @@ public class OlympiadManager
 					if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
 					{
 						for (L2PcInstance unreg : party.getMembers())
-							AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, unreg);		
-					}						
+						{
+							AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, unreg);
+						}
+					}
 					return false;
 				}
-
+				
 				party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_REGISTERED_IN_A_WAITING_LIST_OF_TEAM_GAMES));
 				_teamsBasedRegisters.add(team);
 				break;
@@ -350,36 +368,42 @@ public class OlympiadManager
 			noble.sendPacket(SystemMessageId.YOU_HAVE_NOT_BEEN_REGISTERED_IN_A_WAITING_LIST_OF_A_GAME);
 			return false;
 		}
-
+		
 		if (isInCompetition(noble, noble, false))
+		{
 			return false;
+		}
 		
 		Integer objId = Integer.valueOf(noble.getObjectId());
 		if (_nonClassBasedRegisters.remove(objId))
 		{
 			if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
-				AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);		
-
+			{
+				AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);
+			}
+			
 			noble.sendPacket(SystemMessageId.YOU_HAVE_BEEN_DELETED_FROM_THE_WAITING_LIST_OF_A_GAME);
 			return true;
 		}
-
+		
 		final List<Integer> classed = _classBasedRegisters.get(noble.getBaseClass());
-		if (classed != null && classed.remove(objId))
+		if ((classed != null) && classed.remove(objId))
 		{
 			_classBasedRegisters.remove(noble.getBaseClass());
 			_classBasedRegisters.put(noble.getBaseClass(), classed);
-
+			
 			if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
-				AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);		
-
+			{
+				AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, noble);
+			}
+			
 			noble.sendPacket(SystemMessageId.YOU_HAVE_BEEN_DELETED_FROM_THE_WAITING_LIST_OF_A_GAME);
 			return true;
 		}
-
+		
 		for (List<Integer> team : _teamsBasedRegisters)
 		{
-			if (team != null && team.contains(objId))
+			if ((team != null) && team.contains(objId))
 			{
 				_teamsBasedRegisters.remove(team);
 				ThreadPoolManager.getInstance().executeTask(new AnnounceUnregToTeam(team));
@@ -392,20 +416,26 @@ public class OlympiadManager
 	public final void removeDisconnectedCompetitor(L2PcInstance player)
 	{
 		final OlympiadGameTask task = OlympiadGameManager.getInstance().getOlympiadTask(player.getOlympiadGameId());
-		if (task != null && task.isGameStarted())
+		if ((task != null) && task.isGameStarted())
+		{
 			task.getGame().handleDisconnect(player);
-
+		}
+		
 		final Integer objId = Integer.valueOf(player.getObjectId());
 		if (_nonClassBasedRegisters.remove(objId))
+		{
 			return;
-
+		}
+		
 		final List<Integer> classed = _classBasedRegisters.get(player.getBaseClass());
-		if (classed != null && classed.remove(objId))
+		if ((classed != null) && classed.remove(objId))
+		{
 			return;
-
+		}
+		
 		for (List<Integer> team : _teamsBasedRegisters)
 		{
-			if (team != null && team.contains(objId))
+			if ((team != null) && team.contains(objId))
 			{
 				_teamsBasedRegisters.remove(team);
 				ThreadPoolManager.getInstance().executeTask(new AnnounceUnregToTeam(team));
@@ -413,7 +443,7 @@ public class OlympiadManager
 			}
 		}
 	}
-
+	
 	/**
 	 * @param noble - checked noble
 	 * @param player - messages will be sent to this L2PcInstance
@@ -438,7 +468,7 @@ public class OlympiadManager
 			player.sendPacket(sm);
 			return false;
 		}
-
+		
 		if (noble.isCursedWeaponEquipped())
 		{
 			sm = SystemMessage.getSystemMessage(SystemMessageId.C1_CANNOT_JOIN_OLYMPIAD_POSSESSING_S2);
@@ -447,7 +477,7 @@ public class OlympiadManager
 			player.sendPacket(sm);
 			return false;
 		}
-
+		
 		if (!noble.isInventoryUnder90(true))
 		{
 			sm = SystemMessage.getSystemMessage(SystemMessageId.C1_CANNOT_PARTICIPATE_IN_OLYMPIAD_INVENTORY_SLOT_EXCEEDS_80_PERCENT);
@@ -462,13 +492,17 @@ public class OlympiadManager
 			player.sendMessage("You can't join olympiad while participating on TvT Event.");
 			return false;
 		}
-
+		
 		if (isRegistered(noble, player, true))
+		{
 			return false;
-
+		}
+		
 		if (isInCompetition(noble, player, true))
+		{
 			return false;
-
+		}
+		
 		StatsSet statDat = Olympiad.getNobleStats(charId);
 		if (statDat == null)
 		{
@@ -487,7 +521,7 @@ public class OlympiadManager
 			statDat.set("to_save", true);
 			Olympiad.addNobleStats(charId, statDat);
 		}
-
+		
 		final int points = Olympiad.getInstance().getNoblePoints(charId);
 		if (points <= 0)
 		{
@@ -497,9 +531,8 @@ public class OlympiadManager
 			player.sendPacket(message);
 			return false;
 		}
-
-		if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0
-				&& !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.OLYMPIAD_ID, noble, Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP))
+		
+		if ((Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0) && !AntiFeedManager.getInstance().tryAddPlayer(AntiFeedManager.OLYMPIAD_ID, noble, Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP))
 		{
 			NpcHtmlMessage message = new NpcHtmlMessage(0);
 			message.setFile(player.getHtmlPrefix(), "data/html/mods/OlympiadIPRestriction.htm");
@@ -507,7 +540,7 @@ public class OlympiadManager
 			player.sendPacket(message);
 			return false;
 		}
-
+		
 		return true;
 	}
 	
@@ -532,7 +565,9 @@ public class OlympiadManager
 				{
 					teamMember.sendPacket(sm);
 					if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
-						AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, teamMember);		
+					{
+						AntiFeedManager.getInstance().removePlayer(AntiFeedManager.OLYMPIAD_ID, teamMember);
+					}
 				}
 			}
 			teamMember = null;

+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/Participant.java

@@ -111,7 +111,7 @@ public final class Participant
 	{
 		return player;
 	}
-
+	
 	/**
 	 * @return the objectId
 	 */
@@ -119,7 +119,7 @@ public final class Participant
 	{
 		return objectId;
 	}
-
+	
 	/**
 	 * @return the stats
 	 */
@@ -127,7 +127,7 @@ public final class Participant
 	{
 		return stats;
 	}
-
+	
 	/**
 	 * @param noble the player to set
 	 */
@@ -135,7 +135,7 @@ public final class Participant
 	{
 		player = noble;
 	}
-
+	
 	/**
 	 * @return the side
 	 */

部分文件因文件數量過多而無法顯示