// 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()]);
 }
Ejemplo n.º 10
0
 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";
     }
   }
 }
Ejemplo n.º 11
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);
 }
Ejemplo n.º 12
0
 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;
 }
Ejemplo n.º 13
0
 // 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;
 }
Ejemplo n.º 14
0
  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);
      }
    }
  }
Ejemplo n.º 15
0
 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;
 }
Ejemplo n.º 18
0
 @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;
 }
Ejemplo n.º 20
0
 @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);
   }
 }
Ejemplo n.º 21
0
 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;
 }
Ejemplo n.º 22
0
 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);
 }
Ejemplo n.º 23
0
 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);
     }
   }
 }
Ejemplo n.º 24
0
  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);
      }
    }
  }
Ejemplo n.º 25
0
  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);
      }
    }
  }
Ejemplo n.º 26
0
 @Override
 public void gainGP(int gid, int amount) throws RemoteException {
   WorldRegistryImpl.getInstance().gainGP(gid, amount);
 }
Ejemplo n.º 27
0
 public List<PlayerCoolDownValueHolder> getCooldownsFromStorage(int chrid) throws RemoteException {
   PlayerBuffStorage buffStorage = WorldRegistryImpl.getInstance().getPlayerBuffStorage();
   return buffStorage.getCooldownsFromStorage(chrid);
 }
Ejemplo n.º 28
0
 public void addCooldownsToStorage(int chrid, List<PlayerCoolDownValueHolder> toStore)
     throws RemoteException {
   PlayerBuffStorage buffStorage = WorldRegistryImpl.getInstance().getPlayerBuffStorage();
   buffStorage.addCooldownsToStorage(chrid, toStore);
 }
Ejemplo n.º 29
0
 public MapleMessenger createMessenger(MapleMessengerCharacter chrfor) throws RemoteException {
   return WorldRegistryImpl.getInstance().createMessenger(chrfor);
 }
Ejemplo n.º 30
0
 public MapleMessenger getMessenger(int messengerid) throws RemoteException {
   return WorldRegistryImpl.getInstance().getMessenger(messengerid);
 }