diff --git a/L2J_Mobius_01.0_Ertheia/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_01.0_Ertheia/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_01.0_Ertheia/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/MasterHandler.java index 8c5b8f8aed..a6b48d2bc6 100644 --- a/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/MasterHandler.java @@ -335,6 +335,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -590,6 +591,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/Config.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/Config.java index 37d9eee40a..df5feedcb7 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/Config.java @@ -131,6 +131,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1190,6 +1191,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3303,6 +3305,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_02.5_Underground/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_02.5_Underground/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_02.5_Underground/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/MasterHandler.java index e0064851f8..237d138579 100644 --- a/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/MasterHandler.java @@ -336,6 +336,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -592,6 +593,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/Config.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/Config.java index 92f4a62a32..87b6286960 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/Config.java @@ -132,6 +132,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1202,6 +1203,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3329,6 +3331,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_03.0_Helios/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_03.0_Helios/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_03.0_Helios/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/MasterHandler.java index 6051767c80..e61eb22f79 100644 --- a/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/MasterHandler.java @@ -337,6 +337,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -594,6 +595,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/Config.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/Config.java index c9eece493d..b93731fd89 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/Config.java @@ -132,6 +132,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1215,6 +1216,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3351,6 +3353,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_04.0_GrandCrusade/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_04.0_GrandCrusade/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_04.0_GrandCrusade/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/MasterHandler.java index 6051767c80..e61eb22f79 100644 --- a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/MasterHandler.java @@ -337,6 +337,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -594,6 +595,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/Config.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/Config.java index 414e6cb0fc..ceed168d13 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/Config.java @@ -132,6 +132,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1202,6 +1203,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3325,6 +3327,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_05.0_Salvation/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_05.0_Salvation/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_05.0_Salvation/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/MasterHandler.java index 6051767c80..e61eb22f79 100644 --- a/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/MasterHandler.java @@ -337,6 +337,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -594,6 +595,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/Config.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/Config.java index a714ef0359..49c82ad3af 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/Config.java @@ -133,6 +133,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1201,6 +1202,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3334,6 +3336,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_05.5_EtinasFate/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_05.5_EtinasFate/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/MasterHandler.java index 6051767c80..e61eb22f79 100644 --- a/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/MasterHandler.java @@ -337,6 +337,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -594,6 +595,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/Config.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/Config.java index af5a7c35fa..045cd2c8ef 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/Config.java @@ -133,6 +133,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1208,6 +1209,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3346,6 +3348,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_06.0_Fafurion/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_06.0_Fafurion/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/MasterHandler.java index b592d583c4..bf491fe60e 100644 --- a/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/MasterHandler.java @@ -338,6 +338,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -596,6 +597,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/Config.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/Config.java index 03cb46ff8d..c9309a6989 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/Config.java @@ -133,6 +133,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1230,6 +1231,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3389,6 +3391,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_07.0_PreludeOfWar/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_07.0_PreludeOfWar/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/MasterHandler.java index b592d583c4..bf491fe60e 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/MasterHandler.java @@ -338,6 +338,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -596,6 +597,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/Config.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/Config.java index 0052c5f01f..daa29ff093 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/Config.java @@ -133,6 +133,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1238,6 +1239,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3405,6 +3407,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_08.2_Homunculus/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_08.2_Homunculus/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/MasterHandler.java index b592d583c4..bf491fe60e 100644 --- a/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/MasterHandler.java @@ -338,6 +338,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -596,6 +597,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/Config.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/Config.java index 01ec71be67..7f51ca6a90 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/Config.java @@ -132,6 +132,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1230,6 +1231,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3381,6 +3383,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/MasterHandler.java index 49c80ee056..16ba80dd06 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/MasterHandler.java @@ -339,6 +339,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -598,6 +599,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java index 2a0f3bf48b..077efa084e 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java @@ -133,6 +133,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; private static final String CUSTOM_PRIVATE_STORE_RANGE_CONFIG_FILE = "./config/Custom/PrivateStoreRange.ini"; @@ -1241,6 +1242,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3417,6 +3419,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_10.1_MasterClass/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_10.1_MasterClass/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_10.1_MasterClass/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/MasterHandler.java index 49c80ee056..16ba80dd06 100644 --- a/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/MasterHandler.java @@ -339,6 +339,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -598,6 +599,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/Config.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/Config.java index af3ebc714e..afd327d7e9 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/Config.java @@ -133,6 +133,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; private static final String CUSTOM_PRIVATE_STORE_RANGE_CONFIG_FILE = "./config/Custom/PrivateStoreRange.ini"; @@ -1241,6 +1242,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3417,6 +3419,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_10.2_MasterClass/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_10.2_MasterClass/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/MasterHandler.java index 49c80ee056..16ba80dd06 100644 --- a/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/MasterHandler.java @@ -339,6 +339,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -598,6 +599,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/Config.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/Config.java index af3ebc714e..afd327d7e9 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/Config.java @@ -133,6 +133,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; private static final String CUSTOM_PRIVATE_STORE_RANGE_CONFIG_FILE = "./config/Custom/PrivateStoreRange.ini"; @@ -1241,6 +1242,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3417,6 +3419,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_CT_0_Interlude/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_CT_0_Interlude/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/MasterHandler.java index c69a5e2671..75f100383f 100644 --- a/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/MasterHandler.java @@ -282,6 +282,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; import handlers.voicedcommandhandlers.Wedding; @@ -528,6 +529,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java index cf447f45b8..099b8cadcd 100644 --- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/Config.java @@ -125,6 +125,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1171,6 +1172,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -2774,6 +2776,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/MasterHandler.java index e7d5ea995f..2f077430a3 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/MasterHandler.java @@ -298,6 +298,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; import handlers.voicedcommandhandlers.Wedding; @@ -559,6 +560,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java index d5c513529a..90f17a8d9b 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java @@ -129,6 +129,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1225,6 +1226,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -2892,6 +2894,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/MasterHandler.java index bb0cd2421a..58a2af691d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/MasterHandler.java @@ -299,6 +299,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; import handlers.voicedcommandhandlers.Wedding; @@ -561,6 +562,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java index c63e8fa5ea..0673756884 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java @@ -129,6 +129,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1225,6 +1226,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -2899,6 +2901,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Classic_1.0/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Classic_1.0/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Classic_1.0/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/MasterHandler.java index ad95436773..f2b0dc71a8 100644 --- a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/MasterHandler.java @@ -336,6 +336,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -592,6 +593,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/Config.java index 4248953c99..de15d32711 100644 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/Config.java @@ -131,6 +131,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1142,6 +1143,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3204,6 +3206,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/MasterHandler.java index ad95436773..f2b0dc71a8 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/MasterHandler.java @@ -336,6 +336,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -592,6 +593,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/Config.java index 1ce92423d1..3282398d2d 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/Config.java @@ -132,6 +132,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; @@ -1152,6 +1153,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3233,6 +3235,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/MasterHandler.java index c304ddaf00..47bc5ad520 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/MasterHandler.java @@ -337,6 +337,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -594,6 +595,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java index 6937feeddf..7ac502dbd8 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java @@ -132,6 +132,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; @@ -1151,6 +1152,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3231,6 +3233,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Classic_2.5_Zaken/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/MasterHandler.java index c304ddaf00..47bc5ad520 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/MasterHandler.java @@ -337,6 +337,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -594,6 +595,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/Config.java index de6b0b4de7..fbcf65de25 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/Config.java @@ -132,6 +132,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; @@ -1155,6 +1156,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3237,6 +3239,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Classic_2.7_Antharas/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/MasterHandler.java index c304ddaf00..47bc5ad520 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/MasterHandler.java @@ -337,6 +337,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -594,6 +595,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/Config.java index de6b0b4de7..fbcf65de25 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/Config.java @@ -132,6 +132,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; @@ -1155,6 +1156,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3237,6 +3239,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java index 2e1d5eb378..162dff498f 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java @@ -338,6 +338,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -596,6 +597,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/Config.java index de6b0b4de7..fbcf65de25 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/Config.java @@ -132,6 +132,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; @@ -1155,6 +1156,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3237,6 +3239,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java index d3a5d0b07a..cb57852c1c 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java @@ -339,6 +339,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -598,6 +599,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/Config.java index bf671f05ea..16b8357235 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/Config.java @@ -132,6 +132,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; @@ -1160,6 +1161,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3246,6 +3248,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java index d3a5d0b07a..cb57852c1c 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java @@ -339,6 +339,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -598,6 +599,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java index ec86c01724..3f79343f84 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java @@ -133,6 +133,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1166,6 +1167,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3291,6 +3293,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java index 88e80c1721..49fa25b1d8 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/MasterHandler.java @@ -338,6 +338,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -596,6 +597,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java index 7a6f09f0d5..79caf6c3a9 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java @@ -133,6 +133,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_PC_CAFE_CONFIG_FILE = "./config/Custom/PcCafe.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1167,6 +1168,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3251,6 +3253,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java index 6e0ec9747a..2a9e71fcaa 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java @@ -342,6 +342,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -603,6 +604,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java index c10511d1d9..fd9c7e7997 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java @@ -135,6 +135,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1192,6 +1193,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3344,6 +3346,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/MasterHandler.java index 6e0ec9747a..2a9e71fcaa 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/MasterHandler.java @@ -342,6 +342,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -603,6 +604,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java index d3c74d3a5b..17abbde58b 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java @@ -137,6 +137,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1200,6 +1201,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3446,6 +3448,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/MasterHandler.java index 6e0ec9747a..2a9e71fcaa 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/MasterHandler.java @@ -342,6 +342,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -603,6 +604,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/Config.java index aaac329686..eb46e57479 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/Config.java @@ -138,6 +138,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1207,6 +1208,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3460,6 +3462,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false); diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/Custom/OnlineInfo.ini b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/Custom/OnlineInfo.ini new file mode 100644 index 0000000000..ff0bdbc2cc --- /dev/null +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/config/Custom/OnlineInfo.ini @@ -0,0 +1,7 @@ +# --------------------------------------------------------------------------- +# Online Info Settings +# --------------------------------------------------------------------------- + +# Enable player .online voiced command. +# Shows how many players are online. +EnableOnlineCommand = False diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/MasterHandler.java index 6e0ec9747a..2a9e71fcaa 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/MasterHandler.java @@ -342,6 +342,7 @@ import handlers.voicedcommandhandlers.ChangePassword; import handlers.voicedcommandhandlers.ChatAdmin; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.Offline; +import handlers.voicedcommandhandlers.Online; import handlers.voicedcommandhandlers.Premium; /** @@ -603,6 +604,7 @@ public class MasterHandler Config.MULTILANG_ENABLE && Config.MULTILANG_VOICED_ALLOW ? Lang.class : null, Config.ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null, Config.ENABLE_OFFLINE_COMMAND && (Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) ? Offline.class : null, + Config.ENABLE_ONLINE_COMMAND ? Online.class : null, Config.PREMIUM_SYSTEM_ENABLED ? Premium.class : null, Config.AUTO_POTIONS_ENABLED ? AutoPotion.class : null, }, diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java new file mode 100644 index 0000000000..403e983450 --- /dev/null +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/voicedcommandhandlers/Online.java @@ -0,0 +1,57 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.voicedcommandhandlers; + +import org.l2jmobius.Config; +import org.l2jmobius.gameserver.handler.IVoicedCommandHandler; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Player; + +/** + * @author Mobius + */ +public class Online implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "online" + }; + + @Override + public boolean useVoicedCommand(String command, Player player, String target) + { + if (command.equals("online") && Config.ENABLE_ONLINE_COMMAND) + { + final int count = World.getInstance().getPlayers().size(); + if (count > 1) + { + player.sendMessage("There are " + count + " players online!"); + } + else + { + player.sendMessage("There is 1 player online!"); + } + } + return true; + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java index 5ccc764ab9..92e1ba6b34 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/Config.java @@ -138,6 +138,7 @@ public class Config private static final String CUSTOM_NOBLESS_MASTER_CONFIG_FILE = "./config/Custom/NoblessMaster.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; + private static final String CUSTOM_ONLINE_INFO_CONFIG_FILE = "./config/Custom/OnlineInfo.ini"; private static final String CUSTOM_PASSWORD_CHANGE_CONFIG_FILE = "./config/Custom/PasswordChange.ini"; private static final String CUSTOM_VIP_CONFIG_FILE = "./config/Custom/VipSystem.ini"; private static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; @@ -1207,6 +1208,7 @@ public class Config public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP; public static boolean DUALBOX_COUNT_OFFLINE_TRADERS; public static Map DUALBOX_CHECK_WHITELIST; + public static boolean ENABLE_ONLINE_COMMAND; public static boolean ALLOW_CHANGE_PASSWORD; public static boolean ALLOW_HUMAN; public static boolean ALLOW_ELF; @@ -3460,6 +3462,10 @@ public class Config } } + // Load OnlineInfo config file (if exists) + final PropertiesParser onlineInfoConfig = new PropertiesParser(CUSTOM_ONLINE_INFO_CONFIG_FILE); + ENABLE_ONLINE_COMMAND = onlineInfoConfig.getBoolean("EnableOnlineCommand", false); + // Load PasswordChange config file (if exists) final PropertiesParser passwordChangeConfig = new PropertiesParser(CUSTOM_PASSWORD_CHANGE_CONFIG_FILE); ALLOW_CHANGE_PASSWORD = passwordChangeConfig.getBoolean("AllowChangePassword", false);