TIPS
JAVA
- world=L1World.getInstance()
鯖自動再起
・/l1jserver/config/server.properties.xml(176):AutoShutdown True
・/l1jserver/config/server.properties.xml(186):ShutdownRequestDelay⇒ShutdownDelay
・/l1jserver/data/xml/Cycle/ShutdownCycle.xml:時間指定
・コントロールパネル/システムとセキュリティ/管理ツール/タスクのスケジュール(タスクスケジューラ)
・操作→基本タスクの作成→(略)→プログラム:C:\Windows\System32\shutdown.exe 引数:-r -t 60 -f
※プロパティ
・条件:タスクを実行するためにスリープを解除 チェック
・設定:スケジュールされた時刻に~ アンチェック
タスクが失敗した場合の~ アンチェック
・操作→基本タスクの作成→(略)→プログラム:ServerStart.bat※開始(オプション)に作業フォルダ指定(C:\workspace\l1jserver\)
DBへのアクセス
【DBへINSERT】
※キャラクター作成時「character_settings」テーブル(自作)にレコードを追加
・\l1j\trunk\src\jp\l1j\server\storage\mysql\MySqlCharacterStorage.java(174)
・変更点:
PreparedStatement pstm = null;
&font(green){PreparedStatement pstm2 = null;}//追加
try { //@追加 ここから
int i = 0;
con = L1DatabaseFactory.getInstance().getConnection();
pstm2 = con.prepareStatement("INSERT INTO character_settings SET char_id=?,account_id=?,name=?,play_style=0");
pstm2.setInt(++i, pc.getId());
pstm2.setInt(++i, pc.getAccountId());
pstm2.setString(++i, pc.getName());
pstm2.execute();
_log.finest("stored char data: " + pc.getName());
} catch (SQLException e) {
_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
} finally {
SqlUtil.close(pstm2);
SqlUtil.close(con);
} //ここまで
【DBからDELETE】
※キャラクター削除時「character_settings」テーブル(自作)からレコードを削除
・\l1j\trunk\src\jp\l1j\server\storage\mysql\MySqlCharacterStorage.java(272)
・変更点:
L1QueryUtil.execute(con,"DELETE FROM character_bookmarks WHERE char_id = ?", id);
L1QueryUtil.execute(con, "DELETE FROM character_settings WHERE char_id = ?", id); //←追加
L1QueryUtil.execute(con, "DELETE FROM characters WHERE id = ?", id);
【DBへUPDATE】
※プレイスタイル選択時「character_settings」テーブル(自作)のレコードを更新
・\l1j\trunk\src\jp\l1j\server\packets\client\C_NpcAction.java(6592)追加
・追加:
ドロモンドのアクションに追加
if (item != null) {
pc.sendPackets(new S_ServerMessage(143,((L1NpcInstance) obj).getNpcTemplate().getName(), item.getLogName())); // \f1%0が%1をくれました。
setPlayStyle(pc, 3); //←追加
}
public C_NpcAction(byte abyte0[], ClientThread client) throws Exceptionの外に追加
private static void setPlayStyle(L1PcInstance pc, int playsytle){
Connection con = null;
PreparedStatement pstm = null;
try {
int i = 0;
con = L1DatabaseFactory.getInstance().getConnection();
pstm = con.prepareStatement("UPDATE character_settings SET play_style=? WHERE char_id=?");
pstm.setInt(++i, playsytle);
pstm.setInt(++i, pc.getId());
pstm.execute();
_log.finest("stored char data:" + pc.getName());
} catch (SQLException e) {
_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
} finally {
SqlUtil.close(pstm);
SqlUtil.close(con);
}
}
.
最終更新:2014年08月31日 16:35