资源简介
冒险岛 096 游戏服务端 Java源码 适合深入了解Java的朋友,希望能够帮到大家对Java的研究
代码片段和文件信息
package net.sf.odinms.client;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Deque;
import java.util.linkedHashMap;
import java.util.linkedList;
import java.util.Map;
import net.sf.odinms.database.DatabaseConnection;
import net.sf.odinms.tools.MaplePacketCreator;
public class BuddyList {
public enum BuddyOperation {
ADDED DELETED
}
public enum BuddyAddResult {
BUDDYLIST_FULL ALREADY_ON_LIST OK
}
private Map buddies = new linkedHashMap();
private int capacity;
private Deque pendingRequests = new linkedList();
public BuddyList(int capacity) {
super();
this.capacity = capacity;
}
public boolean contains(int characterId) {
return buddies.containsKey(Integer.valueOf(characterId));
}
public boolean containsVisible(int characterId) {
BuddylistEntry ble = buddies.get(characterId);
if (ble == null) {
return false;
}
return ble.isVisible();
}
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public BuddylistEntry get(int characterId) {
return buddies.get(Integer.valueOf(characterId));
}
public BuddylistEntry get(String characterName) {
String lowerCaseName = characterName.toLowerCase();
for (BuddylistEntry ble : buddies.values()) {
if (ble.getName().toLowerCase().equals(lowerCaseName)) {
return ble;
}
}
return null;
}
public void put(BuddylistEntry entry) {
buddies.put(Integer.valueOf(entry.getCharacterId()) entry);
}
public void remove(int characterId) {
buddies.remove(Integer.valueOf(characterId));
}
public Collection getBuddies() {
return buddies.values();
}
public boolean isFull() {
return buddies.size() >= capacity;
}
public int[] getBuddyIds() {
int buddyIds[] = new int[buddies.size()];
int i = 0;
for (BuddylistEntry ble : buddies.values()) {
buddyIds[i++] = ble.getCharacterId();
}
return buddyIds;
}
public void loadFromDb(int characterId) throws SQLException {
try {
PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement(“SELECT b.buddyid b.group b.pending c.name as buddyname FROM buddies as b characters as c WHERE c.id = b.buddyid AND b.characterid = ?“);
ps.setInt(1 characterId);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
if (rs.getInt(“pending“) == 1) { //未处理的好友请求
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-09-21 15:16 096\
文件 2139 2011-09-21 15:17 096\.classpath
文件 379 2011-09-21 15:14 096\.project
目录 0 2011-09-21 15:17 096\.settings\
文件 82 2011-09-21 15:17 096\.settings\org.eclipse.core.resources.prefs
文件 629 2011-09-21 15:14 096\.settings\org.eclipse.jdt.core.prefs
目录 0 2011-09-21 15:17 096\bin\
目录 0 2011-09-21 15:17 096\bin\net\
目录 0 2011-09-21 15:17 096\bin\net\sf\
目录 0 2011-09-21 15:17 096\bin\net\sf\odinms\
目录 0 2011-09-21 15:18 096\bin\net\sf\odinms\client\
目录 0 2011-09-21 15:17 096\bin\net\sf\odinms\client\anticheat\
文件 4257 2011-09-21 15:18 096\bin\net\sf\odinms\client\anticheat\CheatingOffense.class
文件 2850 2011-09-21 15:18 096\bin\net\sf\odinms\client\anticheat\CheatingOffenseEntry.class
文件 3501 2011-09-21 15:18 096\bin\net\sf\odinms\client\anticheat\CheatingOffensePersister$PersistingTask.class
文件 2036 2011-09-21 15:18 096\bin\net\sf\odinms\client\anticheat\CheatingOffensePersister.class
文件 1337 2011-09-21 15:18 096\bin\net\sf\odinms\client\anticheat\CheatTracker$1.class
文件 1926 2011-09-21 15:18 096\bin\net\sf\odinms\client\anticheat\CheatTracker$InvalidationTask.class
文件 11032 2011-09-21 15:18 096\bin\net\sf\odinms\client\anticheat\CheatTracker.class
文件 1259 2011-09-21 15:17 096\bin\net\sf\odinms\client\BuddyList$BuddyAddResult.class
文件 1197 2011-09-21 15:17 096\bin\net\sf\odinms\client\BuddyList$BuddyOperation.class
文件 5961 2011-09-21 15:17 096\bin\net\sf\odinms\client\BuddyList.class
文件 2130 2011-09-21 15:17 096\bin\net\sf\odinms\client\BuddylistEntry.class
文件 748 2011-09-21 15:17 096\bin\net\sf\odinms\client\CharacterNameAndId.class
文件 13847 2011-09-21 15:17 096\bin\net\sf\odinms\client\Equip.class
文件 3585 2011-09-21 15:17 096\bin\net\sf\odinms\client\ExpTable.class
文件 17304 2011-09-21 15:17 096\bin\net\sf\odinms\client\GameConstants.class
文件 1206 2011-09-21 15:17 096\bin\net\sf\odinms\client\IEquip$ScrollResult.class
文件 1235 2011-09-21 15:17 096\bin\net\sf\odinms\client\IEquip.class
文件 1023 2011-09-21 15:17 096\bin\net\sf\odinms\client\IItem.class
文件 276 2011-09-21 15:17 096\bin\net\sf\odinms\client\InventoryContainer.class
............此处省略1238个文件信息
评论
共有 条评论