Addition of OlympiadEnabled configuration.

This commit is contained in:
MobiusDevelopment
2022-09-25 12:04:21 +00:00
parent cf32747997
commit 629cfae635
189 changed files with 1184 additions and 376 deletions

View File

@ -759,6 +759,7 @@ public class Config
public static boolean ANTI_FARM_IP_ENABLED;
public static boolean ANTI_FARM_SUMMON;
public static boolean OLYMPIAD_ENABLED;
public static int ALT_OLY_NUMBER_HEROS_EACH_CLASS;
public static boolean ALT_OLY_LOG_FIGHTS;
public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;
@ -2055,6 +2056,7 @@ public class Config
public static void loadOlympConfig()
{
final PropertiesParser olympiadConfig = new PropertiesParser(OLYMP_CONFIG_FILE);
OLYMPIAD_ENABLED = olympiadConfig.getBoolean("OlympiadEnabled", true);
ALT_OLY_START_TIME = olympiadConfig.getInt("AltOlyStartTime", 18);
ALT_OLY_MIN = olympiadConfig.getInt("AltOlyMin", 0);
ALT_OLY_CPERIOD = olympiadConfig.getLong("AltOlyCPeriod", 21600000);

View File

@ -16,6 +16,7 @@
*/
package org.l2jmobius.gameserver.handler.usercommandhandlers;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.handler.IUserCommandHandler;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.olympiad.Olympiad;
@ -40,6 +41,12 @@ public class OlympiadStat implements IUserCommandHandler
return false;
}
if (!Config.OLYMPIAD_ENABLED)
{
player.sendPacket(SystemMessageId.THE_GRAND_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
return false;
}
final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_CURRENT_RECORD_FOR_THIS_GRAND_OLYMPIAD_IS_S1_MATCH_ES_S2_WIN_S_AND_S3_DEFEAT_S_YOU_HAVE_EARNED_S4_OLYMPIAD_POINT_S);
sm.addNumber(Olympiad.getInstance().getCompetitionDone(player.getObjectId()));
sm.addNumber(Olympiad.getInstance().getCompetitionWon(player.getObjectId()));

View File

@ -28,6 +28,7 @@ import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.gameserver.data.sql.ClanTable;
import org.l2jmobius.gameserver.model.StatSet;
@ -70,7 +71,10 @@ public class Hero
public Hero()
{
init();
if (Config.OLYMPIAD_ENABLED)
{
init();
}
}
private void init()

View File

@ -57,8 +57,8 @@ public class Olympiad
{
protected static final Logger LOGGER = Logger.getLogger(Olympiad.class.getName());
private static Map<Integer, StatSet> NOBLES;
private static Map<Integer, StatSet> NOBLES_RANK;
private static Map<Integer, StatSet> NOBLES = new ConcurrentHashMap<>();
private static Map<Integer, StatSet> NOBLES_RANK = new HashMap<>();
protected static List<StatSet> HEROS_TO_BE;
private static List<Player> _nonClassBasedRegisters;
private static Map<Integer, List<Player>> _classBasedRegisters;
@ -162,11 +162,18 @@ public class Olympiad
public Olympiad()
{
load();
if (_period == 0)
if (Config.OLYMPIAD_ENABLED)
{
init();
load();
if (_period == 0)
{
init();
}
}
else
{
LOGGER.log(Level.INFO, "Disabled.");
}
}
@ -177,8 +184,8 @@ public class Olympiad
private void load()
{
NOBLES = new ConcurrentHashMap<>();
NOBLES_RANK = new HashMap<>();
NOBLES.clear();
NOBLES_RANK.clear();
boolean loaded = false;
try (Connection con = DatabaseFactory.getConnection();