use of net.server.PlayerStorage in project HeavenMS by ronancpl.
the class World method updateBuddies.
private void updateBuddies(int characterId, int channel, int[] buddies, boolean offline) {
PlayerStorage playerStorage = getPlayerStorage();
for (int buddy : buddies) {
MapleCharacter chr = playerStorage.getCharacterById(buddy);
if (chr != null) {
BuddylistEntry ble = chr.getBuddylist().get(characterId);
if (ble != null && ble.isVisible()) {
int mcChannel;
if (offline) {
ble.setChannel((byte) -1);
mcChannel = -1;
} else {
ble.setChannel(channel);
mcChannel = (byte) (channel - 1);
}
chr.getBuddylist().put(ble);
chr.getClient().announce(MaplePacketCreator.updateBuddyChannel(ble.getCharacterId(), mcChannel));
}
}
}
}
use of net.server.PlayerStorage in project HeavenMS by ronancpl.
the class Channel method multiBuddyFind.
public int[] multiBuddyFind(int charIdFrom, int[] characterIds) {
List<Integer> ret = new ArrayList<>(characterIds.length);
PlayerStorage playerStorage = getPlayerStorage();
for (int characterId : characterIds) {
MapleCharacter chr = playerStorage.getCharacterById(characterId);
if (chr != null) {
if (chr.getBuddylist().containsVisible(charIdFrom)) {
ret.add(characterId);
}
}
}
int[] retArr = new int[ret.size()];
int pos = 0;
for (Integer i : ret) {
retArr[pos++] = i.intValue();
}
return retArr;
}
Aggregations