Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver
- Index: java/net/sf/l2j/gameserver/model/L2Clan.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/L2Clan.java (revision 1)
- +++ java/net/sf/l2j/gameserver/model/L2Clan.java (working copy)
- @@ -22,6 +22,7 @@
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- +import java.util.concurrent.CopyOnWriteArrayList;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- @@ -64,6 +65,7 @@
- private int _clanId;
- private L2ClanMember _leader;
- private final Map<Integer, L2ClanMember> _members = new HashMap<>();
- + private final List<L2PcInstance> _watchers = new CopyOnWriteArrayList<>();
- private String _allyName;
- private int _allyId;
- @@ -203,6 +205,21 @@
- _members.put(leader.getObjectId(), leader);
- }
- + public List<L2PcInstance> getWatchers()
- + {
- + return _watchers;
- + }
- +
- + public void addWatcher(L2PcInstance player)
- + {
- + _watchers.add(player);
- + }
- +
- + public void removeWatcher(L2PcInstance player)
- + {
- + _watchers.remove(player);
- + }
- +
- public void setNewLeader(L2ClanMember member)
- {
- if (!_leader.isOnline())
- Index: java/net/sf/l2j/gameserver/handler/chathandlers/ChatClan.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/chathandlers/ChatClan.java (revision 1)
- +++ java/net/sf/l2j/gameserver/handler/chathandlers/ChatClan.java (working copy)
- @@ -38,8 +38,15 @@
- {
- if (activeChar.getClan() != null)
- {
- - CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
- + CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
- activeChar.getClan().broadcastToOnlineMembers(cs);
- +
- + if(!activeChar.getClan().getWatchers().isEmpty())
- + {
- + cs = new CreatureSay(activeChar.getObjectId(), type, "[Clan:"+activeChar.getClan().getName()+"]"+activeChar.getName(), text);
- + for(L2PcInstance watcher : activeChar.getClan().getWatchers())
- + watcher.sendPacket(cs);
- + }
- }
- }
- Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 1)
- +++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
- @@ -66,6 +66,7 @@
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTarget;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTeleport;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminUnblockIp;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminWatchClan;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminZone;
- public class AdminCommandHandler
- @@ -98,6 +99,7 @@
- registerAdminCommandHandler(new AdminEffects());
- registerAdminCommandHandler(new AdminEnchant());
- registerAdminCommandHandler(new AdminExpSp());
- + registerAdminCommandHandler(new AdminWatchClan());
- registerAdminCommandHandler(new AdminGeodata());
- registerAdminCommandHandler(new AdminGm());
- registerAdminCommandHandler(new AdminGmChat());
- Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminWatchClan.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminWatchClan.java (revision 0)
- +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminWatchClan.java (revision 0)
- @@ -0,0 +1,86 @@
- +/*
- + * 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 <http://www.gnu.org/licenses/>.
- + */
- +package net.sf.l2j.gameserver.handler.admincommandhandlers;
- +
- +import net.sf.l2j.gameserver.datatables.ClanTable;
- +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
- +import net.sf.l2j.gameserver.model.L2Clan;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +
- +/**
- + * @author Lioy
- + *
- + */
- +public class AdminWatchClan implements IAdminCommandHandler
- +{
- + private static final String[] ADMIN_COMMANDS =
- + {
- + "admin_watchclan",
- + "admin_stopwatch",
- + };
- +
- + @Override
- + public boolean useAdminCommand(String command, L2PcInstance activeChar)
- + {
- + if(command.startsWith(ADMIN_COMMANDS[0]) || command.startsWith(ADMIN_COMMANDS[1]))
- + {
- + L2Clan clan;
- + String clanName;
- + try
- + {
- + clanName = command.substring(16);
- + clan = ClanTable.getInstance().getClanByName(clanName);
- + }
- + catch(Exception e)
- + {
- + activeChar.sendMessage("Incorrect clan name. Usage: //watchclan <clanname>");
- + return false;
- + }
- +
- + if(command.startsWith(ADMIN_COMMANDS[0]))
- + {
- +
- + if(clan.getWatchers().contains(activeChar))
- + {
- + activeChar.sendMessage("You already watch "+clanName +" clan.");
- + return false;
- + }
- +
- + clan.addWatcher(activeChar);
- + activeChar.sendMessage("You are now a watcher in "+clanName +" clan.");
- + }
- +
- + else if(command.startsWith(ADMIN_COMMANDS[1]))
- + {
- + if(!clan.getWatchers().contains(activeChar))
- + {
- + activeChar.sendMessage("You don't watch even "+clanName +" clan.");
- + return false;
- + }
- +
- + clan.removeWatcher(activeChar);
- + activeChar.sendMessage("You are not a watcher anymore in "+clanName +" clan.");
- + }
- + }
- + return true;
- + }
- +
- + @Override
- + public String[] getAdminCommandList()
- + {
- + return ADMIN_COMMANDS;
- + }
- +
- +}
- Index: data/xml/admin_commands_rights.xml
- ===================================================================
- --- data/xml/admin_commands_rights.xml (revision 1)
- +++ data/xml/admin_commands_rights.xml (working copy)
- @@ -14,6 +14,9 @@
- <aCar name="admin_tradeoff" accessLevel="1" />
- <aCar name="admin_reload" accessLevel="1" />
- <aCar name="admin_script_load" accessLevel="1" />
- +
- + <aCar name="admin_watchclan" accessLevel="1" />
- + <aCar name="admin_stopwatch" accessLevel="1" />
- <!-- ANNOUNCEMENTS -->
- <aCar name="admin_list_announcements" accessLevel="1" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement