From 65668afa0d80440c4ef54a58ac14f7daecaa4b50 Mon Sep 17 00:00:00 2001 From: Zoey76 <zoey_76@msn.com> Date: Mon, 26 Aug 2013 01:32:09 +0000 Subject: [PATCH] BETA: Datapack part for [L6184]. --- .../data/scripts/ai/individual/Antharas.java | 2 +- .../CastleTeleporter/CastleTeleporter.java | 5 ++--- .../AdminAnnouncements.java | 2 +- .../admincommandhandlers/AdminCreateItem.java | 2 +- .../admincommandhandlers/AdminEditChar.java | 21 ++++++------------- .../admincommandhandlers/AdminKick.java | 2 +- .../chathandlers/ChatBattlefield.java | 4 ++-- .../handlers/chathandlers/ChatHeroVoice.java | 2 +- .../handlers/chathandlers/ChatShout.java | 9 +++----- .../handlers/chathandlers/ChatTrade.java | 9 +++----- .../punishmenthandlers/BanHandler.java | 2 +- .../punishmenthandlers/ChatBanHandler.java | 4 ++-- .../punishmenthandlers/JailHandler.java | 4 ++-- .../handlers/telnethandlers/DebugHandler.java | 5 ++--- .../telnethandlers/StatusHandler.java | 5 ++--- .../TerritoryWarSuperClass.java | 4 ++-- 16 files changed, 32 insertions(+), 50 deletions(-) diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Antharas.java b/L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Antharas.java index 9ddec0ea0c..1412cb818e 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Antharas.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Antharas.java @@ -821,7 +821,7 @@ public class Antharas extends AbstractNpcAI GrandBossManager.getInstance().setBossStatus(_bossId, DORMANT); if (FWA_DOSERVEREARTHQUAKE) { - for (L2PcInstance p : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance p : L2World.getInstance().getPlayers()) { p.broadcastPacket(new Earthquake(185708, 114298, -8221, 20, 10)); } diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/CastleTeleporter/CastleTeleporter.java b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/CastleTeleporter/CastleTeleporter.java index 88ebfa12b4..3aa1247cdb 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/CastleTeleporter/CastleTeleporter.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/ai/npc/CastleTeleporter/CastleTeleporter.java @@ -78,9 +78,8 @@ public class CastleTeleporter extends AbstractNpcAI msg.addStringParameter(npc.getCastle().getName()); npc.getCastle().oustAllPlayers(); npc.setScriptValue(0); - - final L2PcInstance[] players = L2World.getInstance().getAllPlayersArray(); - for (L2PcInstance pl : players) + // TODO: Is it possible to get all the players for that region, instead of all players? + for (L2PcInstance pl : L2World.getInstance().getPlayers()) { if (region == MapRegionManager.getInstance().getMapRegionLocId(pl)) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminAnnouncements.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminAnnouncements.java index 4248468336..7851007a5f 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminAnnouncements.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminAnnouncements.java @@ -108,7 +108,7 @@ public class AdminAnnouncements implements IAdminCommandHandler } else if (command.equals("admin_announce_announcements")) { - for (L2PcInstance player : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { Announcements.getInstance().showAnnouncements(player); } diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminCreateItem.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminCreateItem.java index a1b9a5c0c7..ce71a2b38c 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminCreateItem.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminCreateItem.java @@ -186,7 +186,7 @@ public class AdminCreateItem implements IAdminCommandHandler activeChar.sendMessage("This item does not stack - Creation aborted."); return false; } - for (L2PcInstance onlinePlayer : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance onlinePlayer : L2World.getInstance().getPlayers()) { if ((activeChar != onlinePlayer) && onlinePlayer.isOnline() && ((onlinePlayer.getClient() != null) && !onlinePlayer.getClient().isDetached())) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 42ca916738..8321f6ebae 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -848,7 +848,7 @@ public class AdminEditChar implements IAdminCommandHandler private void listCharacters(L2PcInstance activeChar, int page) { - L2PcInstance[] players = L2World.getInstance().getAllPlayersArray(); + L2PcInstance[] players = L2World.getInstance().getPlayers().toArray(new L2PcInstance[L2World.getInstance().getAllPlayersCount()]); int maxCharactersPerPage = 20; int maxPages = players.length / maxCharactersPerPage; @@ -1132,13 +1132,12 @@ public class AdminEditChar implements IAdminCommandHandler { int CharactersFound = 0; String name; - L2PcInstance[] players = L2World.getInstance().getAllPlayersArray(); final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/charfind.htm"); final StringBuilder replyMSG = new StringBuilder(1000); - for (L2PcInstance player : players) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { // Add player info into new Table row name = player.getName(); if (name.toLowerCase().contains(CharacterToFind.toLowerCase())) @@ -1198,14 +1197,14 @@ public class AdminEditChar implements IAdminCommandHandler throw new IllegalArgumentException("Malformed IPv4 number"); } } - L2PcInstance[] players = L2World.getInstance().getAllPlayersArray(); + int CharactersFound = 0; L2GameClient client; String name, ip = "0.0.0.0"; final StringBuilder replyMSG = new StringBuilder(1000); final NpcHtmlMessage adminReply = new NpcHtmlMessage(); adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/ipfind.htm"); - for (L2PcInstance player : players) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { client = player.getClient(); if (client == null) @@ -1313,16 +1312,12 @@ public class AdminEditChar implements IAdminCommandHandler */ private void findDualbox(L2PcInstance activeChar, int multibox) { - L2PcInstance[] players = L2World.getInstance().getAllPlayersArray(); - Map<String, List<L2PcInstance>> ipMap = new HashMap<>(); - String ip = "0.0.0.0"; L2GameClient client; - final Map<String, Integer> dualboxIPs = new HashMap<>(); - for (L2PcInstance player : players) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { client = player.getClient(); if ((client == null) || client.isDetached()) @@ -1378,15 +1373,11 @@ public class AdminEditChar implements IAdminCommandHandler private void findDualboxStrict(L2PcInstance activeChar, int multibox) { - L2PcInstance[] players = L2World.getInstance().getAllPlayersArray(); - Map<IpPack, List<L2PcInstance>> ipMap = new HashMap<>(); - L2GameClient client; - final Map<IpPack, Integer> dualboxIPs = new HashMap<>(); - for (L2PcInstance player : players) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { client = player.getClient(); if ((client == null) || client.isDetached()) diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminKick.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminKick.java index 9a2ca366de..c397add1e6 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminKick.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/admincommandhandlers/AdminKick.java @@ -53,7 +53,7 @@ public class AdminKick implements IAdminCommandHandler if (command.startsWith("admin_kick_non_gm")) { int counter = 0; - for (L2PcInstance player : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if (!player.isGM()) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatBattlefield.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatBattlefield.java index 2f99e8db07..b68b678bf7 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatBattlefield.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatBattlefield.java @@ -52,8 +52,8 @@ public class ChatBattlefield implements IChatHandler return; } - CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); - for (L2PcInstance player : L2World.getInstance().getAllPlayersArray()) + final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if (player.getSiegeSide() == activeChar.getSiegeSide()) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatHeroVoice.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatHeroVoice.java index 7e690500d7..25bbc7d35b 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatHeroVoice.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatHeroVoice.java @@ -60,7 +60,7 @@ public class ChatHeroVoice implements IChatHandler } CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); - for (L2PcInstance player : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if ((player != null) && !BlockList.isBlocked(player, activeChar)) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatShout.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatShout.java index 62c0aeb6a3..9673d7a204 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatShout.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatShout.java @@ -52,14 +52,11 @@ public class ChatShout implements IChatHandler return; } - CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); - - L2PcInstance[] pls = L2World.getInstance().getAllPlayersArray(); - + final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); if (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_GLOBAL_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))) { int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); - for (L2PcInstance player : pls) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if ((region == MapRegionManager.getInstance().getMapRegionLocId(player)) && !BlockList.isBlocked(player, activeChar) && (player.getInstanceId() == activeChar.getInstanceId())) { @@ -75,7 +72,7 @@ public class ChatShout implements IChatHandler return; } - for (L2PcInstance player : pls) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if (!BlockList.isBlocked(player, activeChar)) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatTrade.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatTrade.java index 1a30ca11d7..3300e2d16e 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatTrade.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/chathandlers/ChatTrade.java @@ -52,14 +52,11 @@ public class ChatTrade implements IChatHandler return; } - CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); - - L2PcInstance[] pls = L2World.getInstance().getAllPlayersArray(); - + final CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text); if (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("on") || (Config.DEFAULT_TRADE_CHAT.equalsIgnoreCase("gm") && activeChar.canOverrideCond(PcCondOverride.CHAT_CONDITIONS))) { int region = MapRegionManager.getInstance().getMapRegionLocId(activeChar); - for (L2PcInstance player : pls) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if ((region == MapRegionManager.getInstance().getMapRegionLocId(player)) && !BlockList.isBlocked(player, activeChar) && (player.getInstanceId() == activeChar.getInstanceId())) { @@ -75,7 +72,7 @@ public class ChatTrade implements IChatHandler return; } - for (L2PcInstance player : pls) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if (!BlockList.isBlocked(player, activeChar)) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/BanHandler.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/BanHandler.java index e88e876c6c..01318d8d94 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/BanHandler.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/BanHandler.java @@ -68,7 +68,7 @@ public class BanHandler implements IPunishmentHandler case IP: { String ip = String.valueOf(task.getKey()); - for (L2PcInstance player : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if (player.getIPAddress().equals(ip)) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/ChatBanHandler.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/ChatBanHandler.java index 5a9dad4414..df83188399 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/ChatBanHandler.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/ChatBanHandler.java @@ -65,7 +65,7 @@ public class ChatBanHandler implements IPunishmentHandler case IP: { String ip = String.valueOf(task.getKey()); - for (L2PcInstance player : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if (player.getIPAddress().equals(ip)) { @@ -109,7 +109,7 @@ public class ChatBanHandler implements IPunishmentHandler case IP: { String ip = String.valueOf(task.getKey()); - for (L2PcInstance player : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if (player.getIPAddress().equals(ip)) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/JailHandler.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/JailHandler.java index c39964899e..c1bf8411d4 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/JailHandler.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/punishmenthandlers/JailHandler.java @@ -86,7 +86,7 @@ public class JailHandler extends PlayerSpawnListener implements IPunishmentHandl case IP: { String ip = String.valueOf(task.getKey()); - for (L2PcInstance player : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if (player.getIPAddress().equals(ip)) { @@ -130,7 +130,7 @@ public class JailHandler extends PlayerSpawnListener implements IPunishmentHandl case IP: { String ip = String.valueOf(task.getKey()); - for (L2PcInstance player : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if (player.getIPAddress().equals(ip)) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/telnethandlers/DebugHandler.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/telnethandlers/DebugHandler.java index 6c190619a5..fc99a9515a 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/telnethandlers/DebugHandler.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/telnethandlers/DebugHandler.java @@ -366,7 +366,7 @@ public class DebugHandler implements ITelnetHandler int max = LoginServerThread.getInstance().getMaxPlayer(); playerCount = L2World.getInstance().getAllPlayersCount(); - objectCount = L2World.getInstance().getAllVisibleObjectsCount(); + objectCount = L2World.getInstance().getVisibleObjectsCount(); int itemCount = 0; int itemVoidCount = 0; @@ -381,8 +381,7 @@ public class DebugHandler implements ITelnetHandler int summonCount = 0; int AICount = 0; - L2Object[] objs = L2World.getInstance().getAllVisibleObjectsArray(); - for (L2Object obj : objs) + for (L2Object obj : L2World.getInstance().getVisibleObjects()) { if (obj == null) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/telnethandlers/StatusHandler.java b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/telnethandlers/StatusHandler.java index 256a14bd47..8682565b6f 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/handlers/telnethandlers/StatusHandler.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/handlers/telnethandlers/StatusHandler.java @@ -123,7 +123,7 @@ public class StatusHandler implements ITelnetHandler int max = LoginServerThread.getInstance().getMaxPlayer(); playerCount = L2World.getInstance().getAllPlayersCount(); - objectCount = L2World.getInstance().getAllVisibleObjectsCount(); + objectCount = L2World.getInstance().getVisibleObjectsCount(); int itemCount = 0; int itemVoidCount = 0; @@ -138,8 +138,7 @@ public class StatusHandler implements ITelnetHandler int summonCount = 0; int AICount = 0; - L2Object[] objs = L2World.getInstance().getAllVisibleObjectsArray(); - for (L2Object obj : objs) + for (L2Object obj : L2World.getInstance().getVisibleObjects()) { if (obj == null) { diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/quests/TerritoryWarScripts/TerritoryWarSuperClass.java b/L2J_DataPack_BETA/dist/game/data/scripts/quests/TerritoryWarScripts/TerritoryWarSuperClass.java index 0001310002..7dd70d8577 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/quests/TerritoryWarScripts/TerritoryWarSuperClass.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/quests/TerritoryWarScripts/TerritoryWarSuperClass.java @@ -244,7 +244,7 @@ public class TerritoryWarSuperClass extends Quest int territoryId = getTerritoryIdForThisNPCId(npc.getId()); if ((territoryId >= 81) && (territoryId <= 89)) { - for (L2PcInstance pl : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance pl : L2World.getInstance().getPlayers()) { if (pl.getSiegeSide() == territoryId) { @@ -431,7 +431,7 @@ public class TerritoryWarSuperClass extends Quest { super.setOnEnterWorld(val); - for (L2PcInstance player : L2World.getInstance().getAllPlayersArray()) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if (player.getSiegeSide() > 0) { -- GitLab