diff --git a/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java b/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java index e376b15..63eef97 100644 --- a/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java +++ b/src/main/java/com/github/ucchyocean/lc/channel/ChannelImpl.java @@ -90,8 +90,8 @@ public class ChannelImpl extends Channel { public void chat(ChannelPlayer player, String message) { // 発言権限を確認する - if (!player.hasPermission(PERMISSION_SPEAK_PREFIX + ".*") - && !player.hasPermission(PERMISSION_SPEAK_PREFIX + "." + getName())) { + String node = PERMISSION_SPEAK_PREFIX + "." + getName(); + if ( player.isPermissionSet(node) && !player.hasPermission(node) ) { sendResourceMessage(player, PREERR, "errmsgPermission", PERMISSION_SPEAK_PREFIX + "." + getName()); return; diff --git a/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayer.java b/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayer.java index 7bce2fc..e39e3ed 100644 --- a/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayer.java +++ b/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayer.java @@ -73,6 +73,13 @@ public abstract class ChannelPlayer implements Comparable { */ public abstract boolean hasPermission(String node); + /** + * 指定されたパーミッションノードが定義されているかどうかを取得する + * @param node パーミッションノード + * @return 定義を持っているかどうか + */ + public abstract boolean isPermissionSet(String node); + /** * 指定されたCommandSenderと同一かどうかを返す * @param sender diff --git a/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerBlock.java b/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerBlock.java index ba56694..07e01ec 100644 --- a/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerBlock.java +++ b/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerBlock.java @@ -116,6 +116,17 @@ public class ChannelPlayerBlock extends ChannelPlayer { return sender.hasPermission(node); } + /** + * 指定されたパーミッションノードが定義されているかどうかを取得する + * @param node パーミッションノード + * @return 定義を持っているかどうか + * @see com.github.ucchyocean.lc.channel.ChannelPlayer#isPermissionSet(java.lang.String) + */ + @Override + public boolean isPermissionSet(String node) { + return sender.isPermissionSet(node); + } + /** * 指定されたCommandSenderと同一かどうかを返す * @param sender diff --git a/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerConsole.java b/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerConsole.java index 76d4d7f..3165971 100644 --- a/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerConsole.java +++ b/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerConsole.java @@ -116,6 +116,17 @@ public class ChannelPlayerConsole extends ChannelPlayer { return sender.hasPermission(node); } + /** + * 指定されたパーミッションノードが定義されているかどうかを取得する + * @param node パーミッションノード + * @return 定義を持っているかどうか + * @see com.github.ucchyocean.lc.channel.ChannelPlayer#isPermissionSet(java.lang.String) + */ + @Override + public boolean isPermissionSet(String node) { + return sender.isPermissionSet(node); + } + /** * 指定されたCommandSenderと同一かどうかを返す * @param sender diff --git a/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerName.java b/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerName.java index 7a253c6..15332c2 100644 --- a/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerName.java +++ b/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerName.java @@ -152,6 +152,22 @@ public class ChannelPlayerName extends ChannelPlayer { } } + /** + * 指定されたパーミッションノードが定義されているかどうかを取得する + * @param node パーミッションノード + * @return 定義を持っているかどうか + * @see com.github.ucchyocean.lc.channel.ChannelPlayer#isPermissionSet(java.lang.String) + */ + @Override + public boolean isPermissionSet(String node) { + Player player = getPlayer(); + if ( player == null ) { + return false; + } else { + return player.isPermissionSet(node); + } + } + /** * 指定されたCommandSenderと同一かどうかを返す * @param sender diff --git a/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerUUID.java b/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerUUID.java index bd67f93..727a572 100644 --- a/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerUUID.java +++ b/src/main/java/com/github/ucchyocean/lc/channel/ChannelPlayerUUID.java @@ -202,6 +202,22 @@ public class ChannelPlayerUUID extends ChannelPlayer { } } + /** + * 指定されたパーミッションノードが定義されているかどうかを取得する + * @param node パーミッションノード + * @return 定義を持っているかどうか + * @see com.github.ucchyocean.lc.channel.ChannelPlayer#isPermissionSet(java.lang.String) + */ + @Override + public boolean isPermissionSet(String node) { + Player player = getPlayer(); + if ( player == null ) { + return false; + } else { + return player.isPermissionSet(node); + } + } + /** * 指定されたCommandSenderと同一かどうかを返す * @param sender diff --git a/src/main/java/com/github/ucchyocean/lc/command/JoinCommand.java b/src/main/java/com/github/ucchyocean/lc/command/JoinCommand.java index 8c8985f..b265898 100644 --- a/src/main/java/com/github/ucchyocean/lc/command/JoinCommand.java +++ b/src/main/java/com/github/ucchyocean/lc/command/JoinCommand.java @@ -167,7 +167,8 @@ public class JoinCommand extends SubCommandAbst { channelName = channel.getName(); // 入室権限を確認する - if (!sender.hasPermission(PERMISSION_NODE + "." + channelName)) { + String node = PERMISSION_NODE + "." + channelName; + if (sender.isPermissionSet(node) && !sender.hasPermission(node)) { sendResourceMessage(sender, PREERR, "errmsgPermission", PERMISSION_NODE + "." + channelName); return true; @@ -241,6 +242,7 @@ public class JoinCommand extends SubCommandAbst { } private boolean hasSpeakPermission(CommandSender sender, String channelName) { - return sender.hasPermission(PERMISSION_SPEAK_PREFIX + "." + channelName); + String node = PERMISSION_SPEAK_PREFIX + "." + channelName; + return sender.isPermissionSet(node) && sender.hasPermission(node); } } diff --git a/src/main/java/com/github/ucchyocean/lc/command/LeaveCommand.java b/src/main/java/com/github/ucchyocean/lc/command/LeaveCommand.java index ccd41e6..4c3e08d 100644 --- a/src/main/java/com/github/ucchyocean/lc/command/LeaveCommand.java +++ b/src/main/java/com/github/ucchyocean/lc/command/LeaveCommand.java @@ -104,7 +104,8 @@ public class LeaveCommand extends SubCommandAbst { channelName = channel.getName(); // 退室権限を確認する - if (!sender.hasPermission(PERMISSION_NODE + "." + channelName)) { + String node = PERMISSION_NODE + "." + channelName; + if (sender.isPermissionSet(node) && !sender.hasPermission(node)) { sendResourceMessage(sender, PREERR, "errmsgPermission", PERMISSION_NODE + "." + channelName); return true; diff --git a/src/main/java/com/github/ucchyocean/lc/command/LogCommand.java b/src/main/java/com/github/ucchyocean/lc/command/LogCommand.java index 53280aa..3ee7a84 100644 --- a/src/main/java/com/github/ucchyocean/lc/command/LogCommand.java +++ b/src/main/java/com/github/ucchyocean/lc/command/LogCommand.java @@ -122,7 +122,8 @@ public class LogCommand extends SubCommandAbst { } // 参照権限を確認する - if (!sender.hasPermission(PERMISSION_NODE + "." + cname)) { + String node = PERMISSION_NODE + "." + cname; + if (sender.isPermissionSet(node) && !sender.hasPermission(node)) { sendResourceMessage(sender, PREERR, "errmsgPermission", PERMISSION_NODE + "." + cname); return true; diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a4adfad..61c0082 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -65,15 +65,9 @@ permissions: lunachat.join: description: joinコマンドの使用権限 default: true - lunachat.join.*: - description: joinコマンドの使用権限 - default: true lunachat.leave: description: leaveコマンドの使用権限 default: true - lunachat.leave.*: - description: leaveコマンドの使用権限 - default: true lunachat.list: description: listコマンドの使用権限 default: true @@ -113,9 +107,6 @@ permissions: lunachat.log: description: logコマンドの使用権限 default: true - lunachat.log.*: - description: logコマンドの使用権限 - default: true lunachat.create: description: createコマンドの使用権限 default: true @@ -146,15 +137,10 @@ permissions: lunachat.allowcc: description: チャットにおけるカラーコードの使用権限 default: true - lunachat.speak.*: - description: チャンネルにおける発言権限 - default: true lunachat.*: children: lunachat.join: true - lunachat.join.*: true lunachat.leave: true - lunachat.leave.*: true lunachat.list: true lunachat.invite: true lunachat.accept: true @@ -168,7 +154,6 @@ permissions: lunachat.unhide: true lunachat.info: true lunachat.log: true - lunachat.log.*: true lunachat.create: true lunachat.remove: true lunachat.format: true @@ -179,7 +164,6 @@ permissions: lunachat.help: true lunachat.japanize: true lunachat.allowcc: true - lunachat.speak.*: true description: 一般ユーザー向けの全コマンドの使用権限 lunachat.option.description: