reload command, fixed issue where command syntax

This commit is contained in:
Kiran Hart 2021-04-09 17:47:46 -04:00
parent 9d814ee686
commit e132e67d27
4 changed files with 55 additions and 6 deletions

View File

@ -6,7 +6,7 @@
<groupId>ca.tweetzy</groupId>
<artifactId>auctionhouse</artifactId>
<version>2.0.1</version>
<version>2.1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -106,7 +106,8 @@ public class AuctionHouse extends TweetyPlugin {
new CommandTransactions(),
new CommandSearch(),
new CommandSettings(),
new CommandConvert()
new CommandConvert(),
new CommandReload()
);
// start the auction tick task
@ -128,10 +129,8 @@ public class AuctionHouse extends TweetyPlugin {
@Override
public void onConfigReload() {
}
@Override
public void reloadConfig() {
Settings.setup();
setLocale(Settings.LANG.getString(), true);
}
@Override

View File

@ -0,0 +1,48 @@
package ca.tweetzy.auctionhouse.commands;
import ca.tweetzy.auctionhouse.AuctionHouse;
import ca.tweetzy.core.commands.AbstractCommand;
import ca.tweetzy.core.utils.TextUtils;
import org.bukkit.command.CommandSender;
import java.util.List;
/**
* The current file has been created by Kiran Hart
* Date Created: April 09 2021
* Time Created: 5:40 p.m.
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
*/
public class CommandReload extends AbstractCommand {
public CommandReload() {
super(CommandType.CONSOLE_OK, "reload");
}
@Override
protected ReturnType runCommand(CommandSender sender, String... args) {
AuctionHouse.getInstance().reloadConfig();
AuctionHouse.getInstance().getLocale().newMessage(TextUtils.formatText("&aReloaded files")).sendPrefixedMessage(sender);
return ReturnType.SUCCESS;
}
@Override
protected List<String> onTab(CommandSender sender, String... args) {
return null;
}
@Override
public String getPermissionNode() {
return "auctionhouse.cmds.reload";
}
@Override
public String getSyntax() {
return "reload";
}
@Override
public String getDescription() {
return "Reload plugin files";
}
}

View File

@ -130,6 +130,8 @@ public class CommandSell extends AbstractCommand {
} else {
// they want to use the bidding system, so make it a bid item
if (args.length != 3) return ReturnType.SYNTAX_ERROR;
if (!NumberUtils.isDouble(args[0])) {
AuctionHouse.getInstance().getLocale().getMessage("general.notanumber").processPlaceholder("value", args[0]).sendPrefixedMessage(player);
return ReturnType.SYNTAX_ERROR;