mirror of
https://github.com/geekfrog/PermissionsTime.git
synced 2025-09-06 11:06:58 +00:00
fix bugs
This commit is contained in:
@ -9,14 +9,19 @@ import gg.frog.mc.permissionstime.config.PackagesCfg;
|
||||
import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||
import gg.frog.mc.permissionstime.utils.PluginUtil;
|
||||
import gg.frog.mc.permissionstime.utils.StrUtil;
|
||||
|
||||
public class GiveCmd {
|
||||
|
||||
private static SqlManager sm = PluginMain.sm;
|
||||
private PluginMain pm;
|
||||
private SqlManager sm;
|
||||
|
||||
public static boolean onCommand(CommandSender sender, boolean isPlayer, String[] args) {
|
||||
public GiveCmd(PluginMain pm) {
|
||||
this.pm = pm;
|
||||
this.sm = pm.getSqlManager();
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, boolean isPlayer, String[] args) {
|
||||
if (args.length == 4) {
|
||||
String playerName = args[1];
|
||||
String packageName = args[2];
|
||||
@ -34,21 +39,21 @@ public class GiveCmd {
|
||||
}
|
||||
PermissionPackageBean pack = PackagesCfg.PACKAGES.get(packageName);
|
||||
if (pack != null) {
|
||||
UUID uuid = PluginUtil.getPlayerUUIDByName(playerName);
|
||||
UUID uuid = pm.getPlayerUUIDByName(playerName);
|
||||
if (uuid != null) {
|
||||
if (PluginCfg.IS_DEBUG) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + uuid.toString() + "\n" + pack.toString() + "\n" + time + "天"));
|
||||
}
|
||||
if (sm.giveTime(uuid.toString(), packageName, days)) {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "给予玩家{0} {1}天的{2}", playerName, time, pack.getDisplayName()));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "给予玩家 {0} {1}天的 {2}", playerName, time, pack.getDisplayName()));
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "未给予玩家{0} {1}天的{2}", playerName, time, pack.getDisplayName()));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "未给予玩家 {0} {1}天的 {2}", playerName, time, pack.getDisplayName()));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为'{0}'的玩家", playerName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为''{0}''的玩家", playerName));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为'{0}'的权限包", packageName));
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "找不到名为''{0}''的权限包", packageName));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "参数不正确"));
|
||||
|
Reference in New Issue
Block a user