LunaChat v2.1.0 : Fixed issue #31, and refactored.

このコミットが含まれているのは:
ucchyocean committed 2013-07-05 02:56:32 +09:00
1 親 eecd13d566
コミット 59b7126257
8ファイル変更
+30 -51

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

+15 -11
ファイルの表示
@@ -59,6 +59,8 @@ public class Channel implements ConfigurationSerializable {
private static final String MSG_KICKED = Resources.get("cmdmsgKicked");
private static final String MSG_BANNED = Resources.get("cmdmsgBanned");
private static final String MSG_NO_RECIPIENT = Resources.get("messageNoRecipient");
private static final String KEY_NAME = "name";
private static final String KEY_DESC = "desc";
private static final String KEY_FORMAT = "format";
@@ -239,8 +241,7 @@ public class Channel implements ConfigurationSerializable {
banned.add(player.getName());
removeMember(player.getName());
String temp = PREINFO + NGWORD_PREFIX + MSG_BANNED;
String m = String.format(
Utility.replaceColorCode(temp), name);
String m = String.format(temp, name);
player.sendMessage(m);
} else if ( LunaChat.config.ngwordAction == NGWordAction.KICK ) {
@@ -248,8 +249,7 @@ public class Channel implements ConfigurationSerializable {
removeMember(player.getName());
String temp = PREINFO + NGWORD_PREFIX + MSG_KICKED;
String m = String.format(
Utility.replaceColorCode(temp), name);
String m = String.format(temp, name);
player.sendMessage(m);
}
}
@@ -427,10 +427,15 @@ public class Channel implements ConfigurationSerializable {
}
// 送信する
// TODO: 受信者が自分以外いない場合は、メッセージを表示する
for ( Player p : recipients ) {
p.sendMessage(message);
}
// 受信者が自分以外いない場合は、メッセージを表示する
if ( recipients.size() == 0 ||
(recipients.size() == 1 &&
recipients.get(0).getName().equals(player.getName()) ) ) {
player.sendMessage(MSG_NO_RECIPIENT);
}
// ロギング
log(message);
@@ -443,11 +448,10 @@ public class Channel implements ConfigurationSerializable {
protected ArrayList<String> getInfo() {
ArrayList<String> info = new ArrayList<String>();
info.add(Utility.replaceColorCode(INFO_FIRSTLINE));
info.add(INFO_FIRSTLINE);
info.add( String.format(
Utility.replaceColorCode(LIST_FORMAT),
name, getOnlineNum(), getTotalNum(), description) );
LIST_FORMAT, name, getOnlineNum(), getTotalNum(), description) );
if ( !isBroadcastChannel() ) {
// メンバーを、5人ごとに表示する
@@ -459,7 +463,7 @@ public class Channel implements ConfigurationSerializable {
info.add(buf.toString());
buf = new StringBuffer();
}
buf.append(Utility.replaceColorCode(INFO_PREFIX));
buf.append(INFO_PREFIX);
}
String name = members.get(i);
@@ -479,10 +483,10 @@ public class Channel implements ConfigurationSerializable {
} else {
info.add(Utility.replaceColorCode(INFO_GLOBAL));
info.add(INFO_GLOBAL);
}
info.add(Utility.replaceColorCode(LIST_ENDLINE));
info.add(LIST_ENDLINE);
return info;
}
+8 -10
ファイルの表示
@@ -32,6 +32,7 @@ public class ChannelManager implements LunaChatAPI {
private static final String LIST_FORMAT = Resources.get("listFormat");
private static final String MOTD_FIRSTLINE = Resources.get("motdFirstLine");
private static final String MSG_BREAKUP = Resources.get("breakupMessage");
private static final String FILE_NAME_DCHANNELS = "defaults.yml";
private static final String FILE_NAME_TEMPLATES = "templates.yml";
@@ -170,7 +171,7 @@ public class ChannelManager implements LunaChatAPI {
}
}
items.add(Utility.replaceColorCode(LIST_FIRSTLINE));
items.add(LIST_FIRSTLINE);
for ( String key : channels.keySet() ) {
Channel channel = channels.get(key);
@@ -196,11 +197,10 @@ public class ChannelManager implements LunaChatAPI {
int onlineNum = channel.getOnlineNum();
int memberNum = channel.getTotalNum();
String item = String.format(
Utility.replaceColorCode(LIST_FORMAT),
disp, onlineNum, memberNum, desc);
LIST_FORMAT, disp, onlineNum, memberNum, desc);
items.add(item);
}
items.add(Utility.replaceColorCode(LIST_ENDLINE));
items.add(LIST_ENDLINE);
return items;
}
@@ -219,7 +219,7 @@ public class ChannelManager implements LunaChatAPI {
dchannel = "";
}
items.add(Utility.replaceColorCode(MOTD_FIRSTLINE));
items.add(MOTD_FIRSTLINE);
for ( String key : channels.keySet() ) {
Channel channel = channels.get(key);
if ( !channel.getMembers().contains(playerName) &&
@@ -235,11 +235,10 @@ public class ChannelManager implements LunaChatAPI {
int onlineNum = channel.getOnlineNum();
int memberNum = channel.getTotalNum();
String item = String.format(
Utility.replaceColorCode(LIST_FORMAT),
disp, onlineNum, memberNum, desc);
LIST_FORMAT, disp, onlineNum, memberNum, desc);
items.add(item);
}
items.add(Utility.replaceColorCode(LIST_ENDLINE));
items.add(LIST_ENDLINE);
return items;
}
@@ -387,8 +386,7 @@ public class ChannelManager implements LunaChatAPI {
channels.remove(channelName);
// チャンネルのメンバーを強制解散させる
String message = String.format(Utility.replaceColorCode(
Resources.get("breakupMessage")), channelName);
String message = String.format(MSG_BREAKUP, channelName);
for ( String pname : channel.getMembers() ) {
Player player = LunaChat.getPlayerExact(pname);
if ( player != null ) {
+1 -2
ファイルの表示
@@ -1240,8 +1240,7 @@ public class LunaChatCommand implements CommandExecutor {
*/
private void sendResourceMessage(CommandSender sender, String pre,
String key, Object... args) {
String msg = String.format(
Utility.replaceColorCode(pre + Resources.get(key)), args);
String msg = String.format(pre + Resources.get(key), args);
sender.sendMessage(msg);
}
}
+2 -2
ファイルの表示
@@ -111,8 +111,8 @@ public class LunaChatConfig {
// globalチャンネルが、使用可能なチャンネル名かどうかを調べる
if ( !globalChannel.equals("") && !LunaChat.manager.checkForChannelName(globalChannel) ) {
String msg = String.format(Utility.replaceColorCode(
Resources.get("errmsgCannotUseForGlobal")), globalChannel);
String msg = String.format(
Resources.get("errmsgCannotUseForGlobal"), globalChannel);
LunaChat.instance.getLogger().warning(msg);
globalChannel = "";
}
+1 -9
ファイルの表示
@@ -95,13 +95,6 @@ public class LunaChatMessageCommand implements CommandExecutor {
channel.addMember(invitedName);
}
// デフォルトの発言先が異なる場合は、デフォルトの発言先にする
// Channel def = LunaChat.manager.getDefaultChannel(inviter.getName());
// if ( def == null || !cname.equals(def.getName()) ) {
// LunaChat.manager.setDefaultChannel(inviter.getName(), cname);
// sendResourceMessage(sender, PREINFO, "cmdmsgSet", cname);
// }
// メッセージがあるなら送信する
if ( message.trim().length() > 0 ) {
channel.chat(inviter, message);
@@ -133,8 +126,7 @@ public class LunaChatMessageCommand implements CommandExecutor {
*/
protected void sendResourceMessage(CommandSender sender, String pre,
String key, Object... args) {
String msg = String.format(
Utility.replaceColorCode(pre + Resources.get(key)), args);
String msg = String.format(pre + Resources.get(key), args);
sender.sendMessage(msg);
}
}
-16
ファイルの表示
@@ -48,22 +48,6 @@ public class LunaChatReplyCommand extends LunaChatMessageCommand {
sendTellMessage(inviter, invitedName, message.toString());
// LunaChat.privateMessageMap.remove(inviter.getName());
// // デフォルトの発言先が異なる場合は、デフォルトの発言先にする
// Channel def = LunaChat.manager.getDefaultChannel(invited.getName());
// String cname = inviterName + ">" + invited.getName();
// if ( def == null || !cname.equals(def.getName()) ) {
// LunaChat.manager.setDefaultChannel(invited.getName(), cname);
// sendResourceMessage(sender, PREINFO, "cmdmsgSet", cname);
// }
//
// // メッセージがあるなら送信する
// if ( message.toString().trim().length() > 0 ) {
// Channel channel = LunaChat.manager.getChannel(cname);
// channel.chat(invited, message.toString());
// }
return true;
}
}
+1 -1
ファイルの表示
@@ -55,7 +55,7 @@ public class Resources {
initialize();
}
String def = defaultMessages.getString(key, "");
return resources.getString(key, def);
return Utility.replaceColorCode(resources.getString(key, def));
}
/**