LunaChat v2.6.0 : Added auto update schem for UUID.

このコミットが含まれているのは:
ucchyocean committed 2014-04-12 17:20:07 +09:00
1 親 2459af7e2b
コミット b367917c55
3ファイル変更
+74 -41

検索条件に一致するファイルはありません

+31
ファイルの表示
@@ -23,6 +23,7 @@ import org.bukkit.entity.Player;
import com.github.ucchyocean.lc.LunaChat;
import com.github.ucchyocean.lc.LunaChatAPI;
import com.github.ucchyocean.lc.LunaChatConfig;
import com.github.ucchyocean.lc.Utility;
import com.github.ucchyocean.lc.event.LunaChatChannelMemberChangedEvent;
/**
@@ -566,6 +567,30 @@ public abstract class Channel implements ConfigurationSerializable {
return (Map<String, Long>)obj;
}
/**
* チャンネルの設定ファイルが、UUID化のために一旦保存が必要かどうかを返す
* @param data チャンネルの実コンフィグデータ
*/
private static boolean isNeedToSaveForUUIDUpdate(Map<String, Object> data) {
if ( !Utility.isCB178orLater() ) {
return false;
}
List<String> members = castToStringList(data.get(KEY_MEMBERS));
if ( members.size() == 0 ) {
return false;
}
for ( String member : members ) {
if ( member.startsWith("$") ) {
return false;
}
}
return true;
}
/**
* チャンネルの説明文を返す
* @return チャンネルの説明文
@@ -863,6 +888,12 @@ public abstract class Channel implements ConfigurationSerializable {
data.put(key, config.get(key));
}
Channel channel = deserialize(data);
// 自動アップデート
if ( isNeedToSaveForUUIDUpdate(data) ) {
channel.save();
}
result.put(channel.name.toLowerCase(), channel);
}