Skip to content

Commit

Permalink
Remove flag support for /prune, also updates the documentation
Browse files Browse the repository at this point in the history
Still need a better solution for the lack of hastebin
  • Loading branch information
BlaneyXYZ committed Dec 5, 2023
1 parent 3290fcf commit fe57a65
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/commands/prune.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ command:
permissions:
- rcmds.prune
supports: {}
usage: /prune -[time,t] [time]
usage: /prune [time]
layout: command
title: /prune
---
---
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,18 @@
@ReflectCommand
public class CmdPrune extends CACommand {

private final Flag<String> timeFlag = new Flag<>(String.class, "time", "t");

public CmdPrune(final RoyalCommands instance, final String name) {
super(instance, name, true);
this.addExpectedFlag(this.timeFlag);
}

@Override
protected boolean runCommand(final CommandSender cs, final Command cmd, final String label, final String[] eargs, final CommandArguments ca) {
if (!ca.hasContentFlag(this.timeFlag)) {
cs.sendMessage(MessageColor.NEGATIVE + "You must include a time (-[t,time]) flag.");
if (eargs.length < 1) {
cs.sendMessage(MessageColor.NEGATIVE + "You must include a time");
return true;
}
final Date dateStarted = new Date();
final long since = RUtils.timeFormatToSeconds(ca.getFlag(this.timeFlag).getValue()) * 1000L;
final long since = RUtils.timeFormatToSeconds(eargs[0]) * 1000L;
final File userdataDirectory = new File(this.plugin.getDataFolder(), "userdata");
if (!userdataDirectory.isDirectory()) {
cs.sendMessage(MessageColor.NEGATIVE + "The userdata location is not a directory!");
Expand Down
2 changes: 1 addition & 1 deletion modules/RoyalCommands/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ reflectcommands:
- pruneuserdata
class: CmdPrune
description: Prunes old userdata.
usage: '/<command> -[time,t] [time]'
usage: '/<command> [time]'
version_added: 4.1.0
publicassign:
aliases:
Expand Down

0 comments on commit fe57a65

Please sign in to comment.