コミットを比較

...
5 コミット
10個のファイルの変更、126行の追加、19行の削除

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

バイナリ
ファイルの表示
バイナリファイルは表示されません。
バイナリ
ファイルの表示
バイナリファイルは表示されません。
+19 -2
ファイルの表示
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.ucchyocean</groupId>
<artifactId>LunaChat</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
<description>A powerfull chat channel plugin with IME (Kana-Kanji conversion) support</description>
<url>https://github.com/ucchyocean/LunaChat</url>
@@ -115,6 +115,16 @@
<name>Multiverse repository</name>
<url>http://repo.onarandombox.com/content/repositories/multiverse/</url>
</repository>
<repository>
<id>codemc-repo</id>
<name>mcMMO Repository</name>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<repository>
<id>weaondara-repo</id>
<name>wea_ondara's Repository</name>
<url>http://repo.wea-ondara.net/repository/public/</url>
</repository>
<repository>
<id>md5-repo</id>
<name>MD5 repository</name>
@@ -164,7 +174,14 @@
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.5.00</version>
<version>2.1.128</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.alpenblock</groupId>
<artifactId>BungeePerms</artifactId>
<version>LATEST</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
+14
ファイルの表示
@@ -11,6 +11,7 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.logging.Level;
import com.github.ucchyocean.lc3.bridge.BungeePermsBridge;
import com.github.ucchyocean.lc3.bungee.BungeeEventListener;
import com.github.ucchyocean.lc3.bungee.BungeeEventSender;
import com.github.ucchyocean.lc3.bungee.JapanizeCommandBungee;
@@ -37,6 +38,8 @@ public class LunaChatBungee extends Plugin implements PluginInterface {
private UUIDCacheData uuidCacheData;
private LunaChatLogger normalChatLogger;
private BungeePermsBridge bungeeperms;
/**
* プラグインが有効化されたときに呼び出されるメソッド
* @see net.md_5.bungee.api.plugin.Plugin#onEnable()
@@ -61,6 +64,9 @@ public class LunaChatBungee extends Plugin implements PluginInterface {
manager.removeAllDefaultChannels();
}
// BungeePermsのロード
bungeeperms = BungeePermsBridge.load();
// コマンド登録
getProxy().getPluginManager().registerCommand(this,
new LunaChatCommandBungee("lunachat", "", "lc", "ch"));
@@ -196,4 +202,12 @@ public class LunaChatBungee extends Plugin implements PluginInterface {
public void runAsyncTask(Runnable task) {
ProxyServer.getInstance().getScheduler().runAsync(this, task);
}
/**
* BungeePerms連携クラスを取得する
* @return BungeePerms連携クラス
*/
public BungeePermsBridge getBungeePerms() {
return bungeeperms;
}
}
+13 -2
ファイルの表示
@@ -66,12 +66,19 @@ public class YamlConfig {
}
public static YamlConfig load(File file) {
// 対象ファイルが存在しない場合やからっぽの場合は、からっぽのYamlConfigを返す
if ( !file.exists() || !file.isFile() || file.length() == 0 ) return new YamlConfig();
// 読み込む
try ( InputStreamReader reader = new InputStreamReader(new FileInputStream(file), "UTF-8") ) {
return load(reader);
} catch (IOException e) {
e.printStackTrace();
}
return null;
// 読み込みに失敗した場合は、からっぽのYamlConfigを返す
return new YamlConfig();
}
public void save(File file) throws IOException {
@@ -148,6 +155,10 @@ public class YamlConfig {
}
public void addDefaults(YamlConfig defaults) {
this.defaults = defaults.map;
if (defaults == null) {
this.defaults = new HashMap<String, Object>();
} else {
this.defaults = defaults.map;
}
}
}
+55
ファイルの表示
@@ -0,0 +1,55 @@
/*
* @author ucchy
* @license LGPLv3
* @copyright Copyright ucchy 2020
*/
package com.github.ucchyocean.lc3.bridge;
import net.alpenblock.bungeeperms.BungeePermsAPI;
import net.md_5.bungee.api.ProxyServer;
/**
* BungeePerms連携クラス
* @author ucchy
*/
public class BungeePermsBridge {
// コンストラクタは外から利用不可
private BungeePermsBridge() {
}
/**
* BungeePermsをロードする
* @return ロードされたBungeePermsBridge
*/
public static BungeePermsBridge load() {
// BungeePermsが動作しているかどうか確認
boolean loaded = ProxyServer.getInstance().getPluginManager().getPlugin("BungeePerms") != null;
// ロードされているならBungeePermsBridgeのインスタンスを、ロードされていないならnullを返す
return loaded ? new BungeePermsBridge() : null;
}
/**
* Gets the full prefix of the player
* @param nameoruuid the username or uuid of the player
* @param server the server; may be null; if server == "" then the current server is used or null if BungeeCord
* @param world the world; may be null
* @return the full prefix; may be null
*/
public String userPrefix(String nameoruuid, String server, String world) {
return BungeePermsAPI.userPrefix(nameoruuid, server, world);
}
/**
* Gets the full suffix of the player
* @param nameoruuid the username or uuid of the player
* @param server the server; may be null; if server == "" then the current server is used or null if BungeeCord
* @param world the world; may be null
* @return the full suffix; may be null
*/
public String userSuffix(String nameoruuid, String server, String world) {
return BungeePermsAPI.userSuffix(nameoruuid, server, world);
}
}
+2 -1
ファイルの表示
@@ -5,6 +5,7 @@
*/
package com.github.ucchyocean.lc3.bridge;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -72,7 +73,7 @@ public class McMMOBridge implements Listener {
// 2byteコードを含むなら、Japanize変換は行わない
String kanaTemp = Utility.stripColorCode(message);
if ( !skipJapanize &&
( kanaTemp.getBytes().length > kanaTemp.length() ||
( kanaTemp.getBytes(StandardCharsets.UTF_8).length > kanaTemp.length() ||
kanaTemp.matches("[ \\uFF61-\\uFF9F]+") ) ) {
skipJapanize = true;
}
+11 -3
ファイルの表示
@@ -21,6 +21,7 @@ import com.github.ucchyocean.lc3.LunaChatBungee;
import com.github.ucchyocean.lc3.LunaChatConfig;
import com.github.ucchyocean.lc3.Messages;
import com.github.ucchyocean.lc3.Utility;
import com.github.ucchyocean.lc3.bridge.BungeePermsBridge;
import com.github.ucchyocean.lc3.channel.Channel;
import com.github.ucchyocean.lc3.event.EventResult;
import com.github.ucchyocean.lc3.japanize.Japanizer;
@@ -412,9 +413,16 @@ public class BungeeEventListener implements Listener {
}
if ( format.contains("%prefix") || format.contains("%suffix") ) {
// TODO 未実装
format = format.replace("%prefix", "");
format = format.replace("%suffix", "");
String prefix = "";
String suffix = "";
BungeePermsBridge bungeeperms = LunaChatBungee.getInstance().getBungeePerms();
if ( bungeeperms != null ) {
prefix = bungeeperms.userPrefix(player.getUniqueId().toString(), null, null);
suffix = bungeeperms.userSuffix(player.getUniqueId().toString(), null, null);
}
format = format.replace("%prefix", prefix);
format = format.replace("%suffix", suffix);
}
if ( format.contains("%world") ) {
+12 -10
ファイルの表示
@@ -10,6 +10,8 @@ import java.util.UUID;
import org.jetbrains.annotations.Nullable;
import com.github.ucchyocean.lc3.LunaChat;
import com.github.ucchyocean.lc3.LunaChatBungee;
import com.github.ucchyocean.lc3.bridge.BungeePermsBridge;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.TextComponent;
@@ -49,7 +51,6 @@ public class ChannelMemberProxiedPlayer extends ChannelMemberBungee {
if ( nameOrUuid.startsWith("$") ) {
return new ChannelMemberProxiedPlayer(UUID.fromString(nameOrUuid.substring(1)));
} else {
// TODO オフラインのプレイヤー取得について検討する
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(nameOrUuid);
if ( player != null ) return new ChannelMemberProxiedPlayer(player.getUniqueId());
}
@@ -104,10 +105,11 @@ public class ChannelMemberProxiedPlayer extends ChannelMemberBungee {
*/
@Override
public String getPrefix() {
// TODO 未実装
return "";
BungeePermsBridge bungeeperms = LunaChatBungee.getInstance().getBungeePerms();
if ( bungeeperms == null ) {
return "";
}
return bungeeperms.userPrefix(id.toString(), null, null);
}
/**
@@ -117,10 +119,11 @@ public class ChannelMemberProxiedPlayer extends ChannelMemberBungee {
*/
@Override
public String getSuffix() {
// TODO 未実装
return "";
BungeePermsBridge bungeeperms = LunaChatBungee.getInstance().getBungeePerms();
if ( bungeeperms == null ) {
return "";
}
return bungeeperms.userSuffix(id.toString(), null, null);
}
/**
@@ -171,7 +174,6 @@ public class ChannelMemberProxiedPlayer extends ChannelMemberBungee {
*/
@Override
public boolean isPermissionSet(String node) {
// TODO 要テスト
ProxiedPlayer player = getPlayer();
if ( player != null ) {
return player.getPermissions().contains(node);
-1
ファイルの表示
@@ -216,4 +216,3 @@ japanizeIgnorePlayerName: true
noneJapanizeMarker: '#'
# -------------------- BungeeCord用設定 --------------------