コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
a981b1050a | ||
|
|
edbba82258 | ||
|
|
62311a0db0 | ||
|
|
75656e8e5c | ||
|
|
06a817ff35 | ||
|
|
c139bbd79c | ||
|
|
23da91109e | ||
|
|
df6e351bc9 | ||
|
|
f334b685a5 | ||
|
|
24390f3c95 | ||
|
|
38e3f436a1 | ||
|
|
0c4d9e48b6 | ||
|
|
9406baf743 | ||
|
|
0a1e41c11b | ||
|
|
8e804ca852 | ||
|
|
99732a8e3b | ||
|
|
14cfe86dc6 | ||
|
|
bc48258ce5 | ||
|
|
15ef0850ee | ||
|
|
52b8e1f684 | ||
|
|
16eb0ad1dd | ||
|
|
48f8841a67 | ||
|
|
bc892499b1 |
検索条件に一致するファイルはありません
+1
-1
@@ -4,4 +4,4 @@
|
||||
/target
|
||||
#IntelliJ
|
||||
.idea/
|
||||
*.iml
|
||||
*.iml
|
||||
+4
-2
@@ -1,7 +1,9 @@
|
||||
language: java
|
||||
jdk:
|
||||
- oraclejdk7
|
||||
- oraclejdk8
|
||||
- oraclejdk11
|
||||
- openjdk8
|
||||
- openjdk10
|
||||
- openjdk11
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
バイナリ
バイナリファイルは表示されません。
バイナリファイルは表示されません。
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.ucchyocean</groupId>
|
||||
<artifactId>LunaChat</artifactId>
|
||||
<version>2.8.7</version>
|
||||
<version>2.8.13</version>
|
||||
<description>A powerfull chat channel plugin with IME (Kana-Kanji conversion) support</description>
|
||||
|
||||
<licenses>
|
||||
@@ -21,7 +21,7 @@
|
||||
<repository>
|
||||
<id>internal.repo</id>
|
||||
<name>Temporary Staging Repository</name>
|
||||
<url>file://${basedir}/../mvn-repo</url>
|
||||
<url>file://${project.basedir}/../mvn-repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
@@ -38,25 +38,25 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<source>1.7</source>
|
||||
<encoding>UTF-8</encoding>
|
||||
<docencoding>UTF-8</docencoding>
|
||||
<charset>UTF-8</charset>
|
||||
<show>public</show>
|
||||
<nohelp>true</nohelp>
|
||||
<links>
|
||||
<link>http://docs.oracle.com/javase/6/docs/api/</link>
|
||||
<link>https://docs.oracle.com/javase/7/docs/api/</link>
|
||||
<link>https://hub.spigotmc.org/javadocs/bukkit/</link>
|
||||
</links>
|
||||
</configuration>
|
||||
@@ -64,7 +64,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<descriptors>
|
||||
@@ -74,9 +74,34 @@
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>deploy</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>assembly</goal>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.google.gson</pattern>
|
||||
<shadedPattern>com.github.ucchyocean.lc.lib.com.google.gson</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.apache.commons.lang3</pattern>
|
||||
<shadedPattern>com.github.ucchyocean.lc.lib.org.apache.commons.lang3</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
@@ -87,37 +112,27 @@
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<name>Spigot Maven Repository</name>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public</url>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<id>jitpack.io</id>
|
||||
<name>Vault Repository</name>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
||||
<url>https://jitpack.io/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>mikeprimm-repo</id>
|
||||
<name>Dynmap repository</name>
|
||||
<url>http://repo.mikeprimm.com/</url>
|
||||
<url>https://repo.mikeprimm.com/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>onarandombox-repo</id>
|
||||
<name>Multiverse repository</name>
|
||||
<url>http://repo.onarandombox.com/content/groups/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>minebuilders-repo</id>
|
||||
<name>HawkEye Reloaded repository</name>
|
||||
<url>http://minebuilders.me:8080/plugin/repository/everything</url>
|
||||
<url>http://repo.onarandombox.com/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>md5-repo</id>
|
||||
<name>MD5 repository</name>
|
||||
<url>http://repo.md-5.net/content/repositories/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>dhmc-rep</id>
|
||||
<name>Prism repository</name>
|
||||
<url>http://dhmc.us:8081/nexus/content/repositories/releases/</url>
|
||||
<url>https://repo.md-5.net/content/repositories/releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
@@ -125,25 +140,30 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.6</version>
|
||||
<version>1.7</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dynmap</groupId>
|
||||
<artifactId>dynmap-api</artifactId>
|
||||
<version>2.0</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>uk.co.oliwali</groupId>
|
||||
<artifactId>HawkEye</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<optional>true</optional>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/HawkEye.jar</systemPath>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.dthielke.herochat</groupId>
|
||||
@@ -154,20 +174,34 @@
|
||||
<dependency>
|
||||
<groupId>com.onarandombox.multiversecore</groupId>
|
||||
<artifactId>Multiverse-Core</artifactId>
|
||||
<version>2.5</version>
|
||||
<version>3.0.0</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.5.00</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.botsko</groupId>
|
||||
<artifactId>prism</artifactId>
|
||||
<version>2.0.6</version>
|
||||
<optional>true</optional>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/prism-2.0.6.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
@@ -251,7 +251,7 @@ public class LunaChatConfig {
|
||||
japanizeWait = config.getInt("japanizeWait", 1);
|
||||
|
||||
// globalチャンネルが、使用可能なチャンネル名かどうかを調べる
|
||||
if ( !globalChannel.equals("") &&
|
||||
if ( globalChannel != null && !globalChannel.equals("") &&
|
||||
!globalChannel.matches("[0-9a-zA-Z\\-_]{1,20}") ) {
|
||||
String msg = String.format(
|
||||
Resources.get("errmsgCannotUseForGlobal"), globalChannel);
|
||||
|
||||
@@ -65,7 +65,9 @@ public class LunaChatLogger {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
String msg = ChatColor.stripColor(message).replace(",", ",");
|
||||
String msg = ChatColor.stripColor(message);
|
||||
if ( msg == null ) msg = "";
|
||||
msg = msg.replace(",", ",");
|
||||
FileWriter writer = null;
|
||||
try {
|
||||
writer = new FileWriter(file, true);
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -151,7 +150,8 @@ public class PlayerListener implements Listener {
|
||||
|
||||
for ( Channel channel : LunaChat.getInstance().getLunaChatAPI().getChannels() ) {
|
||||
String cname = channel.getName();
|
||||
if ( channel.isPersonalChat() && cname.contains(player.getName()) ) {
|
||||
String pname = player.getName();
|
||||
if ( channel.isPersonalChat() && cname.contains(pname) ) {
|
||||
boolean isAllOffline = true;
|
||||
for ( ChannelPlayer cp : channel.getMembers() ) {
|
||||
if ( !cp.equals(player) && cp.isOnline() &&
|
||||
@@ -269,7 +269,7 @@ public class PlayerListener implements Listener {
|
||||
// LunaChatPreChatEvent イベントコール
|
||||
LunaChatPreChatEvent preChatEvent = new LunaChatPreChatEvent(
|
||||
global.getName(), player, event.getMessage());
|
||||
Bukkit.getPluginManager().callEvent(preChatEvent);
|
||||
Utility.callEventSync(preChatEvent);
|
||||
if ( preChatEvent.isCancelled() ) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@@ -556,7 +556,7 @@ public class PlayerListener implements Listener {
|
||||
// LunaChatPreChatEvent イベントコール
|
||||
LunaChatPreChatEvent preChatEvent = new LunaChatPreChatEvent(
|
||||
channel.getName(), player, message);
|
||||
Bukkit.getPluginManager().callEvent(preChatEvent);
|
||||
Utility.callEventSync(preChatEvent);
|
||||
if ( preChatEvent.isCancelled() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -66,12 +66,12 @@ public class Resources {
|
||||
|
||||
YamlConfiguration messages = new YamlConfiguration();
|
||||
JarFile jarFile = null;
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
jarFile = new JarFile(LunaChat.getPluginJarFile());
|
||||
ZipEntry zipEntry = jarFile.getEntry(FILE_NAME);
|
||||
InputStream inputStream = jarFile.getInputStream(zipEntry);
|
||||
BufferedReader reader =
|
||||
new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
|
||||
reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
|
||||
String line;
|
||||
while ( (line = reader.readLine()) != null ) {
|
||||
if ( line.contains(":") && !line.startsWith("#") ) {
|
||||
@@ -85,6 +85,13 @@ public class Resources {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if ( reader != null ) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
// do nothing.
|
||||
}
|
||||
}
|
||||
if ( jarFile != null ) {
|
||||
try {
|
||||
jarFile.close();
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
/**
|
||||
* ユーティリティクラス
|
||||
@@ -44,6 +45,7 @@ public class Utility {
|
||||
public static void copyFileFromJar(
|
||||
File jarFile, File targetFile, String sourceFilePath, boolean isBinary) {
|
||||
|
||||
JarFile jar = null;
|
||||
InputStream is = null;
|
||||
FileOutputStream fos = null;
|
||||
BufferedReader reader = null;
|
||||
@@ -55,7 +57,7 @@ public class Utility {
|
||||
}
|
||||
|
||||
try {
|
||||
JarFile jar = new JarFile(jarFile);
|
||||
jar = new JarFile(jarFile);
|
||||
ZipEntry zipEntry = jar.getEntry(sourceFilePath);
|
||||
is = jar.getInputStream(zipEntry);
|
||||
|
||||
@@ -91,6 +93,13 @@ public class Utility {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (jar != null) {
|
||||
try {
|
||||
jar.close();
|
||||
} catch (IOException e) {
|
||||
// do nothing.
|
||||
}
|
||||
}
|
||||
if (writer != null) {
|
||||
try {
|
||||
writer.flush();
|
||||
@@ -339,4 +348,21 @@ public class Utility {
|
||||
public static Player getPlayerExact(String name) {
|
||||
return Bukkit.getPlayer(stripColor(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* イベントを同期処理で呼び出します
|
||||
*
|
||||
* @param event 対象のイベント
|
||||
* @return タスクのID (登録に失敗した場合は-1)
|
||||
* @since 2.8.10
|
||||
*/
|
||||
public static int callEventSync(final Event event) {
|
||||
return Bukkit.getScheduler().scheduleSyncDelayedTask(LunaChat.getInstance(), new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||
@@ -239,7 +238,7 @@ public abstract class Channel implements ConfigurationSerializable {
|
||||
// イベントコール
|
||||
LunaChatChannelMemberChangedEvent event =
|
||||
new LunaChatChannelMemberChangedEvent(this.name, this.members, after);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
Utility.callEventSync(event);
|
||||
if ( event.isCancelled() ) {
|
||||
return;
|
||||
}
|
||||
@@ -273,7 +272,7 @@ public abstract class Channel implements ConfigurationSerializable {
|
||||
// イベントコール
|
||||
LunaChatChannelMemberChangedEvent event =
|
||||
new LunaChatChannelMemberChangedEvent(this.name, this.members, after);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
Utility.callEventSync(event);
|
||||
if ( event.isCancelled() ) {
|
||||
return;
|
||||
}
|
||||
@@ -963,6 +962,7 @@ public abstract class Channel implements ConfigurationSerializable {
|
||||
return name.endsWith(".yml");
|
||||
}
|
||||
});
|
||||
if ( files == null ) files = new File[0];
|
||||
|
||||
HashMap<String, Channel> result = new HashMap<String, Channel>();
|
||||
for ( File file : files ) {
|
||||
|
||||
@@ -148,7 +148,7 @@ public class ChannelImpl extends Channel {
|
||||
LunaChatChannelChatEvent event =
|
||||
new LunaChatChannelChatEvent(getName(), player,
|
||||
preReplaceMessage, maskedMessage, msgFormat);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
Utility.callEventSync(event);
|
||||
if ( event.isCancelled() ) {
|
||||
return;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ public class ChannelImpl extends Channel {
|
||||
}
|
||||
|
||||
// NGワード発言者に、NGワードアクションを実行する
|
||||
if ( isNG && player != null ) {
|
||||
if ( isNG ) {
|
||||
if ( config.getNgwordAction() == NGWordAction.BAN ) {
|
||||
// BANする
|
||||
|
||||
@@ -414,7 +414,7 @@ public class ChannelImpl extends Channel {
|
||||
LunaChatChannelMessageEvent event =
|
||||
new LunaChatChannelMessageEvent(
|
||||
getName(), player, message, recipients, name, originalMessage);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
Utility.callEventSync(event);
|
||||
message = event.getMessage();
|
||||
recipients = event.getRecipients();
|
||||
|
||||
@@ -766,7 +766,7 @@ public class ChannelImpl extends Channel {
|
||||
|
||||
// Prism のチャットログへ記録
|
||||
if ( config.isLoggingChatToPrism() && LunaChat.getInstance().getPrism() != null
|
||||
&& player.getPlayer() != null ) {
|
||||
&& player != null && player.getPlayer() != null ) {
|
||||
LunaChat.getInstance().getPrism().writeLog(player.getPlayer(),
|
||||
"channel(" + getName() + ")-" + Utility.stripColor(message));
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.github.ucchyocean.lc.LunaChat;
|
||||
import com.github.ucchyocean.lc.LunaChatAPI;
|
||||
import com.github.ucchyocean.lc.Resources;
|
||||
import com.github.ucchyocean.lc.Utility;
|
||||
import com.github.ucchyocean.lc.event.LunaChatChannelCreateEvent;
|
||||
import com.github.ucchyocean.lc.event.LunaChatChannelRemoveEvent;
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
@@ -80,7 +80,10 @@ public class ChannelManager implements LunaChatAPI {
|
||||
|
||||
defaultChannels = new HashMap<String, String>();
|
||||
for ( String key : config.getKeys(false) ) {
|
||||
defaultChannels.put(key, config.getString(key).toLowerCase());
|
||||
String value = config.getString(key);
|
||||
if ( value != null) {
|
||||
defaultChannels.put(key, value.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
// テンプレート設定のロード
|
||||
@@ -438,7 +441,7 @@ public class ChannelManager implements LunaChatAPI {
|
||||
// イベントコール
|
||||
LunaChatChannelCreateEvent event =
|
||||
new LunaChatChannelCreateEvent(channelName, sender);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
Utility.callEventSync(event);
|
||||
if ( event.isCancelled() ) {
|
||||
return null;
|
||||
}
|
||||
@@ -475,7 +478,7 @@ public class ChannelManager implements LunaChatAPI {
|
||||
// イベントコール
|
||||
LunaChatChannelRemoveEvent event =
|
||||
new LunaChatChannelRemoveEvent(channelName, sender);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
Utility.callEventSync(event);
|
||||
if ( event.isCancelled() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.HashMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@@ -19,7 +18,7 @@ import com.github.ucchyocean.lc.Utility;
|
||||
import com.github.ucchyocean.lc.event.LunaChatPostJapanizeEvent;
|
||||
import com.github.ucchyocean.lc.japanize.IMEConverter;
|
||||
import com.github.ucchyocean.lc.japanize.JapanizeType;
|
||||
import com.github.ucchyocean.lc.japanize.KanaConverter;
|
||||
import com.github.ucchyocean.lc.japanize.YukiKanaConverter;
|
||||
|
||||
/**
|
||||
* Japanize変換を実行して、実行後に発言を行うタスク
|
||||
@@ -99,7 +98,7 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
|
||||
}
|
||||
|
||||
// カナ変換
|
||||
String japanized = KanaConverter.conv(keywordLocked);
|
||||
String japanized = YukiKanaConverter.conv(keywordLocked);
|
||||
|
||||
// IME変換
|
||||
if ( type == JapanizeType.GOOGLE_IME ) {
|
||||
@@ -125,7 +124,7 @@ public class DelayedJapanizeConvertTask extends BukkitRunnable {
|
||||
String channelName = (channel == null) ? "" : channel.getName();
|
||||
LunaChatPostJapanizeEvent event =
|
||||
new LunaChatPostJapanizeEvent(channelName, player, org, japanized);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
Utility.callEventSync(event);
|
||||
if ( event.isCancelled() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -77,12 +77,6 @@ public class BanCommand extends SubCommandAbst {
|
||||
public boolean runCommand(
|
||||
CommandSender sender, String label, String[] args) {
|
||||
|
||||
// プレイヤーでなければ終了する
|
||||
if (!(sender instanceof Player)) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgIngame");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 実行引数から、BANするユーザーを取得する
|
||||
String kickedName = "";
|
||||
if (args.length >= 2) {
|
||||
@@ -92,9 +86,16 @@ public class BanCommand extends SubCommandAbst {
|
||||
return true;
|
||||
}
|
||||
|
||||
// デフォルト参加チャンネルを取得、取得できない場合はエラー表示して終了する
|
||||
Player kicker = (Player) sender;
|
||||
Channel channel = api.getDefaultChannel(kicker.getName());
|
||||
// 対象チャンネルを取得、取得できない場合はエラー表示して終了する
|
||||
Channel channel = null;
|
||||
boolean isSpecifiedChannel = false;
|
||||
if (args.length >= 3) {
|
||||
channel = api.getChannel(args[2]);
|
||||
isSpecifiedChannel = true;
|
||||
} else if (sender instanceof Player) {
|
||||
Player kicker = (Player) sender;
|
||||
channel = api.getDefaultChannel(kicker.getName());
|
||||
}
|
||||
if (channel == null) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgNoJoin");
|
||||
return true;
|
||||
@@ -127,7 +128,7 @@ public class BanCommand extends SubCommandAbst {
|
||||
|
||||
// 期限付きBANの場合、期限の指定が正しいかどうかをチェックする
|
||||
int expireMinutes = -1;
|
||||
if (args.length >= 3) {
|
||||
if (args.length >= 3 && !isSpecifiedChannel) {
|
||||
if ( !args[2].matches("[0-9]+") ) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgInvalidBanExpireParameter");
|
||||
return true;
|
||||
|
||||
@@ -97,30 +97,43 @@ public class HideCommand extends SubCommandAbst {
|
||||
|
||||
// 引数チェック
|
||||
String cname = null;
|
||||
boolean isPlayerCommand = false;
|
||||
boolean isChannelCommand = false;
|
||||
if ( args.length <= 1 ) {
|
||||
Channel def = api.getDefaultChannel(player.getName());
|
||||
if ( def != null ) {
|
||||
cname = def.getName();
|
||||
}
|
||||
} else if ( args.length >= 2 ) {
|
||||
cname = args[1];
|
||||
} else {
|
||||
sendResourceMessage(sender, PREERR, "errmsgCommand");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 指定されたコマンドが「/ch hide list」なら、リストを表示して終了
|
||||
if ( cname != null && cname.equals("list") ) {
|
||||
for ( String item : getHideInfoList(player) ) {
|
||||
player.sendMessage(item);
|
||||
if ( args[1].equals("list") ) {
|
||||
// 指定されたコマンドが「/ch hide list」なら、リストを表示して終了
|
||||
for ( String item : getHideInfoList(player) ) {
|
||||
player.sendMessage(item);
|
||||
}
|
||||
return true;
|
||||
|
||||
} else if ( args.length >= 3 && args[1].equalsIgnoreCase("player") ) {
|
||||
// 指定されたコマンドが「/ch hide player (player名)」なら、対象をプレイヤーとする。
|
||||
isPlayerCommand = true;
|
||||
isChannelCommand = false;
|
||||
cname = args[2];
|
||||
|
||||
} else if ( args.length >= 3 && args[1].equalsIgnoreCase("channel") ) {
|
||||
// 指定されたコマンドが「/ch hide channel (channel名)」なら、対象をチャンネルとする。
|
||||
isPlayerCommand = false;
|
||||
isChannelCommand = true;
|
||||
cname = args[2];
|
||||
|
||||
} else {
|
||||
// 「/ch hide (player名 または channel名)」
|
||||
cname = args[1];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// チャンネルかプレイヤーが存在するかどうかをチェックする
|
||||
boolean isChannelCommand = false;
|
||||
Channel channel = api.getChannel(cname);
|
||||
if ( channel != null ) {
|
||||
if ( !isPlayerCommand && channel != null ) {
|
||||
isChannelCommand = true;
|
||||
} else if ( Utility.getOfflinePlayer(cname) == null ) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgNotExistChannelAndPlayer");
|
||||
@@ -209,4 +222,4 @@ public class HideCommand extends SubCommandAbst {
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -233,6 +233,11 @@ public class JoinCommand extends SubCommandAbst {
|
||||
sendResourceMessage(sender, PREINFO, "cmdmsgSet", channelName);
|
||||
}
|
||||
|
||||
// チャンネル説明文があるなら、説明文を表示する
|
||||
if ( !channel.getDescription().trim().equals("") ) {
|
||||
sendResourceMessage(sender, PREINFO, "cmdmsgSetTopic", channel.getDescription().trim());
|
||||
}
|
||||
|
||||
// 非表示に設定しているなら、注意を流す
|
||||
if ( channel.getHided().contains(player) ) {
|
||||
sendResourceMessage(sender, PREINFO, "cmdmsgSetHide");
|
||||
|
||||
@@ -75,12 +75,6 @@ public class KickCommand extends SubCommandAbst {
|
||||
public boolean runCommand(
|
||||
CommandSender sender, String label, String[] args) {
|
||||
|
||||
// プレイヤーでなければ終了する
|
||||
if (!(sender instanceof Player)) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgIngame");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 実行引数から、キックするユーザーを取得する
|
||||
String kickedName = "";
|
||||
if (args.length >= 2) {
|
||||
@@ -90,9 +84,14 @@ public class KickCommand extends SubCommandAbst {
|
||||
return true;
|
||||
}
|
||||
|
||||
// デフォルト参加チャンネルを取得、取得できない場合はエラー表示して終了する
|
||||
Player kicker = (Player) sender;
|
||||
Channel channel = api.getDefaultChannel(kicker.getName());
|
||||
// 対象チャンネルを取得、取得できない場合はエラー表示して終了する
|
||||
Channel channel = null;
|
||||
if (args.length >= 3) {
|
||||
channel = api.getChannel(args[2]);
|
||||
} else if (sender instanceof Player) {
|
||||
Player kicker = (Player) sender;
|
||||
channel = api.getDefaultChannel(kicker.getName());
|
||||
}
|
||||
if (channel == null) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgNoJoin");
|
||||
return true;
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
package com.github.ucchyocean.lc.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -22,6 +24,7 @@ import com.github.ucchyocean.lc.channel.ChannelPlayer;
|
||||
public class ListCommand extends SubCommandAbst {
|
||||
|
||||
private static final String LIST_FIRSTLINE = Resources.get("listFirstLine");
|
||||
private static final String LIST_FIRSTLINE_PAGING = Resources.get("listFirstLinePaging");
|
||||
private static final String LIST_ENDLINE = Resources.get("listEndLine");
|
||||
private static final String LIST_FORMAT = Resources.get("listFormat");
|
||||
|
||||
@@ -29,6 +32,8 @@ public class ListCommand extends SubCommandAbst {
|
||||
private static final String PERMISSION_NODE = "lunachat." + COMMAND_NAME;
|
||||
private static final String USAGE_KEY = "usageList";
|
||||
|
||||
private static final int PAGE_SIZE = 8;
|
||||
|
||||
/**
|
||||
* コマンドを取得します。
|
||||
* @return コマンド
|
||||
@@ -88,8 +93,13 @@ public class ListCommand extends SubCommandAbst {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
int page = 0;
|
||||
if ( args.length >= 2 && args[1].matches("[0-9]") ) {
|
||||
page = Integer.parseInt(args[1]);
|
||||
}
|
||||
|
||||
// リストを取得して表示する
|
||||
ArrayList<String> list = getList(player);
|
||||
ArrayList<String> list = getList(player, page);
|
||||
for (String msg : list) {
|
||||
sender.sendMessage(msg);
|
||||
}
|
||||
@@ -99,9 +109,39 @@ public class ListCommand extends SubCommandAbst {
|
||||
/**
|
||||
* リスト表示用のリストを返す
|
||||
* @param player プレイヤー、指定しない場合はnullにする
|
||||
* @param page 表示するページ、0を指定した場合は全表示
|
||||
* @return リスト
|
||||
*/
|
||||
private ArrayList<String> getList(Player player) {
|
||||
private ArrayList<String> getList(Player player, int page) {
|
||||
|
||||
ArrayList<String> list = getPlayerList(player);
|
||||
int size = list.size();
|
||||
int maxPage = (int)(size / PAGE_SIZE) + 1;
|
||||
|
||||
if ( page < 0 ) page = 0;
|
||||
if ( page > maxPage ) page = maxPage;
|
||||
|
||||
ArrayList<String> items = new ArrayList<>();
|
||||
if ( page == 0 ) { // 全表示
|
||||
items.add(LIST_FIRSTLINE);
|
||||
items.addAll(list);
|
||||
items.add(LIST_ENDLINE);
|
||||
} else { // ページ表示
|
||||
items.add(String.format(LIST_FIRSTLINE_PAGING, page, maxPage));
|
||||
int endIndex = (page * PAGE_SIZE > size) ? size : page * PAGE_SIZE;
|
||||
items.addAll(list.subList((page - 1) * PAGE_SIZE, endIndex));
|
||||
items.add(LIST_ENDLINE);
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定されたプレイヤーに対するチャンネルリストを返す
|
||||
* @param player プレイヤー
|
||||
* @return チャンネルリスト
|
||||
*/
|
||||
private ArrayList<String> getPlayerList(Player player) {
|
||||
|
||||
ArrayList<String> items = new ArrayList<String>();
|
||||
String dchannel = "";
|
||||
@@ -117,8 +157,16 @@ public class ListCommand extends SubCommandAbst {
|
||||
}
|
||||
ChannelPlayer cp = ChannelPlayer.getChannelPlayer(player);
|
||||
|
||||
items.add(LIST_FIRSTLINE);
|
||||
for ( Channel channel : api.getChannels() ) {
|
||||
// チャンネルを取得して、チャンネル名でソートする
|
||||
ArrayList<Channel> channels = new ArrayList<>(api.getChannels());
|
||||
Collections.sort(channels, new Comparator<Channel>() {
|
||||
public int compare(Channel c1, Channel c2) {
|
||||
return c1.getName().compareTo(c2.getName());
|
||||
}
|
||||
});
|
||||
|
||||
// 指定されたプレイヤー名に合うように、フィルタ&表示用整形する。
|
||||
for ( Channel channel : channels ) {
|
||||
|
||||
// BANされているチャンネルは表示しない
|
||||
if ( channel.getBanned().contains(cp) ) {
|
||||
@@ -155,7 +203,6 @@ public class ListCommand extends SubCommandAbst {
|
||||
LIST_FORMAT, disp, onlineNum, memberNum, desc);
|
||||
items.add(item);
|
||||
}
|
||||
items.add(LIST_ENDLINE);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public class LunaChatCommand implements CommandExecutor {
|
||||
commands.add(new OptionCommand());
|
||||
commands.add(new TemplateCommand());
|
||||
commands.add(new CheckCommand());
|
||||
commands.add(new SetCommand());
|
||||
helpCommand = new HelpCommand(commands);
|
||||
commands.add(helpCommand);
|
||||
|
||||
@@ -157,6 +158,12 @@ public class LunaChatCommand implements CommandExecutor {
|
||||
coms.add(c.getCommandName());
|
||||
}
|
||||
}
|
||||
for ( SubCommandAbst c : commonCommands ) {
|
||||
if ( c.getCommandName().startsWith(arg) &&
|
||||
sender.hasPermission(c.getPermissionNode()) ) {
|
||||
coms.add(c.getCommandName());
|
||||
}
|
||||
}
|
||||
return coms;
|
||||
|
||||
} else if ( args.length == 2 && (
|
||||
@@ -172,10 +179,46 @@ public class LunaChatCommand implements CommandExecutor {
|
||||
}
|
||||
return items;
|
||||
|
||||
} else if ( args.length == 2 && (
|
||||
args[0].equalsIgnoreCase("ban") ||
|
||||
args[0].equalsIgnoreCase("pardon") ||
|
||||
args[0].equalsIgnoreCase("kick") ||
|
||||
args[0].equalsIgnoreCase("mute") ||
|
||||
args[0].equalsIgnoreCase("unmute") ) ) {
|
||||
// プレイヤー名で補完する
|
||||
String arg = args[1].toLowerCase();
|
||||
ArrayList<String> items = new ArrayList<String>();
|
||||
for ( Player player : Utility.getOnlinePlayers() ) {
|
||||
String pname = player.getName();
|
||||
pname = pname == null ? "" : pname.toLowerCase();
|
||||
if ( pname.startsWith(arg) ) {
|
||||
items.add(player.getName());
|
||||
}
|
||||
}
|
||||
return items;
|
||||
|
||||
} else if ( args.length == 3 && (
|
||||
args[0].equalsIgnoreCase("ban") ||
|
||||
args[0].equalsIgnoreCase("pardon") ||
|
||||
args[0].equalsIgnoreCase("kick") ||
|
||||
args[0].equalsIgnoreCase("mute") ||
|
||||
args[0].equalsIgnoreCase("unmute") ) ) {
|
||||
// チャンネル名で補完する
|
||||
String arg = args[2].toLowerCase();
|
||||
ArrayList<String> items = new ArrayList<String>();
|
||||
for ( String name : getListCanJoin(sender) ) {
|
||||
if ( name.toLowerCase().startsWith(arg) ) {
|
||||
items.add(name);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
|
||||
} else if ( args.length == 2 && (
|
||||
args[0].equalsIgnoreCase("hide") ||
|
||||
args[0].equalsIgnoreCase("unhide") ) ) {
|
||||
// 参加可能チャンネル名とプレイヤー名で補完する
|
||||
|
||||
// 参加可能チャンネル名とプレイヤー名と
|
||||
// 文字列"player", "channel"で補完する
|
||||
String arg = args[1].toLowerCase();
|
||||
ArrayList<String> items = new ArrayList<String>();
|
||||
for ( String name : getListCanJoin(sender) ) {
|
||||
@@ -184,10 +227,50 @@ public class LunaChatCommand implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
for ( Player player : Utility.getOnlinePlayers() ) {
|
||||
if ( player.getName().toLowerCase().startsWith(arg) ) {
|
||||
String pname = player.getName();
|
||||
pname = pname == null ? "" : pname.toLowerCase();
|
||||
if ( pname.startsWith(arg) ) {
|
||||
items.add(player.getName());
|
||||
}
|
||||
}
|
||||
if ( "player".startsWith(arg) ) {
|
||||
items.add("player");
|
||||
}
|
||||
if ( "channel".startsWith(arg) ) {
|
||||
items.add("channel");
|
||||
}
|
||||
return items;
|
||||
|
||||
} else if ( args.length == 3 &&
|
||||
(args[0].equalsIgnoreCase("hide") ||
|
||||
args[0].equalsIgnoreCase("unhide") ) &&
|
||||
args[1].equalsIgnoreCase("player") ) {
|
||||
|
||||
// プレイヤー名で補完する
|
||||
String arg = args[2].toLowerCase();
|
||||
ArrayList<String> items = new ArrayList<String>();
|
||||
for ( Player player : Utility.getOnlinePlayers() ) {
|
||||
String pname = player.getName();
|
||||
pname = pname == null ? "" : pname.toLowerCase();
|
||||
if ( pname.startsWith(arg) ) {
|
||||
items.add(player.getName());
|
||||
}
|
||||
}
|
||||
return items;
|
||||
|
||||
} else if ( args.length == 3 &&
|
||||
(args[0].equalsIgnoreCase("hide") ||
|
||||
args[0].equalsIgnoreCase("unhide") ) &&
|
||||
args[1].equalsIgnoreCase("channel") ) {
|
||||
|
||||
// チャンネル名で補完する
|
||||
String arg = args[2].toLowerCase();
|
||||
ArrayList<String> items = new ArrayList<String>();
|
||||
for ( String name : getListCanJoin(sender) ) {
|
||||
if ( name.toLowerCase().startsWith(arg) ) {
|
||||
items.add(name);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
|
||||
} else if ( args.length == 2 && args[0].equalsIgnoreCase("remove") ) {
|
||||
@@ -227,6 +310,42 @@ public class LunaChatCommand implements CommandExecutor {
|
||||
}
|
||||
return items;
|
||||
|
||||
} else if ( args.length == 2 &&
|
||||
args[0].equalsIgnoreCase("set") ) {
|
||||
// "default" で補完する
|
||||
String arg = args[1].toLowerCase();
|
||||
ArrayList<String> items = new ArrayList<String>();
|
||||
if ( "default".startsWith(arg) ) {
|
||||
items.add("default");
|
||||
}
|
||||
return items;
|
||||
|
||||
} else if ( args.length == 3 &&
|
||||
args[0].equalsIgnoreCase("set") && args[1].equalsIgnoreCase("default") ) {
|
||||
// プレイヤー名で補完する
|
||||
String arg = args[2].toLowerCase();
|
||||
ArrayList<String> items = new ArrayList<String>();
|
||||
for ( Player player : Utility.getOnlinePlayers() ) {
|
||||
String pname = player.getName();
|
||||
pname = pname == null ? "" : pname.toLowerCase();
|
||||
if ( pname.startsWith(arg) ) {
|
||||
items.add(player.getName());
|
||||
}
|
||||
}
|
||||
return items;
|
||||
|
||||
} else if ( args.length == 4 &&
|
||||
args[0].equalsIgnoreCase("set") && args[1].equalsIgnoreCase("default") ) {
|
||||
// チャンネル名で補完する
|
||||
String arg = args[3].toLowerCase();
|
||||
ArrayList<String> items = new ArrayList<String>();
|
||||
for ( String name : getListCanJoin(sender) ) {
|
||||
if ( name.toLowerCase().startsWith(arg) ) {
|
||||
items.add(name);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -77,12 +77,6 @@ public class MuteCommand extends SubCommandAbst {
|
||||
public boolean runCommand(
|
||||
CommandSender sender, String label, String[] args) {
|
||||
|
||||
// プレイヤーでなければ終了する
|
||||
if (!(sender instanceof Player)) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgIngame");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 実行引数から、Muteするユーザーを取得する
|
||||
String kickedName = "";
|
||||
if (args.length >= 2) {
|
||||
@@ -92,9 +86,16 @@ public class MuteCommand extends SubCommandAbst {
|
||||
return true;
|
||||
}
|
||||
|
||||
// デフォルト参加チャンネルを取得、取得できない場合はエラー表示して終了する
|
||||
Player kicker = (Player) sender;
|
||||
Channel channel = api.getDefaultChannel(kicker.getName());
|
||||
// 対象チャンネルを取得、取得できない場合はエラー表示して終了する
|
||||
boolean isSpecifiedChannel = false;
|
||||
Channel channel = null;
|
||||
if (args.length >= 3) {
|
||||
channel = api.getChannel(args[2]);
|
||||
isSpecifiedChannel = true;
|
||||
} else if (sender instanceof Player) {
|
||||
Player kicker = (Player) sender;
|
||||
channel = api.getDefaultChannel(kicker.getName());
|
||||
}
|
||||
if (channel == null) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgNoJoin");
|
||||
return true;
|
||||
@@ -121,7 +122,7 @@ public class MuteCommand extends SubCommandAbst {
|
||||
|
||||
// 期限付きMuteの場合、期限の指定が正しいかどうかをチェックする
|
||||
int expireMinutes = -1;
|
||||
if (args.length >= 3) {
|
||||
if (args.length >= 3 && !isSpecifiedChannel) {
|
||||
if ( !args[2].matches("[0-9]+") ) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgInvalidMuteExpireParameter");
|
||||
return true;
|
||||
|
||||
@@ -8,7 +8,6 @@ package com.github.ucchyocean.lc.command;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -141,7 +140,7 @@ public class OptionCommand extends SubCommandAbst {
|
||||
// イベントコール
|
||||
LunaChatChannelOptionChangedEvent event =
|
||||
new LunaChatChannelOptionChangedEvent(cname, sender, options);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
Utility.callEventSync(event);
|
||||
if ( event.isCancelled() ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -75,12 +75,6 @@ public class PardonCommand extends SubCommandAbst {
|
||||
public boolean runCommand(
|
||||
CommandSender sender, String label, String[] args) {
|
||||
|
||||
// プレイヤーでなければ終了する
|
||||
if (!(sender instanceof Player)) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgIngame");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 実行引数から、BAN解除するユーザーを取得する
|
||||
String kickedName = "";
|
||||
if (args.length >= 2) {
|
||||
@@ -90,9 +84,14 @@ public class PardonCommand extends SubCommandAbst {
|
||||
return true;
|
||||
}
|
||||
|
||||
// デフォルト参加チャンネルを取得、取得できない場合はエラー表示して終了する
|
||||
Player kicker = (Player) sender;
|
||||
Channel channel = api.getDefaultChannel(kicker.getName());
|
||||
// 対象チャンネルを取得、取得できない場合はエラー表示して終了する
|
||||
Channel channel = null;
|
||||
if (args.length >= 3) {
|
||||
channel = api.getChannel(args[2]);
|
||||
} else if (sender instanceof Player) {
|
||||
Player kicker = (Player) sender;
|
||||
channel = api.getDefaultChannel(kicker.getName());
|
||||
}
|
||||
if (channel == null) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgNoJoin");
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.github.ucchyocean.lc.command;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.github.ucchyocean.lc.Utility;
|
||||
import com.github.ucchyocean.lc.channel.Channel;
|
||||
|
||||
public class SetCommand extends SubCommandAbst {
|
||||
|
||||
private static final String COMMAND_NAME = "set";
|
||||
private static final String PERMISSION_NODE = "lunachat-admin." + COMMAND_NAME;
|
||||
private static final String USAGE_KEY1 = "usageSet1";
|
||||
|
||||
/**
|
||||
* コマンドを取得します。
|
||||
* @return コマンド
|
||||
* @see com.github.ucchyocean.lc.command.SubCommandAbst#getCommandName()
|
||||
*/
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return COMMAND_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* パーミッションノードを取得します。
|
||||
* @return パーミッションノード
|
||||
* @see com.github.ucchyocean.lc.command.SubCommandAbst#getPermissionNode()
|
||||
*/
|
||||
@Override
|
||||
public String getPermissionNode() {
|
||||
return PERMISSION_NODE;
|
||||
}
|
||||
|
||||
/**
|
||||
* コマンドの種別を取得します。
|
||||
* @return コマンド種別
|
||||
* @see com.github.ucchyocean.lc.command.SubCommandAbst#getCommandType()
|
||||
*/
|
||||
@Override
|
||||
public CommandType getCommandType() {
|
||||
return CommandType.ADMIN;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用方法に関するメッセージをsenderに送信します。
|
||||
* @param sender コマンド実行者
|
||||
* @param label 実行ラベル
|
||||
* @see com.github.ucchyocean.lc.command.SubCommandAbst#sendUsageMessage()
|
||||
*/
|
||||
@Override
|
||||
public void sendUsageMessage(CommandSender sender, String label) {
|
||||
sendResourceMessage(sender, "", USAGE_KEY1, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* コマンドを実行します。
|
||||
* @param sender コマンド実行者
|
||||
* @param label 実行ラベル
|
||||
* @param args 実行時の引数
|
||||
* @return コマンドが実行されたかどうか
|
||||
* @see com.github.ucchyocean.lc.command.SubCommandAbst#runCommand(java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public boolean runCommand(CommandSender sender, String label, String[] args) {
|
||||
|
||||
// 引数チェック
|
||||
// このコマンドは、コンソールでも実行できる
|
||||
|
||||
if ( args.length >= 3 && args[1].equalsIgnoreCase("default") ) {
|
||||
// 「/ch set default (player名) [channel名]」の実行
|
||||
|
||||
String targetPlayer = args[2];
|
||||
|
||||
Channel targetChannel = null;
|
||||
if ( args.length >= 4 ) {
|
||||
targetChannel = api.getChannel(args[3]);
|
||||
} else if ( sender instanceof Player ) {
|
||||
Player player = (Player)sender;
|
||||
targetChannel = api.getDefaultChannel(player.getName());
|
||||
}
|
||||
|
||||
if ( targetChannel == null ) {
|
||||
// チャンネルが正しく指定されなかった
|
||||
sendResourceMessage(sender, PREERR, "errmsgNotExistOrNotSpecified");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 発言先を設定
|
||||
api.setDefaultChannel(targetPlayer, targetChannel.getName());
|
||||
|
||||
sendResourceMessage(sender, PREINFO, "cmdmsgSetDefault", targetPlayer, targetChannel.getName());
|
||||
|
||||
Player target = Utility.getPlayerExact(targetPlayer);
|
||||
if ( target != null ) {
|
||||
sendResourceMessage(target, PREINFO, "cmdmsgSet", targetChannel.getName());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -87,22 +87,35 @@ public class UnhideCommand extends SubCommandAbst {
|
||||
|
||||
// 引数チェック
|
||||
String cname = null;
|
||||
boolean isPlayerCommand = false;
|
||||
boolean isChannelCommand = false;
|
||||
if ( args.length <= 1 ) {
|
||||
Channel def = api.getDefaultChannel(player.getName());
|
||||
if ( def != null ) {
|
||||
cname = def.getName();
|
||||
}
|
||||
} else if ( args.length >= 2 ) {
|
||||
cname = args[1];
|
||||
} else {
|
||||
sendResourceMessage(sender, PREERR, "errmsgCommand");
|
||||
return true;
|
||||
if ( args.length >= 3 && args[1].equalsIgnoreCase("player") ) {
|
||||
// 指定されたコマンドが「/ch unhide player (player名)」なら、対象をプレイヤーとする。
|
||||
isPlayerCommand = true;
|
||||
isChannelCommand = false;
|
||||
cname = args[2];
|
||||
|
||||
} else if ( args.length >= 3 && args[1].equalsIgnoreCase("channel") ) {
|
||||
// 指定されたコマンドが「/ch unhide channel (channel名)」なら、対象をチャンネルとする。
|
||||
isPlayerCommand = false;
|
||||
isChannelCommand = true;
|
||||
cname = args[2];
|
||||
|
||||
} else {
|
||||
// 「/ch hide (player名 または channel名)」
|
||||
cname = args[1];
|
||||
}
|
||||
}
|
||||
|
||||
// チャンネルかプレイヤーが存在するかどうかをチェックする
|
||||
boolean isChannelCommand = false;
|
||||
Channel channel = api.getChannel(cname);
|
||||
if ( channel != null ) {
|
||||
if ( !isPlayerCommand && channel != null ) {
|
||||
isChannelCommand = true;
|
||||
} else if ( Utility.getOfflinePlayer(cname) == null ) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgNotExistChannelAndPlayer");
|
||||
@@ -142,4 +155,4 @@ public class UnhideCommand extends SubCommandAbst {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,12 +75,6 @@ public class UnmuteCommand extends SubCommandAbst {
|
||||
public boolean runCommand(
|
||||
CommandSender sender, String label, String[] args) {
|
||||
|
||||
// プレイヤーでなければ終了する
|
||||
if (!(sender instanceof Player)) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgIngame");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 実行引数から、Mute解除するユーザーを取得する
|
||||
String kickedName = "";
|
||||
if (args.length >= 2) {
|
||||
@@ -90,9 +84,14 @@ public class UnmuteCommand extends SubCommandAbst {
|
||||
return true;
|
||||
}
|
||||
|
||||
// デフォルト参加チャンネルを取得、取得できない場合はエラー表示して終了する
|
||||
Player kicker = (Player) sender;
|
||||
Channel channel = api.getDefaultChannel(kicker.getName());
|
||||
// 対象チャンネルを取得、取得できない場合はエラー表示して終了する
|
||||
Channel channel = null;
|
||||
if (args.length >= 3) {
|
||||
channel = api.getChannel(args[2]);
|
||||
} else if (sender instanceof Player) {
|
||||
Player kicker = (Player) sender;
|
||||
channel = api.getDefaultChannel(kicker.getName());
|
||||
}
|
||||
if (channel == null) {
|
||||
sendResourceMessage(sender, PREERR, "errmsgNoJoin");
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.github.ucchyocean.lc.japanize;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
public class GoogleIME {
|
||||
|
||||
protected GoogleIME() {
|
||||
}
|
||||
|
||||
/**
|
||||
* GoogleIMEの最初の変換候補を抽出して結合します
|
||||
*
|
||||
* @param json 変換元のJson形式の文字列
|
||||
* @return 変換後の文字列
|
||||
* @since 2.8.10
|
||||
*/
|
||||
public static String parseJson(String json) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
for ( JsonElement response : new Gson().fromJson(json, JsonArray.class) ) {
|
||||
result.append(response.getAsJsonArray().get(1).getAsJsonArray().get(0).getAsString());
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,9 @@ import java.net.ProtocolException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import com.github.ucchyocean.lc.Utility;
|
||||
import com.google.common.io.CharStreams;
|
||||
|
||||
/**
|
||||
* ひらがなのみの文章を、IMEを使用して変換します。
|
||||
* 使用される変換候補は全て第1候補のため、正しくない結果が含まれることもよくあります。
|
||||
@@ -22,9 +25,9 @@ import java.net.URLEncoder;
|
||||
public class IMEConverter {
|
||||
|
||||
private static final String SOCIAL_IME_URL =
|
||||
"http://www.social-ime.com/api/?string=";
|
||||
"https://www.social-ime.com/api/?string=";
|
||||
private static final String GOOGLE_IME_URL =
|
||||
"http://www.google.com/transliterate?langpair=ja-Hira|ja&text=";
|
||||
"https://www.google.com/transliterate?langpair=ja-Hira|ja&text=";
|
||||
|
||||
/**
|
||||
* GoogleIMEを使って変換する
|
||||
@@ -74,17 +77,14 @@ public class IMEConverter {
|
||||
|
||||
reader = new BufferedReader(
|
||||
new InputStreamReader(urlconn.getInputStream(), encode));
|
||||
String line = "";
|
||||
StringBuilder result = new StringBuilder();
|
||||
while ( (line = reader.readLine()) != null ) {
|
||||
if ( isGoogleIME ) {
|
||||
result.append(parseGoogleIMEResult(line));
|
||||
} else {
|
||||
result.append(pickFirstElement(line));
|
||||
}
|
||||
|
||||
String json = CharStreams.toString(reader);
|
||||
String parsed = GoogleIME.parseJson(json);
|
||||
if ( !Utility.isCB19orLater() ) {
|
||||
parsed = YukiKanaConverter.fixBrackets(parsed);
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
return parsed;
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
@@ -107,59 +107,12 @@ public class IMEConverter {
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String pickFirstElement(String org) {
|
||||
int index = org.indexOf("\t");
|
||||
if ( index == -1 ) {
|
||||
return org;
|
||||
} else {
|
||||
return org.substring(0, index);
|
||||
}
|
||||
}
|
||||
|
||||
private static String parseGoogleIMEResult(String result) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
int level = 0;
|
||||
int index = 0;
|
||||
while ( index < result.length() ) {
|
||||
if ( level < 3 ) {
|
||||
int nextStart = result.indexOf("[", index);
|
||||
int nextEnd = result.indexOf("]", index);
|
||||
if ( nextStart == -1 ) {
|
||||
return buf.toString();
|
||||
} else {
|
||||
if ( nextStart < nextEnd ) {
|
||||
level++;
|
||||
index = nextStart+1;
|
||||
} else {
|
||||
level--;
|
||||
index = nextEnd+1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int start = result.indexOf("\"", index);
|
||||
int end = result.indexOf("\"", start+1);
|
||||
if ( start == -1 || end == -1 ) {
|
||||
return buf.toString();
|
||||
}
|
||||
buf.append(result.substring(start+1, end));
|
||||
int next = result.indexOf("]", end);
|
||||
if ( next == -1 ) {
|
||||
return buf.toString();
|
||||
} else {
|
||||
level--;
|
||||
index = next+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
// デバッグ用エントリ
|
||||
public static void main(String[] args) {
|
||||
String testee = "sonnnakotohanak(ry)";
|
||||
System.out.println("original : " + testee);
|
||||
System.out.println("kana : " + KanaConverter.conv(testee));
|
||||
System.out.println("GoogleIME : " + convByGoogleIME(KanaConverter.conv(testee)));
|
||||
System.out.println("SocialIME : " + convBySocialIME(KanaConverter.conv(testee)));
|
||||
System.out.println("kana : " + YukiKanaConverter.conv(testee));
|
||||
System.out.println("GoogleIME : " + convByGoogleIME(YukiKanaConverter.conv(testee)));
|
||||
System.out.println("SocialIME : " + convBySocialIME(YukiKanaConverter.conv(testee)));
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,9 @@ import java.util.HashMap;
|
||||
/**
|
||||
* ローマ字からかな文字へ変換するクラス
|
||||
* @author ucchy
|
||||
* @deprecated {@link YukiKanaConverter} を使用してください
|
||||
*/
|
||||
@Deprecated
|
||||
public class KanaConverter {
|
||||
|
||||
private static final HashMap<String, String[]> TABLE;
|
||||
|
||||
@@ -0,0 +1,381 @@
|
||||
package com.github.ucchyocean.lc.japanize;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
|
||||
/**
|
||||
* 「ローマ字」から「かな文字」へ正確に変換するクラス
|
||||
*
|
||||
* @author YukiLeafX
|
||||
* @see <a href="https://support.microsoft.com/ja-jp/help/883232">参考</a>
|
||||
*/
|
||||
public class YukiKanaConverter {
|
||||
|
||||
private static final ImmutableMap<String, String> MAP;
|
||||
|
||||
private static final String[] ROMAJI_LIST;
|
||||
private static final String[] HIRAGANA_LIST;
|
||||
|
||||
protected YukiKanaConverter() {
|
||||
}
|
||||
|
||||
static {
|
||||
ImmutableSortedMap.Builder<String, String> builder = ImmutableSortedMap.reverseOrder();
|
||||
|
||||
// ひらがな
|
||||
builder.put("a", "あ");
|
||||
builder.put("i", "い").put("yi", "い");
|
||||
builder.put("u", "う").put("wu", "う").put("whu", "う");
|
||||
builder.put("e", "え");
|
||||
builder.put("o", "お");
|
||||
|
||||
builder.put("wha", "うぁ");
|
||||
builder.put("whi", "うぃ").put("wi", "うぃ");
|
||||
//
|
||||
builder.put("whe", "うぇ").put("we", "うぇ");
|
||||
builder.put("who", "うぉ");
|
||||
|
||||
//
|
||||
builder.put("wyi", "ゐ"); // +
|
||||
//
|
||||
builder.put("wye", "ゑ"); // +
|
||||
//
|
||||
|
||||
builder.put("la", "ぁ").put("xa", "ぁ");
|
||||
builder.put("li", "ぃ").put("xi", "ぃ").put("lyi", "ぃ").put("xyi", "ぃ");
|
||||
builder.put("lu", "ぅ").put("xu", "ぅ");
|
||||
builder.put("le", "ぇ").put("xe", "ぇ").put("lye", "ぇ").put("xye", "ぇ");
|
||||
builder.put("lo", "ぉ").put("xo", "ぉ");
|
||||
|
||||
//
|
||||
builder.put("ye", "いぇ"); // +
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
builder.put("ka", "か").put("ca", "か");
|
||||
builder.put("ki", "き");
|
||||
builder.put("ku", "く").put("cu", "く").put("qu", "く");
|
||||
builder.put("ke", "け");
|
||||
builder.put("ko", "こ").put("co", "こ");
|
||||
|
||||
builder.put("kya", "きゃ");
|
||||
builder.put("kyi", "きぃ");
|
||||
builder.put("kyu", "きゅ");
|
||||
builder.put("kye", "きぇ");
|
||||
builder.put("kyo", "きょ");
|
||||
|
||||
builder.put("qya", "くゃ");
|
||||
//
|
||||
builder.put("qyu", "くゅ");
|
||||
//
|
||||
builder.put("qyo", "くょ");
|
||||
|
||||
builder.put("qwa", "くぁ").put("qa", "くぁ").put("kwa", "くぁ");
|
||||
builder.put("qwi", "くぃ").put("qi", "くぃ").put("qyi", "くぃ");
|
||||
builder.put("qwu", "くぅ");
|
||||
builder.put("qwe", "くぇ").put("qe", "くぇ").put("qye", "くぇ");
|
||||
builder.put("qwo", "くぉ").put("qo", "くぉ").put("kwo", "くぉ"); // +
|
||||
|
||||
builder.put("ga", "が");
|
||||
builder.put("gi", "ぎ");
|
||||
builder.put("gu", "ぐ");
|
||||
builder.put("ge", "げ");
|
||||
builder.put("go", "ご");
|
||||
|
||||
builder.put("gya", "ぎゃ");
|
||||
builder.put("gyi", "ぎぃ");
|
||||
builder.put("gyu", "ぎゅ");
|
||||
builder.put("gye", "ぎぇ");
|
||||
builder.put("gyo", "ぎょ");
|
||||
|
||||
builder.put("gwa", "ぐぁ");
|
||||
builder.put("gwi", "ぐぃ");
|
||||
builder.put("gwu", "ぐぅ");
|
||||
builder.put("gwe", "ぐぇ");
|
||||
builder.put("gwo", "ぐぉ");
|
||||
|
||||
builder.put("lka", "ヵ").put("xka", "ヵ");
|
||||
//
|
||||
//
|
||||
builder.put("lke", "ヶ").put("xke", "ヶ");
|
||||
//
|
||||
|
||||
builder.put("sa", "さ");
|
||||
builder.put("si", "し").put("ci", "し").put("shi", "し");
|
||||
builder.put("su", "す");
|
||||
builder.put("se", "せ").put("ce", "せ");
|
||||
builder.put("so", "そ");
|
||||
|
||||
builder.put("sya", "しゃ").put("sha", "しゃ");
|
||||
builder.put("syi", "しぃ");
|
||||
builder.put("syu", "しゅ").put("shu", "しゅ");
|
||||
builder.put("sye", "しぇ").put("she", "しぇ");
|
||||
builder.put("syo", "しょ").put("sho", "しょ");
|
||||
|
||||
builder.put("swa", "すぁ");
|
||||
builder.put("swi", "すぃ");
|
||||
builder.put("swu", "すぅ");
|
||||
builder.put("swe", "すぇ");
|
||||
builder.put("swo", "すぉ");
|
||||
|
||||
builder.put("za", "ざ");
|
||||
builder.put("zi", "じ").put("ji", "じ");
|
||||
builder.put("zu", "ず");
|
||||
builder.put("ze", "ぜ");
|
||||
builder.put("zo", "ぞ");
|
||||
|
||||
builder.put("zya", "じゃ").put("ja", "じゃ").put("jya", "じゃ");
|
||||
builder.put("zyi", "じぃ")/* */.put("jyi", "じぃ");
|
||||
builder.put("zyu", "じゅ").put("ju", "じゅ").put("jyu", "じゅ");
|
||||
builder.put("zye", "じぇ").put("je", "じぇ").put("jye", "じぇ");
|
||||
builder.put("zyo", "じょ").put("jo", "じょ").put("jyo", "じょ");
|
||||
|
||||
builder.put("ta", "た");
|
||||
builder.put("ti", "ち").put("chi", "ち");
|
||||
builder.put("tu", "つ").put("tsu", "つ");
|
||||
builder.put("te", "て");
|
||||
builder.put("to", "と");
|
||||
|
||||
builder.put("tya", "ちゃ").put("cha", "ちゃ").put("cya", "ちゃ");
|
||||
builder.put("tyi", "ちぃ")/* */.put("cyi", "ちぃ");
|
||||
builder.put("tyu", "ちゅ").put("chu", "ちゅ").put("cyu", "ちゅ");
|
||||
builder.put("tye", "ちぇ").put("che", "ちぇ").put("cye", "ちぇ");
|
||||
builder.put("tyo", "ちょ").put("cho", "ちょ").put("cyo", "ちょ");
|
||||
|
||||
builder.put("tsa", "つぁ");
|
||||
builder.put("tsi", "つぃ");
|
||||
//
|
||||
builder.put("tse", "つぇ");
|
||||
builder.put("tso", "つぉ");
|
||||
|
||||
builder.put("tha", "てゃ");
|
||||
builder.put("thi", "てぃ");
|
||||
builder.put("thu", "てゅ");
|
||||
builder.put("the", "てぇ");
|
||||
builder.put("tho", "てょ");
|
||||
|
||||
builder.put("twa", "とぁ");
|
||||
builder.put("twi", "とぃ");
|
||||
builder.put("twu", "とぅ");
|
||||
builder.put("twe", "とぇ");
|
||||
builder.put("two", "とぉ");
|
||||
|
||||
builder.put("da", "だ");
|
||||
builder.put("di", "ぢ");
|
||||
builder.put("du", "づ");
|
||||
builder.put("de", "で");
|
||||
builder.put("do", "ど");
|
||||
|
||||
builder.put("dya", "ぢゃ");
|
||||
builder.put("dyi", "ぢぃ");
|
||||
builder.put("dyu", "ぢゅ");
|
||||
builder.put("dye", "ぢぇ");
|
||||
builder.put("dyo", "ぢょ");
|
||||
|
||||
builder.put("dha", "でゃ");
|
||||
builder.put("dhi", "でぃ");
|
||||
builder.put("dhu", "でゅ");
|
||||
builder.put("dhe", "でぇ");
|
||||
builder.put("dho", "でょ");
|
||||
|
||||
builder.put("dwa", "どぁ");
|
||||
builder.put("dwi", "どぃ");
|
||||
builder.put("dwu", "どぅ");
|
||||
builder.put("dwe", "どぇ");
|
||||
builder.put("dwo", "どぉ");
|
||||
|
||||
//
|
||||
//
|
||||
builder.put("ltu", "っ").put("xtu", "っ").put("ltsu", "っ").put("xtsu", "っ"); // +
|
||||
//
|
||||
//
|
||||
|
||||
builder.put("na", "な");
|
||||
builder.put("ni", "に");
|
||||
builder.put("nu", "ぬ");
|
||||
builder.put("ne", "ね");
|
||||
builder.put("no", "の");
|
||||
|
||||
builder.put("nya", "にゃ");
|
||||
builder.put("nyi", "にぃ");
|
||||
builder.put("nyu", "にゅ");
|
||||
builder.put("nye", "にぇ");
|
||||
builder.put("nyo", "にょ");
|
||||
|
||||
builder.put("ha", "は");
|
||||
builder.put("hi", "ひ");
|
||||
builder.put("hu", "ふ").put("fu", "ふ");
|
||||
builder.put("he", "へ");
|
||||
builder.put("ho", "ほ");
|
||||
|
||||
builder.put("hya", "ひゃ");
|
||||
builder.put("hyi", "ひぃ");
|
||||
builder.put("hyu", "ひゅ");
|
||||
builder.put("hye", "ひぇ");
|
||||
builder.put("hyo", "ひょ");
|
||||
|
||||
builder.put("fwa", "ふぁ").put("fa", "ふぁ");
|
||||
builder.put("fwi", "ふぃ").put("fi", "ふぃ").put("fyi", "ふぃ");
|
||||
builder.put("fwu", "ふぅ");
|
||||
builder.put("fwe", "ふぇ").put("fe", "ふぇ").put("fye", "ふぇ");
|
||||
builder.put("fwo", "ふぉ").put("fo", "ふぉ");
|
||||
|
||||
builder.put("fya", "ふゃ");
|
||||
//
|
||||
builder.put("fyu", "ふゅ");
|
||||
//
|
||||
builder.put("fyo", "ふょ");
|
||||
|
||||
builder.put("ba", "ば");
|
||||
builder.put("bi", "び");
|
||||
builder.put("bu", "ぶ");
|
||||
builder.put("be", "べ");
|
||||
builder.put("bo", "ぼ");
|
||||
|
||||
builder.put("bya", "びゃ");
|
||||
builder.put("byi", "びぃ");
|
||||
builder.put("byu", "びゅ");
|
||||
builder.put("bye", "びぇ");
|
||||
builder.put("byo", "びょ");
|
||||
|
||||
builder.put("va", "ヴぁ");
|
||||
builder.put("vi", "ヴぃ");
|
||||
builder.put("vu", "ヴ");
|
||||
builder.put("ve", "ヴぇ");
|
||||
builder.put("vo", "ヴぉ");
|
||||
|
||||
builder.put("vya", "ヴゃ");
|
||||
builder.put("vyi", "ヴぃ");
|
||||
builder.put("vyu", "ヴゅ");
|
||||
builder.put("vye", "ヴぇ");
|
||||
builder.put("vyo", "ヴょ");
|
||||
|
||||
builder.put("pa", "ぱ");
|
||||
builder.put("pi", "ぴ");
|
||||
builder.put("pu", "ぷ");
|
||||
builder.put("pe", "ぺ");
|
||||
builder.put("po", "ぽ");
|
||||
|
||||
builder.put("pya", "ぴゃ");
|
||||
builder.put("pyi", "ぴぃ");
|
||||
builder.put("pyu", "ぴゅ");
|
||||
builder.put("pye", "ぴぇ");
|
||||
builder.put("pyo", "ぴょ");
|
||||
|
||||
builder.put("ma", "ま");
|
||||
builder.put("mi", "み");
|
||||
builder.put("mu", "む");
|
||||
builder.put("me", "め");
|
||||
builder.put("mo", "も");
|
||||
|
||||
builder.put("mya", "みゃ");
|
||||
builder.put("myi", "みぃ");
|
||||
builder.put("myu", "みゅ");
|
||||
builder.put("mye", "みぇ");
|
||||
builder.put("myo", "みょ");
|
||||
|
||||
builder.put("ya", "や");
|
||||
//
|
||||
builder.put("yu", "ゆ");
|
||||
//
|
||||
builder.put("yo", "よ");
|
||||
|
||||
builder.put("lya", "ゃ").put("xya", "ゃ");
|
||||
//
|
||||
builder.put("lyu", "ゅ").put("xyu", "ゅ");
|
||||
//
|
||||
builder.put("lyo", "ょ").put("xyo", "ょ");
|
||||
|
||||
builder.put("ra", "ら");
|
||||
builder.put("ri", "り");
|
||||
builder.put("ru", "る");
|
||||
builder.put("re", "れ");
|
||||
builder.put("ro", "ろ");
|
||||
|
||||
builder.put("rya", "りゃ");
|
||||
builder.put("ryi", "りぃ");
|
||||
builder.put("ryu", "りゅ");
|
||||
builder.put("rye", "りぇ");
|
||||
builder.put("ryo", "りょ");
|
||||
|
||||
builder.put("wa", "わ");
|
||||
//
|
||||
//
|
||||
//
|
||||
builder.put("wo", "を");
|
||||
|
||||
builder.put("lwa", "ゎ").put("xwa", "ゎ");
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
builder.put("n", "ん").put("nn", "ん").put("n'", "ん").put("xn", "ん");
|
||||
|
||||
// 促音を追加する
|
||||
for ( Map.Entry<String, String> entry : builder.build().entrySet() ) {
|
||||
String romaji = entry.getKey();
|
||||
String hiragana = entry.getValue();
|
||||
if ( canStartFromSokuon(romaji) ) {
|
||||
builder.put(romaji.charAt(0) + romaji, "っ" + hiragana);
|
||||
}
|
||||
}
|
||||
|
||||
// 記号とか
|
||||
builder.put("-", "ー");
|
||||
builder.put(",", "、");
|
||||
builder.put(".", "。");
|
||||
builder.put("?", "?");
|
||||
builder.put("!", "!");
|
||||
builder.put("[", "「").put("]", "」");
|
||||
builder.put("<", "<").put(">", ">");
|
||||
builder.put("&", "&");
|
||||
builder.put("\"", "”");
|
||||
builder.put("(", "(").put(")", ")");
|
||||
|
||||
MAP = builder.build();
|
||||
|
||||
ROMAJI_LIST = MAP.keySet().toArray(new String[0]);
|
||||
HIRAGANA_LIST = MAP.values().toArray(new String[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 「っ」や「ッ」などの促音から開始できるかどうか
|
||||
*
|
||||
* @param romaji 検証したい「ローマ字」
|
||||
* @return 促音から開始できるかどうか
|
||||
* @since 2.8.10
|
||||
*/
|
||||
private static boolean canStartFromSokuon(String romaji) {
|
||||
return !StringUtils.startsWithAny(romaji, "a", "i", "u", "e", "o", "n");
|
||||
}
|
||||
|
||||
/**
|
||||
* 「ローマ字」から「かな文字」に変換する
|
||||
*
|
||||
* @param romaji 変換元の「ローマ字」
|
||||
* @return 変換後の「かな文字」
|
||||
* @since 2.8.10
|
||||
*/
|
||||
public static String conv(String romaji) {
|
||||
return StringUtils.replaceEach(romaji, ROMAJI_LIST, HIRAGANA_LIST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 全角カッコを半角カッコに変換する (1.8以下のサーバーで全角カッコは表示できないため)
|
||||
*
|
||||
* @param text 変換元のテキスト
|
||||
* @return 全角カッコが半角カッコになったテキスト
|
||||
* @since 2.8.10
|
||||
*/
|
||||
public static String fixBrackets(String text) {
|
||||
String[] full = new String[] { "(", ")" };
|
||||
String[] half = new String[] { "(", ")" };
|
||||
return StringUtils.replaceEach(text, full, half);
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ removeModeratorMessage: '&f[%color%ch&f]&7%player さんがチャンネルのモ
|
||||
noRecipientMessage: '&f[%color%ch&f]&7あなたの発言は、誰にも届きませんでした。'
|
||||
|
||||
listFirstLine: '&7---------- &bチャンネルリスト &7----------'
|
||||
listFirstLinePaging: '&7---------- &bチャンネルリスト&7(&c%d&7/&c%d&7) ----------'
|
||||
listEndLine: '&7----------------------------------'
|
||||
listFormat: '&7| &f%s&7(&c%d&7/&c%d&7) &a%s'
|
||||
listPlainPrefix: '&7| '
|
||||
@@ -55,6 +56,7 @@ errorPrefix: '&f[&cChat&f]'
|
||||
|
||||
cmdmsgJoin: 'チャンネル %s に参加しました。'
|
||||
cmdmsgSet: 'デフォルトの発言先を %s に設定しました。'
|
||||
cmdmsgSetTopic: 'トピック: &a%s'
|
||||
cmdmsgSetHide: '<注意> 現在このチャンネルを非表示に設定しています。'
|
||||
cmdmsgLeave: 'チャンネル %s から退出しました。'
|
||||
cmdmsgInvite: '%s さんを、チャンネル %s に招待しました。'
|
||||
@@ -93,6 +95,7 @@ cmdmsgTemplateRemove: 'テンプレート %s番を削除しました。'
|
||||
cmdmsgCheck: '削除対象のチャンネルは %d 個です。'
|
||||
cmdmsgCheckConfirm: '全て削除する場合は、/%s check remove を実行してください。'
|
||||
cmdmsgCheckRemove: '%d 個のチャンネルを削除しました。'
|
||||
cmdmsgSetDefault: '%s さんの発言先を %s に設定しました。'
|
||||
|
||||
cmdmsgPlayerJapanize: 'Your chat''s Japanize conversion was turned %s.'
|
||||
cmdmsgPlayerJapanizeOther: '%s さんのJapanize変換を %s にしました。'
|
||||
@@ -104,6 +107,7 @@ errmsgIngame: 'このコマンドはゲーム内からしか実行できませ
|
||||
errmsgCommand: 'コマンドの指定が正しくありません。'
|
||||
errmsgNotExist: '指定されたチャンネルが存在しません。'
|
||||
errmsgNotExistChannelAndPlayer: '指定されたチャンネルもプレイヤーも存在しません。'
|
||||
errmsgNotExistOrNotSpecified: '指定されたチャンネルが存在しないか、チャンネルが指定されませんでした。'
|
||||
errmsgExist: '指定されたチャンネル名が既に存在します。'
|
||||
errmsgNomember: '指定されたチャンネルに参加していません。'
|
||||
errmsgNomemberOther: '指定されたプレイヤーはチャンネルに参加していません。'
|
||||
@@ -195,6 +199,7 @@ usageCheck1: '&6/%s check &7- モデレーターがいないチャンネルを
|
||||
usageCheck2: '&6/%s check remove &7- /ch check で一覧されたチャンネルを全て削除します。'
|
||||
usageReload: '&6/%s reload &7- config.ymlの再読み込みをします。'
|
||||
usageHelp: '&6/%s help [user|mod|admin] [page] &7- ヘルプを表示します。'
|
||||
usageSet1: '&6/%s set default (player) [channel] &7- 指定したプレイヤーの発言先チャンネルを、指定したチャンネルに設定します。'
|
||||
|
||||
usageMessage: '&6/%s (name) [message] &7- 指定したプレイヤーとの個人チャットを開始します。'
|
||||
usageReply: '&6/%s [message] &7- 受信した個人チャットに返信します。'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: ${project.name}
|
||||
main: com.github.ucchyocean.lc.LunaChat
|
||||
version: ${project.version}
|
||||
author: ucchy
|
||||
authors: [ucchy, YukiLeafX]
|
||||
description: ${project.description}
|
||||
softdepend: [Vault, dynmap, HawkEye, Multiverse-Core, mcMMO, Prism]
|
||||
|
||||
@@ -16,17 +16,21 @@ commands:
|
||||
/<command> invite (name) [force] - 指定した人をチャンネルチャットに招待します。
|
||||
/<command> accept - 招待を受けてチャンネルチャットに入室します。
|
||||
/<command> deny - 招待を拒否します。
|
||||
/<command> kick (name) - 指定した人をチャンネルチャットからキックします。
|
||||
/<command> ban (name) - 指定した人をチャンネルチャットからBANします。
|
||||
/<command> kick (name) [channel] - 指定した人をチャンネルチャットからキックします。
|
||||
/<command> ban (name) [channel] - 指定した人をチャンネルチャットからBANします。
|
||||
/<command> ban (name) [minutes] - 指定した人を指定した分間、BANします。
|
||||
/<command> pardon (name) - 指定した人のBANを解除します。
|
||||
/<command> mute (name) - 指定した人をチャンネルチャットからMuteします。
|
||||
/<command> pardon (name) [channel] - 指定した人のBANを解除します。
|
||||
/<command> mute (name) [channel] - 指定した人をチャンネルチャットからMuteします。
|
||||
/<command> mute (name) [minutes] - 指定した人を指定した分間、Muteします。
|
||||
/<command> unmute (name) - 指定した人のMuteを解除します。
|
||||
/<command> hide [channel] - 指定したチャンネルの発言内容を非表示にします。指定を省略すると、現在自分が居るチャンネルが非表示になります。
|
||||
/<command> unmute (name) [channel] - 指定した人のMuteを解除します。
|
||||
/<command> hide (channel) - 指定したチャンネルの発言内容を非表示にします。
|
||||
/<command> hide channel (channel) - 指定したチャンネルの発言内容を非表示にします。
|
||||
/<command> hide (player) - 指定したプレイヤーの発言内容を非表示にします。
|
||||
/<command> unhide [channel] - 指定したチャンネルの発言内容を非表示から表示に戻します。
|
||||
/<command> hide player (player) - 指定したプレイヤーの発言内容を非表示にします。
|
||||
/<command> unhide (channel) - 指定したチャンネルの発言内容を非表示から表示に戻します。
|
||||
/<command> unhide channel (channel) - 指定したチャンネルの発言内容を非表示から表示に戻します。
|
||||
/<command> unhide (player) - 指定したプレイヤーの発言内容を非表示から表示に戻します。
|
||||
/<command> unhide player (player) - 指定したプレイヤーの発言内容を非表示から表示に戻します。
|
||||
/<command> info [channel] - チャンネルの情報を表示します。
|
||||
/<command> log [channel] [key=value...] - チャンネルのログを表示します。
|
||||
/<command> create (channel) - チャンネルを作成します。
|
||||
@@ -38,6 +42,7 @@ commands:
|
||||
/<command> template (number) (template...) - メッセージフォーマットのテンプレートを登録します。
|
||||
/<command> check - モデレータがいないチャンネルを一覧します。
|
||||
/<command> check remove - /<command> check で一覧されたチャンネルを全て削除します。
|
||||
/<command> set default (player) [channel] - 指定したプレイヤーの発言先チャンネルを、指定したチャンネルに設定します。
|
||||
/<command> reload - config.ymlの再読み込みをします。
|
||||
/<command> help [user|mod|admin] [page] - ヘルプを表示します。
|
||||
tell:
|
||||
@@ -221,6 +226,9 @@ permissions:
|
||||
lunachat-admin.check:
|
||||
description: checkコマンドの使用権限
|
||||
default: op
|
||||
lunachat-admin.set:
|
||||
description: setコマンドの使用権限
|
||||
default: op
|
||||
lunachat-admin.reload:
|
||||
description: reloadコマンドの使用権限
|
||||
default: op
|
||||
@@ -237,6 +245,7 @@ permissions:
|
||||
lunachat-admin.template: true
|
||||
lunachat-admin.dictionary: true
|
||||
lunachat-admin.check: true
|
||||
lunachat-admin.set: true
|
||||
lunachat-admin.reload: true
|
||||
lunachat-admin.japanize-other: true
|
||||
lunachat-admin.force-invite: true
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする