コミットを比較

...
6 コミット
19個のファイルの変更、226行の追加、31行の削除

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

+1
ファイルの表示
@@ -2,6 +2,7 @@ language: java
jdk:
- openjdk6
- oraclejdk7
- oraclejdk8
branches:
only:
- master
+1 -1
ファイルの表示
@@ -3,7 +3,7 @@ LunaChat
Build Status : [![Build Status](https://travis-ci.org/ucchyocean/LunaChat.svg?branch=master)](https://travis-ci.org/ucchyocean/LunaChat)
チャンネルチャットプラグイン for ShiroumiServer<br />
チャンネルチャットプラグイン<br />
<br />
ダウンロードはこちらから<br />
http://forum.minecraftuser.jp/viewtopic.php?f=38&t=13739<br />
+19
ファイルの表示
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dist</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<files>
<file>
<source>target/LunaChat.jar</source>
</file>
</files>
</assembly>
+20 -1
ファイルの表示
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.ucchyocean</groupId>
<artifactId>LunaChat</artifactId>
<version>2.6.6</version>
<version>2.6.7</version>
<description>チャンネルチャットプラグイン</description>
<licenses>
@@ -58,6 +58,25 @@
</links>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<finalName>${project.artifactId}-${project.version}</finalName>
<descriptors>
<descriptor>distribution.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
+13
ファイルの表示
@@ -86,6 +86,9 @@ public class LunaChatConfig {
/** 通常チャットの装飾フォーマット */
private String normalChatMessageFormat;
/** 通常チャットで、カラーコードを使用可能にするかどうか */
private boolean enableNormalChatColorCode;
/** Japanize変換のタイプ<br/>
* none = 日本語変換をしない<br/>
* kana = カナ変換のみする<br/>
@@ -188,6 +191,8 @@ public class LunaChatConfig {
config.getBoolean("enableNormalChatMessageFormat", true);
normalChatMessageFormat =
config.getString("normalChatMessageFormat", "&f<%prefix%username%suffix&f> %msg");
enableNormalChatColorCode =
config.getBoolean("enableNormalChatColorCode", true);
japanizeType = JapanizeType.fromID(config.getString("japanizeType", "kana"));
japanizeDisplayLine = config.getInt("japanizeDisplayLine", 2);
@@ -437,4 +442,12 @@ public class LunaChatConfig {
public int getJapanizeWait() {
return japanizeWait;
}
/**
* 通常チャットで、カラーコードを使用可能にするかどうか
* @return enableNormalChatColorCodeを返す
*/
public boolean isEnableNormalChatColorCode() {
return enableNormalChatColorCode;
}
}
+2 -4
ファイルの表示
@@ -10,7 +10,6 @@ import java.io.FileWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;
/**
@@ -48,8 +47,7 @@ public class LunaChatLogger {
checkDir();
// 以降の処理を、発言処理の負荷軽減のため、非同期実行にする。(see issue #40.)
Bukkit.getScheduler().runTaskAsynchronously(
LunaChat.getInstance(), new BukkitRunnable() {
new BukkitRunnable() {
@Override
public void run() {
@@ -72,7 +70,7 @@ public class LunaChatLogger {
}
}
});
}.runTaskAsynchronously(LunaChat.getInstance());
}
/**
+15 -11
ファイルの表示
@@ -8,7 +8,6 @@ package com.github.ucchyocean.lc;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -197,7 +196,12 @@ public class PlayerListener implements Listener {
}
// カラーコード置き換え
message = Utility.replaceColorCode(message);
// 置き換え設定になっていて、発言者がパーミッションを持っているなら、置き換えする
if ( config.isEnableNormalChatColorCode() &&
event.getPlayer().hasPermission("lunachat.allowcc") ) {
message = Utility.replaceColorCode(message);
}
// 一時的にJapanizeスキップ設定かどうかを確認する
boolean skipJapanize = false;
@@ -208,9 +212,10 @@ public class PlayerListener implements Listener {
}
// 2byteコードを含むなら、Japanize変換は行わない
String kanaTemp = Utility.stripColor(message);
if ( !skipJapanize &&
( message.getBytes().length > message.length() ||
message.matches("[ \\uFF61-\\uFF9F]+") ) ) {
( kanaTemp.getBytes().length > kanaTemp.length() ||
kanaTemp.matches("[ \\uFF61-\\uFF9F]+") ) ) {
skipJapanize = true;
}
@@ -220,29 +225,28 @@ public class PlayerListener implements Listener {
config.getJapanizeType() != JapanizeType.NONE ) {
int lineType = config.getJapanizeDisplayLine();
String taskFormat;
if ( lineType == 1 ) {
taskFormat = config.getJapanizeLine1Format();
String taskFormat = Utility.replaceColorCode(config.getJapanizeLine1Format());
String japanized = api.japanize(
message, config.getJapanizeType());
kanaTemp, config.getJapanizeType());
if ( japanized != null ) {
String temp = taskFormat.replace("%msg", message);
temp = temp.replace("%japanize", japanized);
message = Utility.replaceColorCode(temp);
message = temp.replace("%japanize", japanized);
}
} else {
taskFormat = config.getJapanizeLine2Format();
String taskFormat = Utility.replaceColorCode(config.getJapanizeLine2Format());
DelayedJapanizeConvertTask task = new DelayedJapanizeConvertTask(message,
config.getJapanizeType(), null, player, taskFormat, null);
// 発言処理を必ず先に実施させるため、遅延を入れてタスクを実行する。
int wait = config.getJapanizeWait();
Bukkit.getScheduler().runTaskLater(LunaChat.getInstance(), task, wait);
task.runTaskLater(LunaChat.getInstance(), wait);
}
}
+11 -2
ファイルの表示
@@ -114,12 +114,21 @@ public class Utility {
}
/**
* 文字列内のカラーコードを置き換えする
* 文字列内のカラーコード候補(&a)を、カラーコード(§a)に置き換えする
* @param source 置き換え元の文字列
* @return 置き換え後の文字列
*/
public static String replaceColorCode(String source) {
return source.replaceAll("&([0-9a-fk-or])", "\u00A7$1");
return ChatColor.translateAlternateColorCodes('&', source);
}
/**
* 文字列に含まれているカラーコード(§a)を除去して返す
* @param source 置き換え元の文字列
* @return 置き換え後の文字列
*/
public static String stripColor(String source) {
return ChatColor.stripColor(source);
}
/**
+23
ファイルの表示
@@ -51,6 +51,7 @@ public abstract class Channel implements ConfigurationSerializable {
private static final String KEY_RANGE = "range";
private static final String KEY_BAN_EXPIRES = "ban_expires";
private static final String KEY_MUTE_EXPIRES = "mute_expires";
private static final String KEY_ALLOWCC = "allowcc";
/** 参加者 */
private List<ChannelPlayer> members;
@@ -111,6 +112,9 @@ public abstract class Channel implements ConfigurationSerializable {
/** 1:1チャットの相手名 */
private String privateMessageTo;
/** カラーコードの使用可否 */
private boolean allowcc;
/**
* コンストラクタ
* @param name チャンネルの名称
@@ -133,6 +137,7 @@ public abstract class Channel implements ConfigurationSerializable {
this.banExpires = new HashMap<ChannelPlayer, Long>();
this.muteExpires = new HashMap<ChannelPlayer, Long>();
this.privateMessageTo = "";
this.allowcc = true;
LunaChatConfig config = LunaChat.getInstance().getLunaChatConfig();
if ( isPersonalChat() ) {
@@ -424,6 +429,7 @@ public abstract class Channel implements ConfigurationSerializable {
map.put(KEY_RANGE, chatRange);
map.put(KEY_BAN_EXPIRES, getStringLongMap(banExpires));
map.put(KEY_MUTE_EXPIRES, getStringLongMap(muteExpires));
map.put(KEY_ALLOWCC, allowcc);
return map;
}
@@ -456,6 +462,7 @@ public abstract class Channel implements ConfigurationSerializable {
channel.chatRange = castWithDefault(data.get(KEY_RANGE), 0);
channel.banExpires = castToChannelPlayerLongMap(data.get(KEY_BAN_EXPIRES));
channel.muteExpires = castToChannelPlayerLongMap(data.get(KEY_MUTE_EXPIRES));
channel.allowcc = castWithDefault(data.get(KEY_ALLOWCC), true);
return channel;
}
@@ -806,6 +813,22 @@ public abstract class Channel implements ConfigurationSerializable {
return chatRange;
}
/**
* カラーコードが使用可能な設定かどうか
* @return allowccを返す
*/
public boolean isAllowCC() {
return allowcc;
}
/**
* カラーコードの使用可否を設定する
* @param allowcc 使用可否
*/
public void setAllowCC(boolean allowcc) {
this.allowcc = allowcc;
}
/**
* チャンネルの情報をファイルに保存する。
* @return 保存をしたかどうか。
+13 -7
ファイルの表示
@@ -118,7 +118,10 @@ public class ChannelImpl extends Channel {
String msgFormat = replaceKeywords(getFormat(), player);
// カラーコード置き換え
maskedMessage = Utility.replaceColorCode(maskedMessage);
// チャンネルで許可されていて、発言者がパーミッションを持っている場合に置き換える
if ( isAllowCC() && player.hasPermission("lunachat.allowcc") ) {
maskedMessage = Utility.replaceColorCode(maskedMessage);
}
// イベントコール
LunaChatChannelChatEvent event =
@@ -132,9 +135,10 @@ public class ChannelImpl extends Channel {
maskedMessage = event.getNgMaskedMessage();
// 2byteコードを含むか、半角カタカナのみなら、Japanize変換は行わない
String kanaTemp = Utility.stripColor(maskedMessage);
if ( !skipJapanize &&
( message.getBytes().length > message.length() ||
message.matches("[ \\uFF61-\\uFF9F]+") ) ) {
( kanaTemp.getBytes().length > kanaTemp.length() ||
kanaTemp.matches("[ \\uFF61-\\uFF9F]+") ) ) {
skipJapanize = true;
}
@@ -150,11 +154,11 @@ public class ChannelImpl extends Channel {
String jpFormat;
String messageFormat = null;
if ( lineType == 1 ) {
jpFormat = config.getJapanizeLine1Format();
jpFormat = Utility.replaceColorCode(config.getJapanizeLine1Format());
messageFormat = msgFormat;
isIncludeSyncChat = false;
} else {
jpFormat = config.getJapanizeLine2Format();
jpFormat = Utility.replaceColorCode(config.getJapanizeLine2Format());
}
// タスクを作成しておく
@@ -245,8 +249,10 @@ public class ChannelImpl extends Channel {
msgFormat = msgFormat.replace("%prefix", "");
msgFormat = msgFormat.replace("%suffix", "");
// カラーコード置き換え
maskedMessage = Utility.replaceColorCode(maskedMessage);
// カラーコード置き換え チャンネルで許可されている場合に置き換える。
if ( isAllowCC() ) {
maskedMessage = Utility.replaceColorCode(maskedMessage);
}
// メッセージの送信
sendMessage(null, maskedMessage, msgFormat, false);
+7
ファイルの表示
@@ -66,6 +66,13 @@ public abstract class ChannelPlayer implements Comparable<ChannelPlayer> {
*/
public abstract String getWorldName();
/**
* 指定されたパーミッションノードの権限を持っているかどうかを取得する
* @param node パーミッションノード
* @return 権限を持っているかどうか
*/
public abstract boolean hasPermission(String node);
/**
* 指定されたCommandSenderと同一かどうかを返す
* @param sender
+11
ファイルの表示
@@ -105,6 +105,17 @@ public class ChannelPlayerBlock extends ChannelPlayer {
return "-";
}
/**
* 指定されたパーミッションノードの権限を持っているかどうかを取得する
* @param node パーミッションノード
* @return 権限を持っているかどうか
* @see com.github.ucchyocean.lc.channel.ChannelPlayer#hasPermission(java.lang.String)
*/
@Override
public boolean hasPermission(String node) {
return sender.hasPermission(node);
}
/**
* 指定されたCommandSenderと同一かどうかを返す
* @param sender
+11
ファイルの表示
@@ -105,6 +105,17 @@ public class ChannelPlayerConsole extends ChannelPlayer {
return "-";
}
/**
* 指定されたパーミッションノードの権限を持っているかどうかを取得する
* @param node パーミッションノード
* @return 権限を持っているかどうか
* @see com.github.ucchyocean.lc.channel.ChannelPlayer#hasPermission(java.lang.String)
*/
@Override
public boolean hasPermission(String node) {
return sender.hasPermission(node);
}
/**
* 指定されたCommandSenderと同一かどうかを返す
* @param sender
+16
ファイルの表示
@@ -136,6 +136,22 @@ public class ChannelPlayerName extends ChannelPlayer {
return "-";
}
/**
* 指定されたパーミッションノードの権限を持っているかどうかを取得する
* @param node パーミッションノード
* @return 権限を持っているかどうか
* @see com.github.ucchyocean.lc.channel.ChannelPlayer#hasPermission(java.lang.String)
*/
@Override
public boolean hasPermission(String node) {
Player player = getPlayer();
if ( player == null ) {
return false;
} else {
return player.hasPermission(node);
}
}
/**
* 指定されたCommandSenderと同一かどうかを返す
* @param sender
+16
ファイルの表示
@@ -186,6 +186,22 @@ public class ChannelPlayerUUID extends ChannelPlayer {
return "-";
}
/**
* 指定されたパーミッションノードの権限を持っているかどうかを取得する
* @param node パーミッションノード
* @return 権限を持っているかどうか
* @see com.github.ucchyocean.lc.channel.ChannelPlayer#hasPermission(java.lang.String)
*/
@Override
public boolean hasPermission(String node) {
Player player = getPlayer();
if ( player == null ) {
return false;
} else {
return player.hasPermission(node);
}
}
/**
* 指定されたCommandSenderと同一かどうかを返す
* @param sender
+2 -3
ファイルの表示
@@ -95,8 +95,8 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
}
}
// URL削除
String deletedURL = org.replaceAll(REGEX_URL, " ");
// カラーコード削除、URL削除
String deletedURL = Utility.stripColor(org.replaceAll(REGEX_URL, " "));
// キーワードをロック
int index = 0;
@@ -146,7 +146,6 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
// フォーマットする
result = format.replace("%msg", org);
result = result.replace("%japanize", japanized);
result = Utility.replaceColorCode(result);
return true;
}
+28
ファイルの表示
@@ -262,6 +262,34 @@ public class OptionCommand extends SubCommandAbst {
}
}
if ( options.containsKey("allowcc") ) {
// カラーコード使用可否
String pnode = PERMISSION_NODE + ".allowcc";
if ( !sender.hasPermission(pnode) ) {
sendResourceMessage(sender, PREERR,
"errmsgNotPermission", pnode);
} else {
String value = options.get("allowcc");
if ( value.equals("") || value.equalsIgnoreCase("false") ) {
channel.setAllowCC(false);
sendResourceMessage(sender, PREINFO,
"cmdmsgOption", "allowcc", "false");
setOption = true;
} else if ( value.equalsIgnoreCase("true") ) {
channel.setAllowCC(true);
sendResourceMessage(sender, PREINFO,
"cmdmsgOption", "allowcc", "true");
setOption = true;
} else {
sendResourceMessage(sender, PREERR,
"errmsgInvalidBooleanOption", "allowcc");
}
}
}
if ( !channel.isGlobalChannel() ) {
if ( options.containsKey("password") ) {
+9 -2
ファイルの表示
@@ -4,12 +4,12 @@
# @copyright Copyright ucchy 2013
# -------------------- チャンネルチャット設定 --------------------
# チャンネルチャット機能を利用可能にするかどうか
# Japanize機能のみを利用したい場合は、falseにしてください。
enableChannelChat: true
# -------------------- チャンネルチャット設定 --------------------
# チャンネルチャットに入っていない人の発言を、グローバルとして扱うかどうか
noJoinAsGlobal: true
@@ -105,11 +105,14 @@ ngword: []
# mute : NGワードをマスクしたのち、発言したプレイヤーをチャンネルからMuteする
# kick : NGワードをマスクしたのち、発言したプレイヤーをチャンネルからキックする
# ban : NGワードをマスクしたのち、発言したプレイヤーをチャンネルからBANする
# ※ 通常チャット(非チャンネルチャット)の場合は、
# kickやbanを設定しても、マスクのみが実行されます。
ngwordAction: mask
# -------------------- チャット装飾設定 --------------------
# チャンネルチャット機能を利用しないユーザーのための設定です。
# 通常チャット(非チャンネルチャット)の装飾を、LunaChatから行うかどうか。
@@ -125,6 +128,10 @@ enableNormalChatMessageFormat: true
# %msg : 発言内容(Japanize変換された場合は、Japanize結果を含みます。)
normalChatMessageFormat: '%prefix&f<%username>%suffix&f %msg'
# 通常チャット(非チャンネルチャット)で、カラーコード(&aや&bなど)を
# 使用可能にするかどうか。falseに設定すると、カラーコードは変換されません。
enableNormalChatColorCode: true
# -------------------- Japanize変換設定 --------------------
+8
ファイルの表示
@@ -127,6 +127,9 @@ permissions:
lunachat.japanize:
description: lunachatのjapanizeオンオフ設定コマンドの使用権限
default: true
lunachat.allowcc:
description: チャットにおけるカラーコードの使用権限
default: true
lunachat.*:
children:
lunachat.join: true
@@ -152,6 +155,7 @@ permissions:
lunachat.reply: true
lunachat.help: true
lunachat.japanize: true
lunachat.allowcc: true
description: 一般ユーザー向けの全コマンドの使用権限
lunachat.option.description:
@@ -172,6 +176,9 @@ permissions:
lunachat.option.visible:
description: visibleオプション設定コマンドの使用権限
default: true
lunachat.option.allowcc:
description: allowccオプション設定コマンドの使用権限
default: true
lunachat.option.*:
children:
lunachat.option.description: true
@@ -180,6 +187,7 @@ permissions:
lunachat.option.range: true
lunachat.option.password: true
lunachat.option.visible: true
lunachat.option.allowcc: true
description: オプション設定の全コマンドの使用権限
lunachat-admin.mod-all-channels: