コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
42b63d1359 | ||
|
|
f647cfc90e | ||
|
|
046f865d15 | ||
|
|
098cc360dd | ||
|
|
cb03184c81 |
検索条件に一致するファイルはありません
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.ucchyocean</groupId>
|
||||
<artifactId>LunaChat</artifactId>
|
||||
<version>2.5.4</version>
|
||||
<version>2.5.6</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -72,12 +72,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.6.4-R2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.6.4-R2.0</version>
|
||||
<version>1.7.2-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
|
||||
@@ -59,6 +59,15 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
|
||||
channel.sendMessage(player, result, lineFormat);
|
||||
} else {
|
||||
Bukkit.broadcastMessage(result);
|
||||
|
||||
// 設定に応じてdynmapへ送信する
|
||||
if ( LunaChat.config.isSendBroadcastChannelChatToDynmap() &&
|
||||
LunaChat.dynmap != null ) {
|
||||
if ( player != null )
|
||||
LunaChat.dynmap.chat(player, result);
|
||||
else
|
||||
LunaChat.dynmap.broadcast(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ public class LunaChatConfig {
|
||||
/** サーバーに参加したユーザーに必ず参加させるチャンネル。<br/>
|
||||
* グローバルチャンネルとは別で指定できる。 */
|
||||
private List<String> forceJoinChannels;
|
||||
|
||||
/** formatコマンド実行時に、必ず含まれる必要があるキーワード。 */
|
||||
private List<String> formatConstraint;
|
||||
|
||||
/** ブロードキャストチャンネルの発言内容を、dynmapに送信するかどうか。<br/>
|
||||
* dynmapがロードされていない場合は、この設定は無視される(false扱い)。 */
|
||||
@@ -138,6 +141,14 @@ public class LunaChatConfig {
|
||||
} else {
|
||||
forceJoinChannels = new ArrayList<String>();
|
||||
}
|
||||
|
||||
if ( config.contains("formatConstraint") ) {
|
||||
formatConstraint = config.getStringList("formatConstraint");
|
||||
} else {
|
||||
formatConstraint = new ArrayList<String>();
|
||||
formatConstraint.add("%username");
|
||||
formatConstraint.add("%msg");
|
||||
}
|
||||
|
||||
sendBroadcastChannelChatToDynmap =
|
||||
config.getBoolean("sendBroadcastChannelChatToDynmap", true);
|
||||
@@ -249,6 +260,14 @@ public class LunaChatConfig {
|
||||
public List<String> getForceJoinChannels() {
|
||||
return forceJoinChannels;
|
||||
}
|
||||
|
||||
/**
|
||||
* formatコマンド実行時に、必ず含まれる必要があるキーワード。
|
||||
* @return formatConstraintを返す
|
||||
*/
|
||||
public List<String> getFormatConstraint() {
|
||||
return formatConstraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* NGワード
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
*/
|
||||
package com.github.ucchyocean.lc.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -116,6 +118,23 @@ public class FormatCommand extends SubCommandAbst {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 制約キーワードを確認する
|
||||
List<String> constraints = config.getFormatConstraint();
|
||||
String tempFormat = new String(format);
|
||||
for ( int i=0; i<=9; i++ ) {
|
||||
String key = "%" + i;
|
||||
if ( tempFormat.contains(key) && api.getTemplate(i + "") != null ) {
|
||||
tempFormat = tempFormat.replace(key, api.getTemplate("" + i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
for ( String constraint : constraints ) {
|
||||
if ( !tempFormat.contains(constraint) ) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgFormatConstraint", constraint);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// フォーマットの設定
|
||||
channel.setFormat(format);
|
||||
|
||||
@@ -92,9 +92,10 @@ public class HelpCommand extends SubCommandAbst {
|
||||
(args[1].equalsIgnoreCase("mod")
|
||||
|| args[1].equalsIgnoreCase("moderator") ) ) {
|
||||
type = CommandType.MODERATOR;
|
||||
} else if ( args.length >= 2
|
||||
&& args[1].equalsIgnoreCase("admin") ) {
|
||||
} else if ( args.length >= 2 && args[1].equalsIgnoreCase("admin") ) {
|
||||
type = CommandType.ADMIN;
|
||||
} else if ( args.length >= 2 && args[1].matches("[1-9]") ) {
|
||||
page = Integer.parseInt(args[1]);
|
||||
}
|
||||
|
||||
if ( args.length >= 3 && args[2].matches("[1-9]") ) {
|
||||
@@ -150,7 +151,11 @@ public class HelpCommand extends SubCommandAbst {
|
||||
}
|
||||
sendResourceMessage(sender, "", "usageFoot");
|
||||
if ( page < lastPage ) {
|
||||
sendResourceMessage(sender, "", "usageNoticeNextPage", typeDesc, (page + 1));
|
||||
if ( type != CommandType.USER ) {
|
||||
sendResourceMessage(sender, "", "usageNoticeNextPage", typeDesc, (page + 1));
|
||||
} else {
|
||||
sendResourceMessage(sender, "", "usageNoticeNextPage", "", (page + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,86 +149,118 @@ public class OptionCommand extends SubCommandAbst {
|
||||
|
||||
if ( options.containsKey("description") ) {
|
||||
// チャンネル説明文
|
||||
String desc = options.get("description");
|
||||
// チャンネル説明文は最大文字長を超えていないか確認
|
||||
if ( desc.length() > MAX_LENGTH_DESCRIPTION ) {
|
||||
|
||||
String pnode = PERMISSION_NODE + ".description";
|
||||
if ( !sender.hasPermission(pnode) ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgToolongDescription", MAX_LENGTH_DESCRIPTION);
|
||||
"errmsgNotPermission", pnode);
|
||||
} else {
|
||||
channel.setDescription(desc);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "description", desc);
|
||||
setOption = true;
|
||||
|
||||
String desc = options.get("description");
|
||||
// チャンネル説明文は最大文字長を超えていないか確認
|
||||
if ( desc.length() > MAX_LENGTH_DESCRIPTION ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgToolongDescription", MAX_LENGTH_DESCRIPTION);
|
||||
} else {
|
||||
channel.setDescription(desc);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "description", desc);
|
||||
setOption = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.containsKey("color") ) {
|
||||
// チャンネルカラー
|
||||
String code = options.get("color");
|
||||
if ( Utility.isValidColor(code) ) {
|
||||
code = Utility.changeToColorCode(code);
|
||||
}
|
||||
if ( Utility.isValidColorCode(code) ) {
|
||||
channel.setColorCode(code);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "color", options.get("color"));
|
||||
setOption = true;
|
||||
} else {
|
||||
|
||||
String pnode = PERMISSION_NODE + ".color";
|
||||
if ( !sender.hasPermission(pnode) ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgInvalidColorCode", options.get("color"));
|
||||
"errmsgNotPermission", pnode);
|
||||
} else {
|
||||
|
||||
String code = options.get("color");
|
||||
if ( Utility.isValidColor(code) ) {
|
||||
code = Utility.changeToColorCode(code);
|
||||
}
|
||||
if ( Utility.isValidColorCode(code) ) {
|
||||
channel.setColorCode(code);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "color", options.get("color"));
|
||||
setOption = true;
|
||||
} else {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgInvalidColorCode", options.get("color"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.containsKey("broadcast") ) {
|
||||
// ブロードキャストチャンネル
|
||||
String value = options.get("broadcast");
|
||||
|
||||
if ( value.equals("") || value.equalsIgnoreCase("false") ) {
|
||||
if ( channel.isGlobalChannel() ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgCannotOffGlobalBroadcast");
|
||||
} else {
|
||||
channel.setBroadcast(false);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "broadcast", "false");
|
||||
setOption = true;
|
||||
}
|
||||
} else if ( value.equalsIgnoreCase("true") ) {
|
||||
channel.setBroadcast(true);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "broadcast", "true");
|
||||
setOption = true;
|
||||
} else {
|
||||
|
||||
String pnode = PERMISSION_NODE + ".broadcast";
|
||||
if ( !sender.hasPermission(pnode) ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgInvalidBooleanOption", "broadcast");
|
||||
"errmsgNotPermission", pnode);
|
||||
} else {
|
||||
|
||||
String value = options.get("broadcast");
|
||||
|
||||
if ( value.equals("") || value.equalsIgnoreCase("false") ) {
|
||||
if ( channel.isGlobalChannel() ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgCannotOffGlobalBroadcast");
|
||||
} else {
|
||||
channel.setBroadcast(false);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "broadcast", "false");
|
||||
setOption = true;
|
||||
}
|
||||
} else if ( value.equalsIgnoreCase("true") ) {
|
||||
channel.setBroadcast(true);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "broadcast", "true");
|
||||
setOption = true;
|
||||
} else {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgInvalidBooleanOption", "broadcast");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.containsKey("range") ) {
|
||||
// レンジ
|
||||
String value = options.get("range");
|
||||
|
||||
if ( value.equals("") ) {
|
||||
channel.setWorldRange(false);
|
||||
channel.setRange(0);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "range", "無効");
|
||||
setOption = true;
|
||||
} else if ( value.equalsIgnoreCase("world") ) {
|
||||
channel.setWorldRange(true);
|
||||
channel.setRange(0);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "range", "world");
|
||||
setOption = true;
|
||||
} else if ( value.matches("[0-9]+") ) {
|
||||
channel.setWorldRange(true);
|
||||
channel.setRange(Integer.parseInt(value));
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "range", value);
|
||||
setOption = true;
|
||||
} else {
|
||||
|
||||
String pnode = PERMISSION_NODE + ".range";
|
||||
if ( !sender.hasPermission(pnode) ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgInvalidRangeOption");
|
||||
"errmsgNotPermission", pnode);
|
||||
} else {
|
||||
|
||||
String value = options.get("range");
|
||||
|
||||
if ( value.equals("") ) {
|
||||
channel.setWorldRange(false);
|
||||
channel.setRange(0);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "range", "無効");
|
||||
setOption = true;
|
||||
} else if ( value.equalsIgnoreCase("world") ) {
|
||||
channel.setWorldRange(true);
|
||||
channel.setRange(0);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "range", "world");
|
||||
setOption = true;
|
||||
} else if ( value.matches("[0-9]+") ) {
|
||||
channel.setWorldRange(true);
|
||||
channel.setRange(Integer.parseInt(value));
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "range", value);
|
||||
setOption = true;
|
||||
} else {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgInvalidRangeOption");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,32 +268,48 @@ public class OptionCommand extends SubCommandAbst {
|
||||
|
||||
if ( options.containsKey("password") ) {
|
||||
// パスワード
|
||||
String password = options.get("password");
|
||||
// パスワードが文字制限を超える場合はエラー
|
||||
if ( password.length() > MAX_LENGTH_PASSWORD ) {
|
||||
|
||||
String pnode = PERMISSION_NODE + ".password";
|
||||
if ( !sender.hasPermission(pnode) ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgToolongPassword", MAX_LENGTH_PASSWORD);
|
||||
"errmsgNotPermission", pnode);
|
||||
} else {
|
||||
channel.setPassword(password);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "password", password);
|
||||
setOption = true;
|
||||
|
||||
String password = options.get("password");
|
||||
// パスワードが文字制限を超える場合はエラー
|
||||
if ( password.length() > MAX_LENGTH_PASSWORD ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgToolongPassword", MAX_LENGTH_PASSWORD);
|
||||
} else {
|
||||
channel.setPassword(password);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "password", password);
|
||||
setOption = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( options.containsKey("visible") ) {
|
||||
// ビジブル
|
||||
String temp = options.get("visible");
|
||||
if ( temp.equalsIgnoreCase("false") ) {
|
||||
channel.setVisible(false);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "visible", "false");
|
||||
setOption = true;
|
||||
} else if ( temp.equalsIgnoreCase("true") ) {
|
||||
channel.setVisible(true);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "visible", "true");
|
||||
setOption = true;
|
||||
|
||||
String pnode = PERMISSION_NODE + ".visible";
|
||||
if ( !sender.hasPermission(pnode) ) {
|
||||
sendResourceMessage(sender, PREERR,
|
||||
"errmsgNotPermission", pnode);
|
||||
} else {
|
||||
|
||||
String temp = options.get("visible");
|
||||
if ( temp.equalsIgnoreCase("false") ) {
|
||||
channel.setVisible(false);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "visible", "false");
|
||||
setOption = true;
|
||||
} else if ( temp.equalsIgnoreCase("true") ) {
|
||||
channel.setVisible(true);
|
||||
sendResourceMessage(sender, PREINFO,
|
||||
"cmdmsgOption", "visible", "true");
|
||||
setOption = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# LunaChat v2.5.4
|
||||
# LunaChat v2.5.6
|
||||
# @author ucchy
|
||||
# @license LGPLv3
|
||||
# @copyright Copyright ucchy 2013
|
||||
@@ -41,6 +41,9 @@ globalChannel: ''
|
||||
# 複数のチャンネルを設定可能。例)forceJoinChannels: ['L', 'M', 'N']
|
||||
forceJoinChannels: []
|
||||
|
||||
# formatコマンド実行時に、必ず含まれる必要があるキーワード。
|
||||
formatConstraint: ['%username', '%msg']
|
||||
|
||||
|
||||
|
||||
# -------------------- dynmap連携設定 --------------------
|
||||
|
||||
@@ -107,6 +107,7 @@ errmsgToolongPassword: 'パスワードは %d 文字以下にしてください
|
||||
errmsgInvalidBooleanOption: '%s は true/false で指定してください。'
|
||||
errmsgInvalidRangeOption: 'range に正しくない値が指定されました。'
|
||||
errmsgCannotOffGlobalBroadcast: 'このチャンネルはグローバルチャンネルのため、ブロードキャストをオフにできません。'
|
||||
errmsgFormatConstraint: '必須キーワード %s が指定されていません。'
|
||||
|
||||
errmsgNotPermission: 'パーミッション "%s" が無いため、実行できません。'
|
||||
errmsgChannelChatDisabled: 'このサーバーでは、チャンネルチャットは動作しません。'
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
name: LunaChat
|
||||
main: com.github.ucchyocean.lc.LunaChat
|
||||
version: 2.5.4
|
||||
version: 2.5.6
|
||||
author: ucchy
|
||||
description: チャンネルチャットプラグイン
|
||||
softdepend: [Vault, dynmap]
|
||||
|
||||
commands:
|
||||
lunachat:
|
||||
description: lunachatのユーザーコマンド
|
||||
@@ -51,6 +52,7 @@ commands:
|
||||
/<command> (player) (on|off) - Turn on/off the Japanize conversion of other player's chat.
|
||||
permission: lunachat.japanize
|
||||
permission-message: You don't have the permission "<permission>".
|
||||
|
||||
permissions:
|
||||
lunachat.join:
|
||||
description: joinコマンドの使用権限
|
||||
@@ -147,6 +149,35 @@ permissions:
|
||||
lunachat.help: true
|
||||
lunachat.japanize: true
|
||||
description: 一般ユーザー向けの全コマンドの使用権限
|
||||
|
||||
lunachat.option.description:
|
||||
description: descriptionオプション設定コマンドの使用権限
|
||||
default: true
|
||||
lunachat.option.color:
|
||||
description: colorオプション設定コマンドの使用権限
|
||||
default: true
|
||||
lunachat.option.broadcast:
|
||||
description: broadcastオプション設定コマンドの使用権限
|
||||
default: op
|
||||
lunachat.option.range:
|
||||
description: rangeオプション設定コマンドの使用権限
|
||||
default: op
|
||||
lunachat.option.password:
|
||||
description: passwordオプション設定コマンドの使用権限
|
||||
default: true
|
||||
lunachat.option.visible:
|
||||
description: visibleオプション設定コマンドの使用権限
|
||||
default: true
|
||||
lunachat.option.*:
|
||||
children:
|
||||
lunachat.option.description: true
|
||||
lunachat.option.color: true
|
||||
lunachat.option.broadcast: true
|
||||
lunachat.option.range: true
|
||||
lunachat.option.password: true
|
||||
lunachat.option.visible: true
|
||||
description: オプション設定の全コマンドの使用権限
|
||||
|
||||
lunachat-admin.template:
|
||||
description: templateコマンドの使用権限
|
||||
default: op
|
||||
@@ -162,4 +193,3 @@ permissions:
|
||||
lunachat-admin.reload: true
|
||||
lunachat-admin.japanize-other: true
|
||||
description: 管理者向けの全コマンドの使用権限
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする