[+] 很多改进

1. 添加了更多中文翻译
2. 将/qq的功能分成了/qq和/qq-admin两个指令
3. 将权限组的更改进行应用
4. 现在会优先读取群名片了
This commit is contained in:
2019-07-10 20:58:47 +08:00
parent 6bc37c5329
commit ba8869df5c
8 changed files with 77 additions and 40 deletions

View File

@@ -1,15 +1,13 @@
package ren.taske.nativebot.minecraft.command;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import cn.glycol.t18n.I18n;
import ren.taske.data.util.ParseUtil;
import ren.taske.nativebot.MinecraftPlugin;
import ren.taske.nativebot.commons.Reference;
import ren.taske.nativebot.core.profile.UserMinecraft;
import ren.taske.nativebot.core.profile.UserTencent;
public class CommandQQ implements CommandExecutor {
@@ -28,30 +26,14 @@ public class CommandQQ implements CommandExecutor {
if(qqid != null) {
if(um.getTencentId() == -1L) {
um.setTencentId(qqid);
sender.sendMessage("Your Tencent userid now is " + qqid);
sender.sendMessage(I18n.format("command.qq.done", qqid));
} else {
sender.sendMessage("You have set your Tencent userid!");
sender.sendMessage(I18n.format("command.qq.undone", um.getTencentId()));
}
return true;
}
}
if(args.length == 2) {
UserMinecraft um = UserMinecraft.of(args[1]);
UserTencent ut = UserTencent.of(um.getTencentId());
Long qqid = ParseUtil.parseLong(args[0]);
if(ut.hasPermission(Reference.NODE_OP)) {
if(qqid != null) {
um.setTencentId(qqid);
sender.sendMessage(ChatColor.GOLD+um.getUserId()+ChatColor.RESET+"'s Tencent userid now is "+qqid);
}
} else {
sender.sendMessage("You have no permission!");
}
return true;
}
return false;
}

View File

@@ -0,0 +1,31 @@
package ren.taske.nativebot.minecraft.command;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import cn.glycol.t18n.I18n;
import ren.taske.data.util.ParseUtil;
import ren.taske.nativebot.core.profile.UserMinecraft;
public class CommandQQAdmin implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 2) {
Long qqid = ParseUtil.parseLong(args[0]);
if(qqid != null) {
UserMinecraft oped = UserMinecraft.of(args[1]);
oped.setTencentId(qqid);
sender.sendMessage(I18n.format("command.qq-admin.done", oped.getUserId(), oped.getTencentId()));
return true;
}
}
return false;
}
}