Skip to content

Commit

Permalink
Show /bm help info when providing invalid arguments to /bm
Browse files Browse the repository at this point in the history
  • Loading branch information
jyhsu2000 committed Feb 20, 2024
1 parent 827c50e commit 0b84eee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,7 @@
- Update Spigot API to 1.20.1
- Update Java compile target version to 17
- Stop providing technical support for legacy Spigot (prior to Spigot 1.20)
- Show `/bm help` info when providing invalid arguments to `/bm`
- [Experimental] Add `/bm view` command for banner sharing

## v2.3.2 (for 1.17.x)
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-tw.md
Expand Up @@ -6,6 +6,7 @@
- 更新 Spigot API 至 1.20.1
- 更新 Java 編譯目標版本至 17
- 停止為舊版 Spigot 提供技術支援(1.20 之前的版本)
- 當使用 `/bm`,但參數無效時,顯示 `/bm help` 的資訊
- 【實驗性功能】新增 `/bm view` 指令,用於分享旗幟


Expand Down
Expand Up @@ -3,6 +3,7 @@
import club.kid7.bannermaker.BannerMaker;
import club.kid7.bannermaker.customMenu.MainMenu;
import club.kid7.pluginutilities.command.CommandComponent;
import club.kid7.pluginutilities.command.exception.CommandExecuteException;
import club.kid7.pluginutilities.gui.CustomGUIManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -31,7 +32,11 @@ public BannerMakerCommand(BannerMaker bm) {


@Override
public boolean executeCommand(CommandSender sender, Command cmd, String label, String[] args) {
public boolean executeCommand(CommandSender sender, Command cmd, String label, String[] args) throws CommandExecuteException {
if (args.length > 0) {
// 無效指令,顯示 help
return getSubCommands().get("help").executeCommand(sender, cmd, label, args);
}
Player player = (Player) sender;
//開啟選單
CustomGUIManager.openPrevious(player, MainMenu.class);
Expand Down

0 comments on commit 0b84eee

Please sign in to comment.