add customization for filter click inputs, closes #17

Took 8 minutes
This commit is contained in:
Kiran Hart 2022-11-16 20:27:18 -05:00
parent f3fa5bb396
commit cbe6d43664
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
2 changed files with 98 additions and 40 deletions

View File

@ -571,27 +571,31 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
if (Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_ENABLED.getBoolean()) { if (Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_ENABLED.getBoolean()) {
setButton(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_SLOT.getInt(), item, e -> { setButton(Settings.GUI_AUCTION_HOUSE_ITEMS_FILTER_MENU_SLOT.getInt(), item, e -> {
switch (e.clickType) { if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_CATEGORY.getString().toUpperCase())) {
case LEFT:
e.manager.showGUI(e.player, new GUIFilterSelection(this.auctionPlayer)); e.manager.showGUI(e.player, new GUIFilterSelection(this.auctionPlayer));
break; return;
case DROP: }
if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_RESET.getString().toUpperCase())) {
this.auctionPlayer.resetFilter(); this.auctionPlayer.resetFilter();
updatePlayerFilter(this.auctionPlayer); updatePlayerFilter(this.auctionPlayer);
draw(); draw();
break; return;
case RIGHT: }
if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_SORT_SALE_TYPE.getString().toUpperCase())) {
if (Settings.ALLOW_USAGE_OF_BID_SYSTEM.getBoolean()) { if (Settings.ALLOW_USAGE_OF_BID_SYSTEM.getBoolean()) {
this.auctionPlayer.setSelectedSaleType(this.auctionPlayer.getSelectedSaleType().next()); this.auctionPlayer.setSelectedSaleType(this.auctionPlayer.getSelectedSaleType().next());
updatePlayerFilter(this.auctionPlayer); updatePlayerFilter(this.auctionPlayer);
draw(); draw();
} }
break; return;
case SHIFT_RIGHT: }
if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_SORT_PRICE_OR_RECENT.getString().toUpperCase())) {
this.auctionPlayer.setAuctionSortType(this.auctionPlayer.getAuctionSortType().next()); this.auctionPlayer.setAuctionSortType(this.auctionPlayer.getAuctionSortType().next());
updatePlayerFilter(this.auctionPlayer); updatePlayerFilter(this.auctionPlayer);
draw(); draw();
break;
} }
}); });
} }
@ -604,29 +608,33 @@ public class GUIAuctionHouse extends AbstractPlaceholderGui {
put("%filter_auction_type%", auctionPlayer.getSelectedSaleType().getTranslatedType()); put("%filter_auction_type%", auctionPlayer.getSelectedSaleType().getTranslatedType());
put("%filter_sort_order%", auctionPlayer.getAuctionSortType().getTranslatedType()); put("%filter_sort_order%", auctionPlayer.getAuctionSortType().getTranslatedType());
}}), e -> { }}), e -> {
switch (e.clickType) {
case DROP: if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_CATEGORY.getString().toUpperCase())) {
this.auctionPlayer.resetFilter();
updatePlayerFilter(this.auctionPlayer);
draw();
break;
case LEFT:
this.auctionPlayer.setSelectedFilter(this.auctionPlayer.getSelectedFilter().next()); this.auctionPlayer.setSelectedFilter(this.auctionPlayer.getSelectedFilter().next());
updatePlayerFilter(this.auctionPlayer); updatePlayerFilter(this.auctionPlayer);
draw(); draw();
break; }
case RIGHT:
if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_RESET.getString().toUpperCase())) {
this.auctionPlayer.resetFilter();
updatePlayerFilter(this.auctionPlayer);
draw();
return;
}
if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_SORT_SALE_TYPE.getString().toUpperCase())) {
if (Settings.ALLOW_USAGE_OF_BID_SYSTEM.getBoolean()) { if (Settings.ALLOW_USAGE_OF_BID_SYSTEM.getBoolean()) {
this.auctionPlayer.setSelectedSaleType(this.auctionPlayer.getSelectedSaleType().next()); this.auctionPlayer.setSelectedSaleType(this.auctionPlayer.getSelectedSaleType().next());
updatePlayerFilter(this.auctionPlayer); updatePlayerFilter(this.auctionPlayer);
draw(); draw();
} }
break; return;
case SHIFT_RIGHT: }
if (e.clickType == ClickType.valueOf(Settings.CLICKS_FILTER_SORT_PRICE_OR_RECENT.getString().toUpperCase())) {
this.auctionPlayer.setAuctionSortType(this.auctionPlayer.getAuctionSortType().next()); this.auctionPlayer.setAuctionSortType(this.auctionPlayer.getAuctionSortType().next());
updatePlayerFilter(this.auctionPlayer); updatePlayerFilter(this.auctionPlayer);
draw(); draw();
break;
} }
}); });
} }

View File

@ -237,6 +237,56 @@ public class Settings {
"&cIf you overlap click types (ex. LEFT for both inspect and buy) things will go crazy." "&cIf you overlap click types (ex. LEFT for both inspect and buy) things will go crazy."
); );
public static final ConfigSetting CLICKS_FILTER_SORT_PRICE_OR_RECENT = new ConfigSetting(config, "auction setting.clicks.filter.sort by price or recent", "SHIFT_RIGHT",
"Valid Click Types",
"LEFT",
"RIGHT",
"SHIFT_LEFT",
"SHIFT_RIGHT",
"MIDDLE",
"DROP",
"",
"&cIf you overlap click types (ex. LEFT for both inspect and buy) things will go crazy."
);
public static final ConfigSetting CLICKS_FILTER_SORT_SALE_TYPE = new ConfigSetting(config, "auction setting.clicks.filter.sort sale type", "RIGHT",
"Valid Click Types",
"LEFT",
"RIGHT",
"SHIFT_LEFT",
"SHIFT_RIGHT",
"MIDDLE",
"DROP",
"",
"&cIf you overlap click types (ex. LEFT for both inspect and buy) things will go crazy."
);
public static final ConfigSetting CLICKS_FILTER_RESET = new ConfigSetting(config, "auction setting.clicks.filter.reset", "DROP",
"Valid Click Types",
"LEFT",
"RIGHT",
"SHIFT_LEFT",
"SHIFT_RIGHT",
"MIDDLE",
"DROP",
"",
"&cIf you overlap click types (ex. LEFT for both inspect and buy) things will go crazy."
);
public static final ConfigSetting CLICKS_FILTER_CATEGORY= new ConfigSetting(config, "auction setting.clicks.filter.change category", "LEFT",
"Valid Click Types",
"LEFT",
"RIGHT",
"SHIFT_LEFT",
"SHIFT_RIGHT",
"MIDDLE",
"DROP",
"",
"&cIf you overlap click types (ex. LEFT for both inspect and buy) things will go crazy."
);
/* =============================== /* ===============================
* DATABASE OPTIONS * DATABASE OPTIONS
* ===============================*/ * ===============================*/