// TODO only notify channels where partymembers are? public void updateParty(int partyid, PartyOperation operation, MaplePartyCharacter target) throws RemoteException { MapleParty party = WorldRegistryImpl.getInstance().getParty(partyid); if (party == null) { throw new IllegalArgumentException("no party with the specified partyid exists"); } switch (operation) { case JOIN: party.addMember(target); break; case EXPEL: case LEAVE: party.removeMember(target); break; case DISBAND: WorldRegistryImpl.getInstance().disbandParty(partyid); break; case SILENT_UPDATE: case LOG_ONOFF: party.updateMember(target); break; default: throw new RuntimeException("Unhandeled updateParty operation " + operation.name()); } for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.updateParty(party, operation, target); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
public void broadcastMessage(String sender, byte[] message) throws RemoteException { for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.broadcastMessage(sender, message); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
public void declineChat(String target, String namefrom) throws RemoteException { for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.declineChat(target, namefrom); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
public void messengerInvite(String sender, int messengerid, String target, int fromchannel) throws RemoteException { for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.messengerInvite(sender, messengerid, target, fromchannel); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
public void whisper(String sender, String target, int channel, String message) throws RemoteException { for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.whisper(sender, target, channel, message); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
public void serverReady() throws RemoteException { ready = true; for (LoginWorldInterface wli : WorldRegistryImpl.getInstance().getLoginServer()) { try { wli.channelOnline(cb.getChannelId(), cb.getIP()); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterLoginServer(wli); } } log.info("Channel {} is online.", cb.getChannelId()); }
public void loggedOn(String name, int characterId, int channel, int[] buddies) throws RemoteException { for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.loggedOn(name, characterId, channel, buddies); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
public boolean isConnected(String charName) throws RemoteException { for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { if (cwi.isConnected(charName)) { return true; } } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } return false; }
@Override public CharacterIdChannelPair[] multiBuddyFind(int charIdFrom, int[] characterIds) throws RemoteException { List<CharacterIdChannelPair> foundsChars = new ArrayList<CharacterIdChannelPair>(characterIds.length); for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); for (int charid : cwi.multiBuddyFind(charIdFrom, characterIds)) { foundsChars.add(new CharacterIdChannelPair(charid, i)); } } return foundsChars.toArray(new CharacterIdChannelPair[foundsChars.size()]); }
public String getIP(int channel) throws RemoteException { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(channel); if (cwi == null) { return "0.0.0.0:0"; } else { try { return cwi.getIP(); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(channel); return "0.0.0.0:0"; } } }
public List<CheaterData> getCheaters() throws RemoteException { List<CheaterData> allCheaters = new ArrayList<CheaterData>(); for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { allCheaters.addAll(cwi.getCheaters()); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } Collections.sort(allCheaters); return CollectionUtil.copyFirst(allCheaters, 10); }
public WorldLocation getLocation(String charName) throws RemoteException { for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { if (cwi.isConnected(charName)) { return new WorldLocation(cwi.getLocation(charName), cwi.getChannelId()); } } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } return null; }
// can we generify this @Override public int find(int characterId) throws RemoteException { for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { if (cwi.isConnected(characterId)) { return cwi.getChannelId(); } } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } return -1; }
public void updateMessenger(int messengerid, String namefrom, int fromchannel) throws RemoteException { MapleMessenger messenger = WorldRegistryImpl.getInstance().getMessenger(messengerid); int position = messenger.getPositionByName(namefrom); for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.updateMessenger(messenger, namefrom, position, fromchannel); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
public void messengerChat(int messengerid, String chattext, String namefrom) throws RemoteException { MapleMessenger messenger = WorldRegistryImpl.getInstance().getMessenger(messengerid); if (messenger == null) { throw new IllegalArgumentException("No messenger with the specified messengerid exists"); } for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.messengerChat(messenger, chattext, namefrom); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
// Back to channel public void channelChange(CharacterTransfer data, int characterid, int toChannel) throws RemoteException { for (int j = 0; j < ServerConstants.NUM_WORLDS; j++) { // NUM_WORLDS for (int i : WorldRegistryImpl.getInstance().getChannelServer(j)) { if (i == toChannel) { final ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i, j); try { cwi.channelChange(data, characterid); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i, j); } } } } }
public boolean isCharacterListConnected(List<String> charName) throws RemoteException { for (int j = 0; j < ServerConstants.NUM_WORLDS; j++) { // NUM_WORLDS for (int i : WorldRegistryImpl.getInstance().getChannelServer(j)) { final ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i, j); try { if (cwi.isCharacterListConnected(charName)) { return true; } } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i, j); } } } return false; }
@Override public void partyChat(int partyid, String chattext, String namefrom) throws RemoteException { MapleParty party = WorldRegistryImpl.getInstance().getParty(partyid); if (party == null) { throw new IllegalArgumentException("no party with the specified partyid exists"); } for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.partyChat(party, chattext, namefrom); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
public final String getChannelIP(int channel) throws RemoteException { for (int j = 0; j < ServerConstants.NUM_WORLDS; j++) { // NUM_WORLDS for (int i : WorldRegistryImpl.getInstance().getChannelServer(j)) { if (channel == i) { final ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i, j); try { return cwi.getIP(); } catch (RemoteException e) { // WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } } } return null; }
@Override public void buddyChat(int[] recipientCharacterIds, int cidFrom, String nameFrom, String chattext) throws RemoteException { for (ChannelWorldInterface cwi : WorldRegistryImpl.getInstance().getAllChannelServers()) { cwi.buddyChat(recipientCharacterIds, cidFrom, nameFrom, chattext); } }
public Map<Integer, Integer> getConnected() throws RemoteException { Map<Integer, Integer> ret = new HashMap<Integer, Integer>(); int total = 0; for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { int curConnected = cwi.getConnected(); ret.put(i, curConnected); total += curConnected; } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } ret.put(0, total); return ret; }
public void silentJoinMessenger(int messengerid, MapleMessengerCharacter target, int position) throws RemoteException { MapleMessenger messenger = WorldRegistryImpl.getInstance().getMessenger(messengerid); if (messenger == null) { throw new IllegalArgumentException("No messenger with the specified messengerid exists"); } messenger.silentAddMember(target, position); }
public void shutdown(int time) throws RemoteException { for (LoginWorldInterface lwi : WorldRegistryImpl.getInstance().getLoginServer()) { try { lwi.shutdown(); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterLoginServer(lwi); } } for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.shutdown(time); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
public void leaveMessenger(int messengerid, MapleMessengerCharacter target) throws RemoteException { MapleMessenger messenger = WorldRegistryImpl.getInstance().getMessenger(messengerid); if (messenger == null) { throw new IllegalArgumentException("No messenger with the specified messengerid exists"); } int position = messenger.getPositionByName(target.getName()); messenger.removeMember(target); for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.removeMessengerPlayer(messenger, position); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
public void joinMessenger( int messengerid, MapleMessengerCharacter target, String from, int fromchannel) throws RemoteException { MapleMessenger messenger = WorldRegistryImpl.getInstance().getMessenger(messengerid); if (messenger == null) { throw new IllegalArgumentException("No messenger with the specified messengerid exists"); } messenger.addMember(target); for (int i : WorldRegistryImpl.getInstance().getChannelServer()) { ChannelWorldInterface cwi = WorldRegistryImpl.getInstance().getChannel(i); try { cwi.addMessengerPlayer(messenger, from, fromchannel, target.getPosition()); } catch (RemoteException e) { WorldRegistryImpl.getInstance().deregisterChannelServer(i); } } }
@Override public void gainGP(int gid, int amount) throws RemoteException { WorldRegistryImpl.getInstance().gainGP(gid, amount); }
public List<PlayerCoolDownValueHolder> getCooldownsFromStorage(int chrid) throws RemoteException { PlayerBuffStorage buffStorage = WorldRegistryImpl.getInstance().getPlayerBuffStorage(); return buffStorage.getCooldownsFromStorage(chrid); }
public void addCooldownsToStorage(int chrid, List<PlayerCoolDownValueHolder> toStore) throws RemoteException { PlayerBuffStorage buffStorage = WorldRegistryImpl.getInstance().getPlayerBuffStorage(); buffStorage.addCooldownsToStorage(chrid, toStore); }
public MapleMessenger createMessenger(MapleMessengerCharacter chrfor) throws RemoteException { return WorldRegistryImpl.getInstance().createMessenger(chrfor); }
public MapleMessenger getMessenger(int messengerid) throws RemoteException { return WorldRegistryImpl.getInstance().getMessenger(messengerid); }