Fix
This commit is contained in:
parent
ddbb6d8211
commit
6b9c75353c
9 changed files with 3 additions and 3 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
build/libs/GrimmsServer-1.jar
Normal file
BIN
build/libs/GrimmsServer-1.jar
Normal file
Binary file not shown.
Binary file not shown.
|
|
@ -15,16 +15,16 @@ public class BuyItem implements CommandExecutor {
|
|||
sender.sendMessage("Usage: /buy <item> <amount>");
|
||||
return false;
|
||||
}
|
||||
if(Material.matchMaterial(args[0].toLowerCase()) == null){
|
||||
if(Material.matchMaterial(args[0]) == null){
|
||||
sender.sendMessage("Invalid item id:" + args[0]);
|
||||
return false;
|
||||
}
|
||||
Market market = Market.getMarket();
|
||||
if(market.items.get(args[0]) >= Integer.parseInt(args[1])){
|
||||
if(market.items.get(Material.matchMaterial(args[0]).getKey().toString()) <= Integer.parseInt(args[1])){
|
||||
sender.sendMessage("Not enough stock of " + args[0] + " in the market.");
|
||||
return false;
|
||||
}
|
||||
double bought = market.buy(Material.matchMaterial(args[0].toLowerCase()), Integer.parseInt(args[1]), (Player) sender);
|
||||
double bought = market.buy(Material.matchMaterial(args[0]), Integer.parseInt(args[1]), (Player) sender);
|
||||
market.saveMarket();
|
||||
sender.sendMessage("You bought " + args[1] + " many of " + args[0] + " for " + Math.max(0.25D,Math.round((bought))));
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue