Addition of OlympiadEnabled configuration.
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
# Also please understand what you are changing before you do so on a live server.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable Olympiad.
|
||||
# Default: False
|
||||
OlympiadEnabled = False
|
||||
|
||||
# Olympiad Start Time in Military hours Default 6pm (18)
|
||||
# Default: 18
|
||||
AltOlyStartTime = 18
|
||||
|
||||
@@ -18,6 +18,7 @@ package ai.others.MonumentOfHeroes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.enums.CategoryType;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
@@ -59,9 +60,12 @@ public class MonumentOfHeroes extends AbstractNpcAI
|
||||
|
||||
private MonumentOfHeroes()
|
||||
{
|
||||
addStartNpc(MONUMENT);
|
||||
addFirstTalkId(MONUMENT);
|
||||
addTalkId(MONUMENT);
|
||||
if (Config.OLYMPIAD_ENABLED)
|
||||
{
|
||||
addStartNpc(MONUMENT);
|
||||
addFirstTalkId(MONUMENT);
|
||||
addTalkId(MONUMENT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package ai.others.OlyBuffer;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
@@ -48,9 +49,12 @@ public class OlyBuffer extends AbstractNpcAI
|
||||
|
||||
private OlyBuffer()
|
||||
{
|
||||
addStartNpc(OLYMPIAD_BUFFER);
|
||||
addFirstTalkId(OLYMPIAD_BUFFER);
|
||||
addTalkId(OLYMPIAD_BUFFER);
|
||||
if (Config.OLYMPIAD_ENABLED)
|
||||
{
|
||||
addStartNpc(OLYMPIAD_BUFFER);
|
||||
addFirstTalkId(OLYMPIAD_BUFFER);
|
||||
addTalkId(OLYMPIAD_BUFFER);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,10 +60,13 @@ public class OlyManager extends AbstractNpcAI implements IBypassHandler
|
||||
|
||||
private OlyManager()
|
||||
{
|
||||
addStartNpc(MANAGER);
|
||||
addFirstTalkId(MANAGER);
|
||||
addTalkId(MANAGER);
|
||||
BypassHandler.getInstance().registerHandler(this);
|
||||
if (Config.OLYMPIAD_ENABLED)
|
||||
{
|
||||
addStartNpc(MANAGER);
|
||||
addFirstTalkId(MANAGER);
|
||||
addTalkId(MANAGER);
|
||||
BypassHandler.getInstance().registerHandler(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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_OLYMPIAD_GAMES_ARE_NOT_CURRENTLY_IN_PROGRESS);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (id != COMMAND_IDS[0])
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -554,6 +554,7 @@ public class Config
|
||||
public static int WORLD_CHAT_MIN_LEVEL;
|
||||
public static int WORLD_CHAT_POINTS_PER_DAY;
|
||||
public static Duration WORLD_CHAT_INTERVAL;
|
||||
public static boolean OLYMPIAD_ENABLED;
|
||||
public static int ALT_OLY_START_TIME;
|
||||
public static int ALT_OLY_MIN;
|
||||
public static long ALT_OLY_CPERIOD;
|
||||
@@ -2351,6 +2352,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", 20);
|
||||
ALT_OLY_MIN = olympiadConfig.getInt("AltOlyMin", 0);
|
||||
ALT_OLY_CPERIOD = olympiadConfig.getLong("AltOlyCPeriod", 14400000);
|
||||
|
||||
@@ -95,7 +95,10 @@ public class Hero
|
||||
|
||||
protected Hero()
|
||||
{
|
||||
init();
|
||||
if (Config.OLYMPIAD_ENABLED)
|
||||
{
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
private void init()
|
||||
|
||||
@@ -132,12 +132,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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user