Skip to content

Commit

Permalink
增加检查受插件状态的功能
Browse files Browse the repository at this point in the history
  • Loading branch information
stevei5mc committed Aug 28, 2024
1 parent 2d77c2f commit 3312eab
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
|:-:|:-:|:-:|:-:|
|/newtipsariables|newtipsariables.admin|主命令|OP|
|/newtipsariables reload|newtipsariables.admin.reload|重载配置文件|OP|
|/newtipsariables checkstatus|newtipsariables.admin.checkstate|检查插件状态|OP|
### **变量介绍文档**
- **[文字相关变量][i2]**
- **[玩家相关变量][i3]**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cn.stevei5mc.NewTipsVariables.command;

import cn.stevei5mc.NewTipsVariables.command.sub.ReloadCommand;
import cn.stevei5mc.NewTipsVariables.command.sub.CheckStateCommand;
import cn.nukkit.Player;
import cn.nukkit.command.CommandSender;

Expand All @@ -13,12 +14,14 @@ public NewTipsVariablesCommand() {
super("NewTipsVariables", "NewTipsVariables 命令");
this.setPermission("newtipsariables.admin");
this.addSubCommand(new ReloadCommand("reload"));
this.addSubCommand(new CheckStateCommand("checkstatus"));
this.loadCommandBase();
}

@Override
public void sendHelp(CommandSender sender) {
sender.sendMessage("§b=== NewTipsVariables ===");
sender.sendMessage("§a/newtipsariables reload §e重载配置文件");
sender.sendMessage("§a/newtipsariables checkstatus §e检查插件的状态");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package cn.stevei5mc.NewTipsVariables.command.sub;

import cn.stevei5mc.NewTipsVariables.command.BaseSubCommand;
import cn.nukkit.command.CommandSender;
import cn.nukkit.command.data.CommandParameter;
import cn.stevei5mc.NewTipsVariables.utils.PluginsState;

/**
* @author LT_Name
*/
public class CheckStateCommand extends BaseSubCommand {

public CheckStateCommand(String name) {
super(name);
}

@Override
public boolean canUser(CommandSender sender) {
return sender.hasPermission("newtipsariables.admin.checkstate");
}

@Override
public String[] getAliases() {
return new String[0];
}

@Override
public boolean execute(CommandSender sender, String label, String[] args) {
PluginsState ps = PluginsState.getInstance();
sender.sendMessage("Plugins status");
sender.sendMessage("playerPoints plugin = " + ps.playerPoints);
sender.sendMessage("EconomyAPI status = " + ps.economyAPI);
sender.sendMessage("OreArea status = " + ps.oreArea);
sender.sendMessage("RSTask status = " + ps.rSTask);
sender.sendMessage("HealthAPI status = " + ps.healthAPI);
sender.sendMessage("LevelAwakenSystem status = " + ps.levelAwakenSystem);
sender.sendMessage("RSWeapon status = " + ps.rSWeapon);
sender.sendMessage("LuckPerms status = " + ps.luckPerms);
return true;
}

@Override
public CommandParameter[] getParameters() {
return new CommandParameter[0];
}
}
5 changes: 4 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ permissions:
description: "NewTipsVariables插件管理员权限"
default: op
newtipsariables.admin.reload:
description: "NewTipsVariables插件重载权限"
description: "插件重载权限"
default: op
newtipsariables.admin.checkstate:
description: "检查插件状态"
default: op

1 comment on commit 3312eab

@stevei5mc
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更正
增加受支持插件的状态检查的功能

Please sign in to comment.