- 积分
- 122
- 最后登录
- 2018-8-4
- 阅读权限
- 10
- 积分
- 122
- 回帖
- 3
- 精华
- 0
TA的每日心情 | 怒 2018-8-4 16:33 |
---|
签到天数: 2 天 [LV.1]初来乍到 新人上路
- 枫币
- 85
- 威望
- 8
- 贡献
- 13
- 在线时间
- 1 小时
- 注册时间
- 2018-8-3
|
找到MapleMapFactory.java
try
{
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM spawns WHERE mid = ?");
ps.setInt(1, omapid);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int id = rs.getInt("idd");
int f = rs.getInt("f");
boolean hide = false;
String type = rs.getString("type");
int _fh = rs.getInt("fh");
int cy = rs.getInt("cy");
int rx0 = rs.getInt("rx0");
int rx1 = rs.getInt("rx1");
int x = rs.getInt("x");
int y = rs.getInt("y");
int mobTime = rs.getInt("mobtime");
AbstractLoadedMapleLife myLife = loadLife(id, f, hide, _fh, cy, rx0, rx1, x, y, type);
if(type.equals("n"))
{
map.addMapObject(myLife);
}
}
} catch(SQLException e) {
}
改成
try
{
PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT * FROM spawns WHERE mid = ?");
ps.setInt(1, omapid);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int sqlid = rs.getInt("idd");
int sqlf = rs.getInt("f");
boolean sqlhide = false;
String sqltype = rs.getString("type");
int sqlfh = rs.getInt("fh");
int sqlcy = rs.getInt("cy");
int sqlrx0 = rs.getInt("rx0");
int sqlrx1 = rs.getInt("rx1");
int sqlx = rs.getInt("x");
int sqly = rs.getInt("y");
int sqlmobTime = rs.getInt("mobtime");
AbstractLoadedMapleLife sqlmyLife = loadLife(sqlid, sqlf, sqlhide, sqlfh, sqlcy, sqlrx0, sqlrx1, sqlx, sqly, sqltype);
switch (sqltype) {
case "n":
map.addMapObject(sqlmyLife);
break;
case "m":
MapleMonster monster = (MapleMonster) sqlmyLife;
map.addMonsterSpawn(monster, sqlmobTime, (byte) -1, null);
break;
}
}
} catch (SQLException e){
}
沒意外的話這樣子加上去之後也能把固定spawn怪物的功能寫到command裡面
因為原來的問題應該是開server的時候抓不到sql
|
|
2023-12-29 18:08
签到天数: 83 天
[LV.6]常住居民II
版主
使用道具 举报