Skip to content

Commit

Permalink
User need to confirm when use command cleardata
Browse files Browse the repository at this point in the history
  • Loading branch information
JWJUN233233 committed Jan 20, 2024
1 parent 3bb0537 commit a5cc4ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ClearDataCommand(Slimefun plugin, SlimefunCommand cmd) {
@Override
public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) {
if (sender.hasPermission("slimefun.command.cleardata") || sender instanceof ConsoleCommandSender) {
if (args.length == 3) {
if (args.length == 4 && args[3].equalsIgnoreCase("confirm")) {
String arg1 = args[1];
String arg2 = args[2];
List<World> worlds = new ArrayList<>();
Expand Down Expand Up @@ -83,6 +83,10 @@ public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) {
}
}
}
else if (args.length == 3){
Slimefun.getLocalization().sendMessage(sender, "commands.cleardata.confirm", true);
return;
}
Slimefun.getLocalization()
.sendMessage(
sender,
Expand All @@ -93,9 +97,10 @@ public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) {
Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
}

@Nonnull
@Override
public String getDescription(){
public String getDescription() {
return "commands.cleardata.description";
}
}
1 change: 1 addition & 0 deletions src/main/resources/languages/zh-CN/messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ commands:
block: 方块
oil: 石油
worldNotFound: '&c未找到世界'
confirm: '&e 输入命令/sf cleardata <World> <Type> confirm 来确认操作 %c此操作不可恢复!'
banitem:
description: 禁用 Slimefun 物品
success: '&a禁用成功'
Expand Down

0 comments on commit a5cc4ee

Please sign in to comment.