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

@@ -9,6 +9,10 @@
# Also please understand what you are changing before you do so on a live server.
# ---------------------------------------------------------------------------
# Enable Olympiad.
# Default: True
OlympiadEnabled = True
# Olympiad Start Time in Military hours Default 6pm (18)
# Default: 18
AltOlyStartTime = 18

View File

@@ -16,6 +16,7 @@
*/
package ai.others.MonumentOfHeroes;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
@@ -59,8 +60,11 @@ public class MonumentOfHeroes extends AbstractNpcAI
private MonumentOfHeroes()
{
addStartNpc(MONUMENTS);
addTalkId(MONUMENTS);
if (Config.OLYMPIAD_ENABLED)
{
addStartNpc(MONUMENTS);
addTalkId(MONUMENTS);
}
}
@Override

View File

@@ -16,6 +16,7 @@
*/
package handlers.usercommandhandlers;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.handler.IUserCommandHandler;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
@@ -37,6 +38,12 @@ public class OlympiadStat implements IUserCommandHandler
@Override
public boolean useUserCommand(int id, Player player)
{
if (!Config.OLYMPIAD_ENABLED)
{
player.sendPacket(SystemMessageId.THE_GRAND_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
return false;
}
if (id != COMMAND_IDS[0])
{
return false;

View File

@@ -593,6 +593,7 @@ public class Config
public static boolean USE_SAY_FILTER;
public static String CHAT_FILTER_CHARS;
public static Set<ChatType> BAN_CHAT_CHANNELS;
public static boolean OLYMPIAD_ENABLED;
public static int ALT_OLY_START_TIME;
public static int ALT_OLY_MIN;
public static int ALT_OLY_MAX_BUFFS;
@@ -2472,6 +2473,7 @@ public class Config
// Load Olympiad config file (if exists)
final PropertiesParser olympiadConfig = new PropertiesParser(OLYMPIAD_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_MAX_BUFFS = olympiadConfig.getInt("AltOlyMaxBuffs", 5);

View File

@@ -93,7 +93,10 @@ public class Hero
protected Hero()
{
init();
if (Config.OLYMPIAD_ENABLED)
{
init();
}
}
private void init()

View File

@@ -166,12 +166,19 @@ public class Olympiad extends ListenersContainer
protected Olympiad()
{
load();
AntiFeedManager.getInstance().registerEvent(AntiFeedManager.OLYMPIAD_ID);
if (_period == 0)
if (Config.OLYMPIAD_ENABLED)
{
init();
load();
AntiFeedManager.getInstance().registerEvent(AntiFeedManager.OLYMPIAD_ID);
if (_period == 0)
{
init();
}
}
else
{
LOGGER.log(Level.INFO, "Disabled.");
}
}