Skip to content

Commit

Permalink
Added the ability to enter specific sections with the shop command
Browse files Browse the repository at this point in the history
+ Added the ability to enter specific sections with the shop command using /shop <shop-section>
  • Loading branch information
noahbclarkson committed Nov 22, 2020
1 parent 211e7a2 commit 72974cc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Auto-Tune/src/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ commands:
usage: /<trade>
shop:
description: GUIShop alias for buy and sell commands.
usage: /<shop>
usage: /<shop> <shop-section>
sell:
description: Sell items quickly to the shop.
usage: /<sell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,26 @@ public boolean onCommand(CommandSender sender, Command command, String shop, Str
else if (!(p.hasPermission("at.shop")) && !(p.isOp())){TextHandler.noPermssion(p);}
return true;
}
if (args.length > 0){
if (args.length == 1){
String inputSection = null;
try{
inputSection = args[0];
}
catch(ClassCastException ex){
p.sendMessage("Unknown shop format: " + args[0]);
return false;
}
catch(ArrayIndexOutOfBoundsException ex){
return false;
}
for (int i = 0; i < Main.sectionedItems.length; i++){
if (Main.sectionedItems[i].name.toLowerCase().equals(inputSection)){
loadGUIMAIN(p, sender, Main.sectionedItems[i]);
return true;
}
}
}
else{
return false;
}
}
Expand Down

0 comments on commit 72974cc

Please sign in to comment.