diff --git a/plugin.yml b/plugin.yml index 663038b..c6412b6 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,9 +1,9 @@ name: AuctionHouse main: shock95x\auctionhouse\AuctionHouse -version: 2.0.0-BETA1 +version: 2.0.0 api: 4.0.0 author: Shock95x -softdepend: [EconomyAPI] +softdepend: [InvCrashFix, EconomyAPI, BedrockEconomy] virions: ["InvMenu", "libasynql", "await-generator", "UpdateNotifier", "Commando"] permissions: auctionhouse.command.shop: diff --git a/resources/language/de_DE.yml b/resources/language/de_DE.yml index 585a20f..872e75c 100644 --- a/resources/language/de_DE.yml +++ b/resources/language/de_DE.yml @@ -15,16 +15,16 @@ manage-listing-name: "&l&eAngebote Verwalten" player-listing: "&6Angebote von &6{player}" # Chat messages -item-listed: "&2Du Bietest nun: &d@item &r&d(x@amount) &2für &d@price. Mit: /ah listings kannst du deine Angebote sehen" +item-listed: "&2Du Bietest nun: &d{ITEM} &r&d(x{AMOUNT}) &2für &d{PRICE}. Mit: /ah listings kannst du deine Angebote sehen" cancelled-item: "&eDu hast das Angebot &6abbgerochen&e.Hole dir Ausgelaufende Items und Abbgebrochende Angebot Items bei:&6/ah expired&e." cancelled-purchase: "&cDu hast den Kauf abgebrochen!" -purchased-item: "&2Du hast &d@item &r&d(x@amount) &2für &d@price gekauft" #@player, @item, @price, @amount -seller-message: "&e@player &bhat @item (x@amount) von dir für &d@price gekauft!" #@player, @item, @price, @amount -returned-item: "&2Du hast &d@item &r&d(x@amount) &2zurückgezogen." #@item, @amount +purchased-item: "&2Du hast &d{ITEM} &r&d(x{AMOUNT}) &2für &d{PRICE} gekauft" #{PLAYER}, {ITEM}, {PRICE}, {AMOUNT} +seller-message: "&e{PLAYER} &bhat {ITEM} (x{AMOUNT}) von dir für &d{PRICE} gekauft!" #{PLAYER}, {ITEM}, {PRICE}, {AMOUNT} +returned-item: "&2Du hast &d{ITEM} &r&d(x{AMOUNT}) &2zurückgezogen." #{ITEM}, {AMOUNT} # Error messages in-creative: "&cDu kannst nur sachen im survival modus Verkaufen &6[/gamemode 0]." -max-listings: "&cDu kannst nicht mehr als @max Angebote haben." #@max +max-listings: "&cDu kannst nicht mehr als {MAX} Angebote haben." #{MAX} invalid-price: "&cUngültiger Preis." not-enough-space: "Du hast kein platzt in deinen Inventar" self-purchase: "&cDu kannst nicht deine eigenen Angebote Kaufen!" @@ -33,56 +33,56 @@ cannot-afford: "&6Du hast nicht genug Geld um dir das zu Kaufen." item-blacklisted: "&cDas Item darfst du nicht verkaufen!" invalid-balance: "&cDu hast nicht genug Geld um das Item zum Verkauf Anzubieten." listing-gone: "&cDas Angebot existiert nichtmehr." -price-range: "&cZu großer/zu kleiner Preis" #@min, @max -# in-cooldown: "&cYou are currently in cooldown, please wait &b@M minute(s) &cand &b@S second(s)&c." #@M, @S +price-range: "&cZu großer/zu kleiner Preis" #{MIN}, {MAX} +# in-cooldown: "&cYou are currently in cooldown, please wait &b{M} minute(s) &cand &b{S} second(s)&c." #{M}, {S} player-not-found: "&cDieser Spieler hat keine aktive Angebote." player-listings-usage: "&cMit /ah listings kannst du deine Angebote ansehen" # Items in the menu UI listed-item: - # %price% = Price of listing - # %seller% = Username of seller + # {PRICE} = Price of listing + # {SELLER} = Username of seller # {H} = Hours | {M} = Minutes - "&7-------------------------" - "&aKlicke hier um es zu Kaufen." - "" - - "&9Preis: &e%price%" - - "&9Verkäufer: &e%seller%" + - "&9Preis: &e{PRICE}" + - "&9Verkäufer: &e{SELLER}" - "&9Läuft aus in: &e{H}:{M} Stunden" - "&7-------------------------" your-listed-item: - # %price% = Price of listing + # {PRICE} = Price of listing # {H} = Hours | {M} = Minutes - "&7-------------------------" - "&cKlick hier um das Angebot zu schließen." - "" - - "&9Preis: &e%price%" + - "&9Preis: &e{PRICE}" - "&9Läuft aus in: &e{H}:{M} Stunden" - "&7-------------------------" expired-item: - # %price% = Price of listing + # {PRICE} = Price of listing - "&7-------------------------" - "&aKlicke um das Item Abzuholen." - "" - "" - - "&9Preis: &e%price%$" + - "&9Preis: &e{PRICE}$" - "&7-------------------------" view-listed-items: - # %selling% = Number of active listings + # {SELLING} = Number of active listings name: "&6Items die du Verkaufst:" lore: - "&aKlicke hier um eine liste deiner Items zu sehen" - "&aDie du Verkaufst." - "" - - "&9Verkauft: &e%selling%" + - "&9Verkauft: &e{SELLING}" view-expired-items: - # %expired% = Number of Expired / Cancelled Items + # {EXPIRED} = Number of Expired / Cancelled Items name: "&6Abholen: Abgelaufender/Abbgebrochende Angebote" lore: - "&r&aKlicke um eine list der Abgelaufenden Items zu erhalten und einzusammeln" - "&aItems die Abgelaufenoder abbgebrochen wurden." - "" - - "&9Items zum einsammeln: &e%expired%" + - "&9Items zum einsammeln: &e{EXPIRED}" # Admin Menu view-admin-menu: @@ -90,26 +90,26 @@ view-admin-menu: lore: - "&r&aKlickt hier, um das Admin-Menü anzuzeigen" main-stats-admin: - # %page% = Current page - # %max% = Max page - # %expired% = Expired listing count - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {EXPIRED} = Expired listing count + # {TOTAL} = Total listing count name: "&l&cAdmin-Menü" lore: - - "&aSeite %page%/%max%" - - "&7Insgesamt &b%total% &7Angebote" - - "&c(&b%expired% &cabgelaufene Angebote)" + - "&aSeite {PAGE}/{MAX}" + - "&7Insgesamt &b{TOTAL} &7Angebote" + - "&c(&b{EXPIRED} &cabgelaufene Angebote)" - "Klickt hier zum Aktualisieren der Seite" listed-item-admin: - # %price% = Price of listing - # %seller% = Username of seller - # %status% = Status of the listing (Active/Expired) + # {PRICE} = Price of listing + # {SELLER} = Username of seller + # {STATUS} = Status of the listing (Active/Expired) - "&7-------------------------" - "&6Klickt hier um das Angebot zu bearbeiten" - "" - - "&9Preis: &e%price%" - - "&9Verkäufer: &e%seller%" - - "&9Status: %status%" + - "&9Preis: &e{PRICE}" + - "&9Verkäufer: &e{SELLER}" + - "&9Status: {STATUS}" - "&7-------------------------" status-active: "&aAktiv" @@ -149,13 +149,13 @@ main-description: - "&aAnzubieten und geld zu verdienen" - "&adurch vielleicht Interresierte spieler." main-stats: - # %page% = Current page - # %max% = Max page - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count name: "&l&6Verkaufs Haus" lore: - - "&aSeite %page%/%max%" - - "&7Anzahl der Items; &b%total% &7" + - "&aSeite {PAGE}/{MAX}" + - "&7Anzahl der Items; &b{TOTAL} &7" - "Klicke um die seite neu zu Laden" listings-description: name: "&6Was ist das?" @@ -166,13 +166,13 @@ listings-description: - "&aDu kannst deine angebote hier abbrechen" - "&aund alle Items die Abgelaufen sind Einsammeln ." listings-stats: - # %page% = Current page - # %max% = Max page - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count name: "&l&6Liste" lore: - - "&aSeite %page%/%max%" - - "&7Items &b%total% &7" + - "&aSeite {PAGE}/{MAX}" + - "&7Items &b{TOTAL} &7" expired-description: name: "&6Was ist das?" lore: @@ -184,32 +184,32 @@ expired-description: - "&aKlicke einfach auf das Item wenn du" - "&agenug platz im inventar hast." expired-stats: - # %page% = Current page - # %max% = Max page - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count name: "&l&6Abgelaufen" lore: - - "&aSeite: %page%/%max%" - - "&7Anzahl der Items &b%total% &7" + - "&aSeite: {PAGE}/{MAX}" + - "&7Anzahl der Items &b{TOTAL} &7" # Category menu # category-stats: -# # %category% = Category -# # %page% = Current page -# # %max% = Max page -# # %total% = Total listing count -# name: "%category%" +# # {CATEGORY} = Category +# # {PAGE} = Current page +# # {MAX} = Max page +# # {TOTAL} = Total listing count +# name: "{CATEGORY}" # lore: -# - "&aPage %page%/%max%" -# - "&7Total of &b%total% &7listings" +# - "&aPage {PAGE}/{MAX}" +# - "&7Total of &b{TOTAL} &7listings" # category-list-stats: -# # %page% = Current page -# # %max% = Max page -# # %total% = Total listing count +# # {PAGE} = Current page +# # {MAX} = Max page +# # {TOTAL} = Total listing count # name: "&l&6Category Menu" # lore: -# - "&aPage %page%/%max%" -# - "&7Total of &b%total% &7categories" +# - "&aPage {PAGE}/{MAX}" +# - "&7Total of &b{TOTAL} &7categories" purchase-confirm: name: "&aKauf durchführen" @@ -218,7 +218,7 @@ purchase-cancel: purchase-item: lore: - "&7-------------------------" - - "&9Preis: &e$%price%" - - "&9Verkäufer: &e%seller%" + - "&9Preis: &e${PRICE}" + - "&9Verkäufer: &e{SELLER}" - "&7-------------------------" ... \ No newline at end of file diff --git a/resources/language/en_US.yml b/resources/language/en_US.yml index 938298e..f42e5d8 100644 --- a/resources/language/en_US.yml +++ b/resources/language/en_US.yml @@ -6,25 +6,25 @@ lang-version: 4 # AH Menu titles menu-name: "Auction House" -listings-menu-name: "&cActive Listings" +listings-menu-name: "&aActive Listings" expired-menu-name: "&cCancelled / Expired Listings" purchase-menu-name: "Confirm Purchase" admin-menu-name: "&l&cAdmin Menu" category-menu-name: "&6Category Menu" -manage-listing-name: "&eManage Listing" -player-listing: "&b{player}'s &6Listings" +manage-listing-name: "&6Manage Listing" +player-listing: "&b{PLAYER}'s &6Listings" # Chat messages -item-listed: "&2You have listed &d@item &r&d(x@amount) &2for &d@price. Type &e/ah listings &dto view all your listings" +item-listed: "&2You have listed &d{ITEM} &r&d(x{AMOUNT}) &2for &d{PRICE}. Type &e/ah listings &dto view all your listings" cancelled-item: "&eYou have &6cancelled &ean auction. Return cancelled and expired items at &6/ah expired&e." -cancelled-purchase: "&cYou have cancelled this purchase" -purchased-item: "&2You have bought &d@item &r&d(x@amount) &2for &d@price" #@player, @item, @price, @amount -seller-message: "&e@player &bpurchased @item (x@amount) from you for &d@price!" #@player, @item, @price, @amount -returned-item: "&2You have removed &d@item &r&d(x@amount) &2from the auction house." #@item, @amount +cancelled-purchase: "&cYou have cancelled this purchase" #{PLAYER}, {ITEM}, {PRICE}, {AMOUNT} +purchased-item: "&2You have bought &d{ITEM} &r&d(x{AMOUNT}) &2for &d{PRICE}" #{PLAYER}, {ITEM}, {PRICE}, {AMOUNT} +seller-message: "&e{PLAYER} &bpurchased {ITEM} (x{AMOUNT}) from you for &d{PRICE}!" #{ITEM}, {AMOUNT} +returned-item: "&2You have removed &d{ITEM} &r&d(x{AMOUNT}) &2from the auction house." # Error messages in-creative: "&cYou cannot sell items while in creative mode." -max-listings: "&cYou cannot have more than @max active listings." #@max +max-listings: "&cYou cannot have more than {MAX} active listings." invalid-price: "&cInvalid price." not-enough-space: "&cYou do not have enough inventory space to buy this item" self-purchase: "&cYou cannot buy your own items on the auction house!" @@ -33,57 +33,58 @@ cannot-afford: "&cYou do not have enough money to buy this item." item-blacklisted: "&cThat item is not allowed to be put on the auction house!" invalid-balance: "&cYou do not have enough money to list an auction." listing-gone: "&cThis listing no longer exists." -price-range: "&cInvalid price range" #@min, @max -in-cooldown: "&cYou are currently in cooldown, please wait &b@M minute(s) &cand &b@S second(s)&c." #@M, @S +price-range: "&cInvalid price range" #{MIN}, {MAX} +in-cooldown: "&cYou are currently in cooldown, please wait &b{M} minute(s) &cand &b{S} second(s)&c." #{M}, {S} player-not-found: "&cThis player has no active listings." player-listings-usage: "&cView your listings with /ah listings" inventory-full: "&cYour inventory is full, remove some items to claim your listings." +purchase-economy-error: "&cCould not complete transaction." # Items in the menu UI listed-item: - # %price% = Price of listing - # %seller% = Username of seller + # {PRICE} = Price of listing + # {SELLER} = Username of seller # {D} = Days, {H} = Hours, {M} = Minutes - "&7-------------------------" - "&aClick here to purchase." - "" - - "&9Price: &e%price%" - - "&9Seller: &e%seller%" + - "&9Price: &e{PRICE}" + - "&9Seller: &e{SELLER}" - "&9Expire: &e{D}d {H}h {M}m" - "&7-------------------------" your-listed-item: - # %price% = Price of listing + # {PRICE} = Price of listing # {D} = Days, {H} = Hours, {M} = Minutes - "&7-------------------------" - "&cClick here to remove listing." - "" - - "&9Price: &e%price%" + - "&9Price: &e{PRICE}" - "&9Expire: &e{D}d {H}h {M}m" - "&7-------------------------" expired-item: - # %price% = Price of listing + # {PRICE} = Price of listing - "&7-------------------------" - "&aClick here to receive item." - "" - "" - - "&9Price: &e%price%" + - "&9Price: &e{PRICE}" - "&7-------------------------" view-listed-items: - # %selling% = Number of active listings + # {SELLING} = Number of active listings name: "&6Items you're selling" lore: - "&aClick here to view all of the items you" - "&aare currently selling on the auction." - "" - - "&9Selling: &e%selling%" + - "&9Selling: &e{SELLING}" view-expired-items: - # %expired% = Number of expired listings + # {EXPIRED} = Number of expired listings name: "&6Collect Expired / Cancelled Items" lore: - "&r&aClick here to view and collect all of the" - "&aitems you have cancelled or have expired." - "" - - "&9Items to collect: &e%expired%" + - "&9Items to collect: &e{EXPIRED}" # Admin Menu view-admin-menu: @@ -92,36 +93,42 @@ view-admin-menu: - "&r&aClick here to view the admin menu." #- "&aYou can remove specific items here." main-stats-admin: - # %page% = Current page - # %max% = Max page - # %expired% = Expired listing count - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {EXPIRED} = Expired listing count + # {TOTAL} = Total listing count name: "&l&cAdmin Menu" lore: - - "&aPage %page%/%max%" - - "&7Total of &b%total% &7items" - - "&c(&b%expired% &cexpired items)" + - "&aPage {PAGE}/{MAX}" + - "&7Total of &b{TOTAL} &7items" + - "&c(&b{EXPIRED} &cexpired items)" - "Click to refresh page" listed-item-admin: - # %price% = Price of listing - # %seller% = Username of seller - # %status% = Status of the listing (Active/Expired) + # {PRICE} = Price of listing + # {SELLER} = Username of seller + # {STATUS} = Listing status (Active/Expired) - "&7-------------------------" - - "&6Click here to edit listing." + - "&6Click here to manage listing." - "" - - "&9Price: &e%price%" - - "&9Seller: &e%seller%" - - "&9Status: %status%" + - "&9Price: &e{PRICE}" + - "&9Seller: &e{SELLER}" + - "&9Status: {STATUS}" - "&7-------------------------" status-active: "&aActive" status-expired: "&cExpired" -selected-listing-name: "&l&cManage Listing" +selected-listing-name: "&l&eManage Listing" -duplicate-item: "&aClick here to duplicate item to inventory" -listing-expired: "&eClick here to make listing &cexpired" -listing-active: "&eClick here to make listing &aactive" -delete-item: "&cClick here to delete item and listing" +#duplicate-item: "&aClick here to duplicate item to inventory" +#listing-expired: "&eClick here to make listing &cexpired" +#listing-active: "&eClick here to make listing &aactive" +#delete-item: "&cClick here to delete item and listing" + +duplicate-item: "&aAdd item to inventory" +listing-status: + - "Status: {STATUS}" + - "&6Change listing status" +delete-item: "&cDelete listing and item" # Pagination items previous-page: @@ -152,13 +159,13 @@ main-description: - "&amoney by selling farmable items other" - "&aplayers may be interested in buying." main-stats: - # %page% = Current page - # %max% = Max page - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count name: "&l&6Auction House" lore: - - "&aPage %page%/%max%" - - "&7Total of &b%total% &7items" + - "&aPage {PAGE}/{MAX}" + - "&7Total of &b{TOTAL} &7items" - "Click to refresh page" listings-description: name: "&6What is this Page?" @@ -170,13 +177,13 @@ listings-description: - "&aYou can cancel and view your listing's" - "&aexpire time here." listings-stats: - # %page% = Current page - # %max% = Max page - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count name: "&l&6Listings" lore: - - "&aPage %page%/%max%" - - "&7Total of &b%total% &7items" + - "&aPage {PAGE}/{MAX}" + - "&7Total of &b{TOTAL} &7items" expired-description: name: "&6What is this page?" lore: @@ -188,33 +195,33 @@ expired-description: - "&aJust click on the item and if you have enough" - "&ainventory space you will receive the item." expired-stats: - # %page% = Current page - # %max% = Max page - # %total% = Number of categories + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Number of categories name: "&l&6Expired" lore: - - "&aPage %page%/%max%" - - "&7Total of &b%total% &7items" + - "&aPage {PAGE}/{MAX}" + - "&7Total of &b{TOTAL} &7items" - "&3Click here to return all items" # Category menu category-stats: - # %category% = Category - # %page% = Current page - # %max% = Max page - # %total% = Total listing count - name: "%category%" - lore: - - "&aPage %page%/%max%" - - "&7Total of &b%total% &7listings" + # {CATEGORY} = Category + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count + name: "{CATEGORY}" + lore: + - "&aPage {PAGE}/{MAX}" + - "&7Total of &b{TOTAL} &7listings" category-list-stats: - # %page% = Current page - # %max% = Max page - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count name: "&l&6Category Menu" lore: - - "&aPage %page%/%max%" - - "&7Total of &b%total% &7categories" + - "&aPage {PAGE}/{MAX}" + - "&7Total of &b{TOTAL} &7categories" # Confirm purchase menu purchase-confirm: @@ -224,7 +231,7 @@ purchase-cancel: purchase-item: lore: - "&7-------------------------" - - "&9Price: &e%price%" - - "&9Seller: &e%seller%" + - "&9Price: &e{PRICE}" + - "&9Seller: &e{SELLER}" - "&7-------------------------" ... \ No newline at end of file diff --git a/resources/language/ru_RU.yml b/resources/language/ru_RU.yml index 90e86d0..080be02 100644 --- a/resources/language/ru_RU.yml +++ b/resources/language/ru_RU.yml @@ -12,16 +12,16 @@ purchase-menu-name: 'Подтвердите покупку' # player-listing: "&2{player}'s &6Listings" # Chat messages -item-listed: '&2Вы выставили &d@item &r&d(x@amount) &2 на продажу за &d@price. &eВведите /ah listings &dчтобы просмотреть все ваши товары' +item-listed: '&2Вы выставили &d{ITEM} &r&d(x{AMOUNT}) &2 на продажу за &d{PRICE}. &eВведите /ah listings &dчтобы просмотреть все ваши товары' cancelled-item: '&eВы &6сняли &eтовар с продажи. Чтобы вернуть предмет в инвентарь введите &6/ah expired&e.' cancelled-purchase: '&cВы отменили эту покупку' -purchased-item: '&2Вы купили &d@item &r&d(x@amount) &2за &d@price' #@player, @item, @price, @amount -seller-message: '&e@Игрок приобрел @item (x@amount) ваш предмет за &d@price!' #@player, @item, @price, @amount -returned-item: '&2Вы успешно сняли &d@item &r&d(x@amount) &2 с продажи.' #@item, @amount +purchased-item: '&2Вы купили &d{ITEM} &r&d(x{AMOUNT}) &2за &d{PRICE}' #{PLAYER}, {ITEM}, {PRICE}, {AMOUNT} +seller-message: '&e@Игрок приобрел {ITEM} (x{AMOUNT}) ваш предмет за &d{PRICE}!' #{PLAYER}, {ITEM}, {PRICE}, {AMOUNT} +returned-item: '&2Вы успешно сняли &d{ITEM} &r&d(x{AMOUNT}) &2 с продажи.' #{ITEM}, {AMOUNT} # Error messages in-creative: '&cВы не можете продавать предметы в творческом режиме.' -max-listings: '&cВы не можете иметь более @max активных товаров.' #@max +max-listings: '&cВы не можете иметь более {MAX} активных товаров.' #{MAX} invalid-price: '&cНеккоректная цена.' not-enough-space: 'Недостаточно места в инвентаре' self-purchase: '&cВы не можете купить свои предметы на аукционе!' @@ -30,50 +30,50 @@ cannot-afford: '&6У вас недостаточно денег, чтобы ку item-blacklisted: '&cЭтот предмет не может быть выставлен на аукцион!' invalid-balance: '&cУ вас недостаточно денег, чтобы выставить предмет на аукцион.' listing-gone: '&cЭтого товара больше не существует, вероятно его уже купили.' -# price-range: "&cInvalid price range" #@min, @max -# in-cooldown: "&cYou are currently in cooldown, please wait &b@M minute(s) &cand &b@S second(s)&c." #@M, @S -# in-cooldown: "&cYou are currently in cooldown, please wait &b@M minute(s) &cand &b@S second(s)&c." #@M, @S +# price-range: "&cInvalid price range" #{MIN}, {MAX} +# in-cooldown: "&cYou are currently in cooldown, please wait &b{M} minute(s) &cand &b{S} second(s)&c." #{M}, {S} +# in-cooldown: "&cYou are currently in cooldown, please wait &b{M} minute(s) &cand &b{S} second(s)&c." #{M}, {S} # player-not-found: "&cThis player has no active listings." # player-listings-usage: "&cView your listings with /ah listings" # inventory-full: "&cYour inventory is full, remove some items to claim your listings." # Items in the menu UI listed-item: - # %price% = Цена - # %seller% = Продавец + # {PRICE} = Цена + # {SELLER} = Продавец # {H} = Hours | {M} = Minutes - '&7-------------------------' - '&aНажмите, чтобы купить.' - '' - - '&9Цена: &e$%price%' - - '&9Продавец: &e%seller%' + - '&9Цена: &e${PRICE}' + - '&9Продавец: &e{SELLER}' - '&9Истекает через: &e{H}:{M}' - '&7-------------------------' your-listed-item: - # %price% = Цена товара + # {PRICE} = Цена товара # {H} = Hours | {M} = Minutes - '&7-------------------------' - '&cНажмите, чтобы отменить.' - '' - - '&9Цена: &e$%price%' + - '&9Цена: &e${PRICE}' - '&9Истекает через: &e{H}:{M}' - '&7-------------------------' view-listed-items: - # %selling% = Количество активных товаров + # {SELLING} = Количество активных товаров name: '&6Предметы, которые вы продаете' lore: - '&aНажмите здесь, чтобы просмотреть все предметы, которые вы' - '&aв данный момент продаете на аукционе.' - '' - - '&9Продажа: &e%selling%' + - '&9Продажа: &e{SELLING}' view-expired-items: - # %expired% = Количество истекших аукционов + # {EXPIRED} = Количество истекших аукционов name: '&6Забрать просроченные / удалённые предметы' lore: - '&r&aНажмите, чтобы просмотреть и собрать все' - '&aЭлементы, которые вы отменили или просрочели.' - '' - - '&9Предметы для сбора: &e%expired%' + - '&9Предметы для сбора: &e{EXPIRED}' # Admin Menu view-admin-menu: @@ -82,26 +82,26 @@ view-admin-menu: - '&r&aНажмите, чтобы перейти в админ-меню.' - '&aВ админ-меню вы можете удалить предметы с аукциона.' main-stats-admin: - # %page% = Текущая страница - # %max% = Всего страниц - # %expired% = Список истёкших предметов - # %total% = Всего предметов + # {PAGE} = Текущая страница + # {MAX} = Всего страниц + # {EXPIRED} = Список истёкших предметов + # {TOTAL} = Всего предметов name: '&l&cАдмин Меню' lore: - - '&aСтраница %page%/%max%' - - '&7Всего &b%total% &7предметов' - - '&c(&b%expired% &cистёкших)' + - '&aСтраница {PAGE}/{MAX}' + - '&7Всего &b{TOTAL} &7предметов' + - '&c(&b{EXPIRED} &cистёкших)' - 'Нажмите, чтобы перезагрузить страницу' listed-item-admin: - # %price% = Цена товара - # %seller% = Ник продавца - # %status% = Статус товара(Активное/Истёкшие) + # {PRICE} = Цена товара + # {SELLER} = Ник продавца + # {STATUS} = Статус товара(Активное/Истёкшие) - '&7-------------------------' - '&6Нажмите, чтобы отредактировать товар.' - '' - - '&9Цена: &e%price%' - - '&9Продавец: &e%seller%' - - '&9Статус: %status%' + - '&9Цена: &e{PRICE}' + - '&9Продавец: &e{SELLER}' + - '&9Статус: {STATUS}' - '&7-------------------------' status-active: '&aАктивное' @@ -140,13 +140,13 @@ main-description: - '&aденьги от продажи других товаров' - '&aигроки могут быть заинтересованы в покупке.' main-stats: - # %page% = Текущая страница - # %max% = Макс страница - # %total% = Общее количество товаров + # {PAGE} = Текущая страница + # {MAX} = Макс страница + # {TOTAL} = Общее количество товаров name: '&l&6Аукционный дом' lore: - - '&aСтраница %page%/%max%' - - '&7Всего &b%total% &7предметов' + - '&aСтраница {PAGE}/{MAX}' + - '&7Всего &b{TOTAL} &7предметов' - 'Нажмите, чтобы обновить страницу' listings-description: name: '&6Что это за страница?' @@ -157,13 +157,13 @@ listings-description: - '' - '&aВы можете отменить и просмотреть свои предметы' listings-stats: - # %page% = Текущая страница - # %max% = Последняя страница - # %total% = Общее количество товаров + # {PAGE} = Текущая страница + # {MAX} = Последняя страница + # {TOTAL} = Общее количество товаров name: '&l&6Товары на продаже' lore: - - '&aСтраница %page%/%max%' - - '&7Всего &b%total% &7предметов' + - '&aСтраница {PAGE}/{MAX}' + - '&7Всего &b{TOTAL} &7предметов' expired-description: name: '&6Что это за страница?' lore: @@ -175,32 +175,32 @@ expired-description: - '&aПросто нажмите на предмет, если у вас незаполнен' - '&aинвентар,то вы получите предмет.' expired-stats: - # %page% = Текущая страница - # %max% = Последняя страница - # %total% = Общее количество предметов + # {PAGE} = Текущая страница + # {MAX} = Последняя страница + # {TOTAL} = Общее количество предметов name: '&l&6Истекший' lore: - - '&aСтраница %page%/%max%' - - '&7Всего &b%total% &7предметов' + - '&aСтраница {PAGE}/{MAX}' + - '&7Всего &b{TOTAL} &7предметов' # Category menu category-stats: - # %category% = Категория - # %page% = Текущая страница - # %max% = Всего страниц - # %total% = Кол-во товаров - name: '%category%' - lore: - - '&aСтраница %page%/%max%' - - '&7Всего &b%total% &7listings товаров' + # {CATEGORY} = Категория + # {PAGE} = Текущая страница + # {MAX} = Всего страниц + # {TOTAL} = Кол-во товаров + name: '{CATEGORY}' + lore: + - '&aСтраница {PAGE}/{MAX}' + - '&7Всего &b{TOTAL} &7listings товаров' category-list-stats: - # %page% = Текущая страница - # %max% = Всего страниц - # %total% = Кол-во товаров + # {PAGE} = Текущая страница + # {MAX} = Всего страниц + # {TOTAL} = Кол-во товаров name: '&l&6Категории' lore: - - '&aСтраница %page%/%max%' - - '&7Всего &b%total% &7категорий' + - '&aСтраница {PAGE}/{MAX}' + - '&7Всего &b{TOTAL} &7категорий' purchase-confirm: name: '&aПодтвердите покупку' @@ -209,6 +209,6 @@ purchase-cancel: purchase-item: lore: - '&7-------------------------' - - '&9Цена: &e$%price%' - - '&9Продавец: &e%seller%' + - '&9Цена: &e${PRICE}' + - '&9Продавец: &e{SELLER}' - '&7-------------------------' diff --git a/resources/language/tr_TR.yml b/resources/language/tr_TR.yml index c6b8951..56d8efe 100644 --- a/resources/language/tr_TR.yml +++ b/resources/language/tr_TR.yml @@ -15,16 +15,16 @@ manage-listing-name: "&l&eListeyi Yönet" player-listing: "&b{player} Oyuncusunun &6Listesi" # Chat messages -item-listed: "&d@item &r&d(@amount)x &2için &d@priceTL&2 verdiniz. Tüm girişlerinizi görüntülemek için &e/ah listings &2komutunu girin" +item-listed: "&d{ITEM} &r&d({AMOUNT})x &2için &d{PRICE}TL&2 verdiniz. Tüm girişlerinizi görüntülemek için &e/ah listings &2komutunu girin" cancelled-item: "&eAçık artırmayı &6iptal ettiniz. &eİptal edilen ve süresi dolmuş ürünlerin iadesi &6/ah expired komutunu girin." cancelled-purchase: "&cBu satın alma işlemini iptal ettiniz" -purchased-item: "&2&d@item &r&d(@amount)x &2için &d@price TL'ye satın aldınız" #@player, @item, @price, @amount -seller-message: "&e@player &d@price TL karşılığında sizden @item (@amount)x satın aldı!" #@player, @item, @price, @amount -returned-item: "&d@item &d(@amount)x &2kadar müzayede evinden kaldırdınız." #@item, @amount +purchased-item: "&2&d{ITEM} &r&d({AMOUNT})x &2için &d{PRICE} TL'ye satın aldınız" #{PLAYER}, {ITEM}, {PRICE}, {AMOUNT} +seller-message: "&e{PLAYER} &d{PRICE} TL karşılığında sizden {ITEM} ({AMOUNT})x satın aldı!" #{PLAYER}, {ITEM}, {PRICE}, {AMOUNT} +returned-item: "&d{ITEM} &d({AMOUNT})x &2kadar müzayede evinden kaldırdınız." #{ITEM}, {AMOUNT} # Error messages in-creative: "&cYaratıcı moddayken ürün satamazsınız." -max-listings: "&c@max sayıdan fazla listeniz olamaz." #@max +max-listings: "&c{MAX} sayıdan fazla listeniz olamaz." #{MAX} invalid-price: "&cGeçersiz fiyat." not-enough-space: "&cBu öğeyi satın almak için yeterli envanter alanınız yok" self-purchase: "&cMüzayede evinde kendi eşyalarınızı satın alamazsınız!" @@ -33,57 +33,57 @@ cannot-afford: "&cBu öğeyi satın almak için yeterli paranız yok." item-blacklisted: "&cO eşyanın müzayede evine konmasına izin verilmiyor!" invalid-balance: "&cAçık artırma listelemek için yeterli paranız yok." listing-gone: "&cBu liste artık mevcut değil." -price-range: "&cGeçersiz fiyat aralığı" #@min, @max -in-cooldown: "&cŞu anda bekleme süresindesiniz, lütfen &b@M &cdakika &b@S &csaniye bekleyin." #@M, @S +price-range: "&cGeçersiz fiyat aralığı" #{MIN}, {MAX} +in-cooldown: "&cŞu anda bekleme süresindesiniz, lütfen &b{M} &cdakika &b{S} &csaniye bekleyin." #{M}, {S} player-not-found: "&cBu oyuncunun aktif listesi yok." player-listings-usage: "&c/ah listings komutunu yürüterek listeleri görüntüle" inventory-full: "&cEnvanteriniz dolu, listelerinizi talep etmek için bazı öğelerinizi boşaltın" # Items in the menu UI listed-item: - # %price% = Price of listing - # %seller% = Username of seller + # {PRICE} = Price of listing + # {SELLER} = Username of seller # {H} = Hours | {M} = Minutes - "&7-------------------------" - "&aSatın almak için tıkla." - "" - - "&9Fiyat: &e%price%" - - "&9Satıcı: &e%seller%" + - "&9Fiyat: &e{PRICE}" + - "&9Satıcı: &e{SELLER}" - "&9Sona Ermesine: &e{D}g {H}s {M}d" - "&7-------------------------" your-listed-item: - # %price% = Price of listing + # {PRICE} = Price of listing # {H} = Hours | {M} = Minutes - "&7-------------------------" - "&cListeyi kaldırmak için tıkla." - "" - - "&9Fiyat: &e%price%" + - "&9Fiyat: &e{PRICE}" - "&9Sona Ermesine: &e{D}g {H}s {M}d" - "&7-------------------------" expired-item: - # %price% = Price of listing + # {PRICE} = Price of listing - "&7-------------------------" - "&aÖğeyi almak için tıkla." - "" - "" - - "&9Fiyat: &e%price%" + - "&9Fiyat: &e{PRICE}" - "&7-------------------------" view-listed-items: - # %selling% = Number of active listings + # {SELLING} = Number of active listings name: "&6Sattığınız ürünler" lore: - "&aTüm öğeleri görüntülemek için tıklayın" - "&aŞu anda açık artırmada satıyorlar." - "" - - "&9Satış: &e%selling%" + - "&9Satış: &e{SELLING}" view-expired-items: - # %expired% = Number of expired listings + # {EXPIRED} = Number of expired listings name: "&6Süresi Dolan / İptal Edilen Öğeler" lore: - "&r&aTüm ürünleri görüntüle ve topla" - "&aİptal ettiğiniz veya süresi dolmuş ürünler." - "" - - "&9Toplanmış öğeler: &e%expired%" + - "&9Toplanmış öğeler: &e{EXPIRED}" # Admin Menu view-admin-menu: @@ -92,26 +92,26 @@ view-admin-menu: - "&r&aAdmin menüsünü görüntüle." #- "&aBelirli öğeleri buradan kaldırabilirsiniz." main-stats-admin: - # %page% = Current page - # %max% = Max page - # %expired% = Expired listing count - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {EXPIRED} = Expired listing count + # {TOTAL} = Total listing count name: "&l&cAdmin Menü" lore: - - "&aSayfa %page%/%max%" - - "&7Toplam &b%total% &7öğe" - - "&c(&b%expired% &csüresi dolmuş öğeler)" + - "&aSayfa {PAGE}/{MAX}" + - "&7Toplam &b{TOTAL} &7öğe" + - "&c(&b{EXPIRED} &csüresi dolmuş öğeler)" - "Sayfayı yenile" listed-item-admin: - # %price% = Price of listing - # %seller% = Username of seller - # %status% = Status of the listing (Active/Expired) + # {PRICE} = Price of listing + # {SELLER} = Username of seller + # {STATUS} = Status of the listing (Active/Expired) - "&7-------------------------" - "&6Listeyi düzenle." - "" - - "&9Fiyat: &e%price%" - - "&9Satıcı: &e%seller%" - - "&9Durum: %status%" + - "&9Fiyat: &e{PRICE}" + - "&9Satıcı: &e{SELLER}" + - "&9Durum: {STATUS}" - "&7-------------------------" status-active: "&aAktif" @@ -152,13 +152,13 @@ main-description: - "&adiğer çiftlik ürünleri satarak da para kazanabilirsin" - "&oyuncular satın almakla ilgilenebilirler." main-stats: - # %page% = Current page - # %max% = Max page - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count name: "&l&6Müzayede Evi" lore: - - "&aSayfa %page%/%max%" - - "&7Toplam &b%total% &7öğe" + - "&aSayfa {PAGE}/{MAX}" + - "&7Toplam &b{TOTAL} &7öğe" - "Sayfayı yenile" listings-description: name: "&6Bu Sayfada Nedir?" @@ -170,13 +170,13 @@ listings-description: - "&aListenizi iptal edebilir ve görüntüleyebilirsiniz" - "&aburada zaman aşımına uğrarlar." listings-stats: - # %page% = Current page - # %max% = Max page - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count name: "&l&6Listeler" lore: - - "&aSayfa %page%/%max%" - - "&7Topla &b%total% &7items" + - "&aSayfa {PAGE}/{MAX}" + - "&7Topla &b{TOTAL} &7items" expired-description: name: "&6Bu Sayfada Nedir?" lore: @@ -188,33 +188,33 @@ expired-description: - "&aSadece öğeye tıklayın ve" - "&aenvanteriniz yeterli bir açık olduğundan emin olun." expired-stats: - # %page% = Current page - # %max% = Max page - # %total% = Number of categories + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Number of categories name: "&l&6Süresi Dolmuş" lore: - - "&aSayfa %page%/%max%" - - "&7Toplam &b%total% &7öğe" + - "&aSayfa {PAGE}/{MAX}" + - "&7Toplam &b{TOTAL} &7öğe" - "&3Tüm öğeleri iade et" # Category menu category-stats: - # %category% = Category - # %page% = Current page - # %max% = Max page - # %total% = Total listing count - name: "%category%" - lore: - - "&aSayfa %page%/%max%" - - "&7Toplam &b%total% &7liste" + # {CATEGORY} = Category + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count + name: "{CATEGORY}" + lore: + - "&aSayfa {PAGE}/{MAX}" + - "&7Toplam &b{TOTAL} &7liste" category-list-stats: - # %page% = Current page - # %max% = Max page - # %total% = Total listing count + # {PAGE} = Current page + # {MAX} = Max page + # {TOTAL} = Total listing count name: "&l&6Kategori Menü" lore: - - "&aSayfa %page%/%max%" - - "&7Toplam &b%total% &7kategori" + - "&aSayfa {PAGE}/{MAX}" + - "&7Toplam &b{TOTAL} &7kategori" # Confirm purchase menu purchase-confirm: @@ -224,7 +224,7 @@ purchase-cancel: purchase-item: lore: - "&7-------------------------" - - "&9Fiyat: &e%price%" - - "&9Satıcı: &e%seller%" + - "&9Fiyat: &e{PRICE}" + - "&9Satıcı: &e{SELLER}" - "&7-------------------------" ... \ No newline at end of file diff --git a/resources/statements/mysql.sql b/resources/statements/mysql.sql index e8c8cec..a019edc 100644 --- a/resources/statements/mysql.sql +++ b/resources/statements/mysql.sql @@ -2,7 +2,7 @@ -- #{ auctionhouse -- # { init -CREATE TABLE IF NOT EXISTS auctions( +CREATE TABLE IF NOT EXISTS listings( id INTEGER PRIMARY KEY AUTO_INCREMENT, uuid CHAR(36), username VARCHAR(36), @@ -17,23 +17,23 @@ CREATE TABLE IF NOT EXISTS auctions( -- # { count -- # { all -SELECT COUNT(*) FROM auctions; +SELECT COUNT(*) FROM listings; -- # } -- # { active -- # { all -SELECT COUNT(*) FROM auctions WHERE expired = FALSE; +SELECT COUNT(*) FROM listings WHERE expired = FALSE; -- # } -- # { uuid -- # :uuid string -SELECT COUNT(*) FROM auctions WHERE uuid = :uuid AND expired = FALSE; +SELECT COUNT(*) FROM listings WHERE uuid = :uuid AND expired = FALSE; -- # } -- # { username -- # :username string -SELECT COUNT(*) FROM auctions WHERE username = :username AND expired = FALSE; +SELECT COUNT(*) FROM listings WHERE username = :username AND expired = FALSE; -- # } -- # } @@ -41,12 +41,12 @@ SELECT COUNT(*) FROM auctions WHERE username = :username AND expired = FALSE; -- # { expired -- # { all -SELECT COUNT(*) FROM auctions WHERE expired = TRUE; +SELECT COUNT(*) FROM listings WHERE expired = TRUE; -- # } -- # { uuid -- # :uuid string -SELECT COUNT(*) FROM auctions WHERE uuid = :uuid AND expired = TRUE; +SELECT COUNT(*) FROM listings WHERE uuid = :uuid AND expired = TRUE; -- # } -- # } @@ -58,12 +58,12 @@ SELECT COUNT(*) FROM auctions WHERE uuid = :uuid AND expired = TRUE; -- # { all -- # :id int -- # :limit int -SELECT * FROM auctions LIMIT :id, :limit; +SELECT * FROM listings LIMIT :id, :limit; -- # } -- # { id -- # :id int -SELECT * FROM auctions WHERE id = :id; +SELECT * FROM listings WHERE id = :id; -- # } -- # { active @@ -71,21 +71,21 @@ SELECT * FROM auctions WHERE id = :id; -- # { next -- # :id int -- # :limit int -SELECT * FROM auctions WHERE expired = FALSE LIMIT :id, :limit; +SELECT * FROM listings WHERE expired = FALSE LIMIT :id, :limit; -- # } -- # { uuid -- # :id int -- # :limit int -- # :uuid string -SELECT * FROM auctions WHERE uuid = :uuid AND expired = FALSE LIMIT :id, :limit; +SELECT * FROM listings WHERE uuid = :uuid AND expired = FALSE LIMIT :id, :limit; -- # } -- # { username -- # :id int -- # :limit int -- # :username string -SELECT * FROM auctions WHERE username = :username AND expired = FALSE LIMIT :id, :limit; +SELECT * FROM listings WHERE username = :username AND expired = FALSE LIMIT :id, :limit; -- # } -- # } @@ -95,14 +95,14 @@ SELECT * FROM auctions WHERE username = :username AND expired = FALSE LIMIT :id, -- # { next -- # :id int -- # :limit int -SELECT * FROM auctions WHERE expired = TRUE LIMIT :id, :limit; +SELECT * FROM listings WHERE expired = TRUE LIMIT :id, :limit; -- # } -- # { uuid -- # :id int -- # :limit int -- # :uuid string -SELECT * FROM auctions WHERE uuid = :uuid AND expired = TRUE LIMIT :id, :limit; +SELECT * FROM listings WHERE uuid = :uuid AND expired = TRUE LIMIT :id, :limit; -- # } -- # } @@ -111,13 +111,13 @@ SELECT * FROM auctions WHERE uuid = :uuid AND expired = TRUE LIMIT :id, :limit; -- # { delete -- # :id int -DELETE FROM auctions WHERE id = :id; +DELETE FROM listings WHERE id = :id; -- # } -- # { expired -- # :id int -- # :expired bool -UPDATE auctions SET expired = :expired WHERE id = :id; +UPDATE listings SET expired = :expired WHERE id = :id; -- # } -- # { insert @@ -128,7 +128,7 @@ UPDATE auctions SET expired = :expired WHERE id = :id; -- # :created int -- # :end_time int -- # :expired bool -INSERT INTO auctions(id, uuid, username, price, item, created, end_time, expired) VALUES (NULL, :uuid, :username, :price, :item, :created, :end_time, :expired); +INSERT INTO listings(id, uuid, username, price, item, created, end_time, expired) VALUES (NULL, :uuid, :username, :price, :item, :created, :end_time, :expired); -- # } -- # } \ No newline at end of file diff --git a/resources/statements/sqlite.sql b/resources/statements/sqlite.sql index ceb1e50..d693adc 100644 --- a/resources/statements/sqlite.sql +++ b/resources/statements/sqlite.sql @@ -2,7 +2,7 @@ -- #{ auctionhouse -- # { init -CREATE TABLE IF NOT EXISTS auctions( +CREATE TABLE IF NOT EXISTS listings( id INTEGER PRIMARY KEY AUTOINCREMENT, uuid CHAR(36), username VARCHAR(36), @@ -17,23 +17,23 @@ CREATE TABLE IF NOT EXISTS auctions( -- # { count -- # { all -SELECT COUNT(*) FROM auctions; +SELECT COUNT(*) FROM listings; -- # } -- # { active -- # { all -SELECT COUNT(*) FROM auctions WHERE expired = FALSE; +SELECT COUNT(*) FROM listings WHERE expired = FALSE; -- # } -- # { uuid -- # :uuid string -SELECT COUNT(*) FROM auctions WHERE uuid = :uuid AND expired = FALSE; +SELECT COUNT(*) FROM listings WHERE uuid = :uuid AND expired = FALSE; -- # } -- # { username -- # :username string -SELECT COUNT(*) FROM auctions WHERE username = :username AND expired = FALSE; +SELECT COUNT(*) FROM listings WHERE username = :username AND expired = FALSE; -- # } -- # } @@ -41,12 +41,12 @@ SELECT COUNT(*) FROM auctions WHERE username = :username AND expired = FALSE; -- # { expired -- # { all -SELECT COUNT(*) FROM auctions WHERE expired = TRUE; +SELECT COUNT(*) FROM listings WHERE expired = TRUE; -- # } -- # { uuid -- # :uuid string -SELECT COUNT(*) FROM auctions WHERE uuid = :uuid AND expired = TRUE; +SELECT COUNT(*) FROM listings WHERE uuid = :uuid AND expired = TRUE; -- # } -- # } @@ -58,12 +58,12 @@ SELECT COUNT(*) FROM auctions WHERE uuid = :uuid AND expired = TRUE; -- # { all -- # :id int -- # :limit int -SELECT * FROM auctions LIMIT :id, :limit; +SELECT * FROM listings LIMIT :id, :limit; -- # } -- # { id -- # :id int -SELECT * FROM auctions WHERE id = :id; +SELECT * FROM listings WHERE id = :id; -- # } -- # { active @@ -71,21 +71,21 @@ SELECT * FROM auctions WHERE id = :id; -- # { next -- # :id int -- # :limit int -SELECT * FROM auctions WHERE expired = FALSE LIMIT :id, :limit; +SELECT * FROM listings WHERE expired = FALSE LIMIT :id, :limit; -- # } -- # { uuid -- # :id int -- # :limit int -- # :uuid string -SELECT * FROM auctions WHERE uuid = :uuid AND expired = FALSE LIMIT :id, :limit; +SELECT * FROM listings WHERE uuid = :uuid AND expired = FALSE LIMIT :id, :limit; -- # } -- # { username -- # :id int -- # :limit int -- # :username string -SELECT * FROM auctions WHERE username = :username AND expired = FALSE LIMIT :id, :limit; +SELECT * FROM listings WHERE username = :username AND expired = FALSE LIMIT :id, :limit; -- # } -- # } @@ -95,14 +95,14 @@ SELECT * FROM auctions WHERE username = :username AND expired = FALSE LIMIT :id, -- # { next -- # :id int -- # :limit int -SELECT * FROM auctions WHERE expired = TRUE LIMIT :id, :limit; +SELECT * FROM listings WHERE expired = TRUE LIMIT :id, :limit; -- # } -- # { uuid -- # :id int -- # :limit int -- # :uuid string -SELECT * FROM auctions WHERE uuid = :uuid AND expired = TRUE LIMIT :id, :limit; +SELECT * FROM listings WHERE uuid = :uuid AND expired = TRUE LIMIT :id, :limit; -- # } -- # } @@ -111,13 +111,13 @@ SELECT * FROM auctions WHERE uuid = :uuid AND expired = TRUE LIMIT :id, :limit; -- # { delete -- # :id int -DELETE FROM auctions WHERE id = :id; +DELETE FROM listings WHERE id = :id; -- # } -- # { expired -- # :id int -- # :expired bool -UPDATE auctions SET expired = :expired WHERE id = :id; +UPDATE listings SET expired = :expired WHERE id = :id; -- # } -- # { insert @@ -128,7 +128,7 @@ UPDATE auctions SET expired = :expired WHERE id = :id; -- # :created int -- # :end_time int -- # :expired bool -INSERT INTO auctions(id, uuid, username, price, item, created, end_time, expired) VALUES (NULL, :uuid, :username, :price, :item, :created, :end_time, :expired); +INSERT INTO listings(id, uuid, username, price, item, created, end_time, expired) VALUES (NULL, :uuid, :username, :price, :item, :created, :end_time, :expired); -- # } -- # } \ No newline at end of file diff --git a/src/shock95x/auctionhouse/AuctionHouse.php b/src/shock95x/auctionhouse/AuctionHouse.php index eeb676a..695c80d 100644 --- a/src/shock95x/auctionhouse/AuctionHouse.php +++ b/src/shock95x/auctionhouse/AuctionHouse.php @@ -13,9 +13,11 @@ use pocketmine\item\enchantment\ItemFlags; use pocketmine\plugin\PluginBase; use pocketmine\scheduler\ClosureTask; +use pocketmine\utils\SingletonTrait; use shock95x\auctionhouse\commands\AHCommand; use shock95x\auctionhouse\database\Database; use shock95x\auctionhouse\database\legacy\LegacyConverter; +use shock95x\auctionhouse\economy\BedrockEconomyProvider; use shock95x\auctionhouse\economy\EconomyProvider; use shock95x\auctionhouse\economy\EconomySProvider; use shock95x\auctionhouse\task\CheckLegacyTask; @@ -26,16 +28,18 @@ class AuctionHouse extends PluginBase { - public static ?AuctionHouse $instance; - private ?EconomyProvider $economyProvider; + use SingletonTrait; + private Database $database; + private ?EconomyProvider $economyProvider = null; public const FAKE_ENCH_ID = -1; private const RESOURCES = ["statements/mysql.sql" => true, "statements/sqlite.sql" => true, "language/en_US.yml" => false, "language/ru_RU.yml" => false, "language/de_DE.yml" => false]; public function onLoad(): void { + self::setInstance($this); $this->saveDefaultConfig(); - foreach(self::RESOURCES as $file => $replace) $this->saveResource($file, $replace); + foreach(self::RESOURCES as $file => $r) $this->saveResource($file, $r); EnchantmentIdMap::getInstance()->register(self::FAKE_ENCH_ID, new Enchantment("", -1, 1, ItemFlags::ALL, ItemFlags::NONE)); Utils::checkConfig($this, $this->getConfig(), "config-version", 5); } @@ -44,7 +48,6 @@ public function onLoad(): void { * @throws HookAlreadyRegistered */ public function onEnable(): void { - self::$instance = $this; Settings::init($this->getConfig()); Locale::init($this); @@ -61,39 +64,40 @@ public function onEnable(): void { LegacyConverter::getInstance()->init($this->database); - $pluginManager->registerEvents(new EventListener($this), $this); + $pluginManager->registerEvents(new EventListener(), $this); if($pluginManager->getPlugin(EconomySProvider::getName()) !== null) { $this->setEconomyProvider(new EconomySProvider()); + } else if ($pluginManager->getPlugin(BedrockEconomyProvider::getName()) !== null) { + $this->setEconomyProvider(new BedrockEconomyProvider()); } $this->getScheduler()->scheduleDelayedTask(new ClosureTask(function() { if($this->economyProvider == null) { - $this->getLogger()->notice("Could not detect an economy provider, disabling plugin..."); + $this->getLogger()->notice("No economy provider found, disabling plugin..."); $this->disable(); return; } Settings::setMonetaryUnit($this->economyProvider->getMonetaryUnit()); }), 1); - $this->getServer()->getCommandMap()->register($this->getDescription()->getName(), new AHCommand($this, "ah", "AuctionHouse command")); UpdateNotifier::checkUpdate($this->getDescription()->getName(), $this->getDescription()->getVersion()); + if($pluginManager->getPlugin("InvCrashFix") == null) { + $this->getLogger()->warning("InvCrashFix is required to fix menu issues on PM4, download it here: https://poggit.pmmp.io/ci/Muqsit/InvCrashFix"); + } + $this->getServer()->getCommandMap()->register($this->getDescription()->getName(), new AHCommand($this, "ah", "AuctionHouse command")); $this->getScheduler()->scheduleDelayedTask(new CheckLegacyTask($this), 1); } public function onDisable(): void { + self::reset(); $this->database?->close(); } - public static function getInstance(): self { - return self::$instance; - } - public function reload(): void { Locale::init($this); Settings::init($this->getConfig(), true); } public function disable(): void { - self::$instance = null; $this->getServer()->getPluginManager()->disablePlugin($this); } diff --git a/src/shock95x/auctionhouse/EventListener.php b/src/shock95x/auctionhouse/EventListener.php index 14c4596..ef7bcf3 100644 --- a/src/shock95x/auctionhouse/EventListener.php +++ b/src/shock95x/auctionhouse/EventListener.php @@ -16,8 +16,6 @@ class EventListener implements Listener { - public function __construct(private AuctionHouse $plugin) {} - public function onSignChange(SignChangeEvent $event): void { $player = $event->getPlayer(); $block = $event->getBlock(); diff --git a/src/shock95x/auctionhouse/commands/AHCommand.php b/src/shock95x/auctionhouse/commands/AHCommand.php index 3351fb7..7fd817d 100644 --- a/src/shock95x/auctionhouse/commands/AHCommand.php +++ b/src/shock95x/auctionhouse/commands/AHCommand.php @@ -9,6 +9,7 @@ use shock95x\auctionhouse\commands\subcommand\AboutCommand; use shock95x\auctionhouse\commands\subcommand\AdminCommand; use shock95x\auctionhouse\commands\subcommand\CategoryCommand; +use shock95x\auctionhouse\commands\subcommand\ConvertCommand; use shock95x\auctionhouse\commands\subcommand\ExpiredCommand; use shock95x\auctionhouse\commands\subcommand\ListingsCommand; use shock95x\auctionhouse\commands\subcommand\ReloadCommand; @@ -29,6 +30,7 @@ protected function prepare(): void { $this->registerSubCommand(new ExpiredCommand("expired", "Shows expired listings")); $this->registerSubCommand(new ReloadCommand("reload", "Reload plugin configuration files")); $this->registerSubCommand(new AboutCommand("about", "Plugin information")); + $this->registerSubCommand(new ConvertCommand("convert", "Legacy DB conversion")); } public function onRun(CommandSender $sender, string $aliasUsed, array $args): void { diff --git a/src/shock95x/auctionhouse/commands/subcommand/ConvertCommand.php b/src/shock95x/auctionhouse/commands/subcommand/ConvertCommand.php new file mode 100644 index 0000000..7d13de0 --- /dev/null +++ b/src/shock95x/auctionhouse/commands/subcommand/ConvertCommand.php @@ -0,0 +1,28 @@ +addConstraint(new ConsoleRequiredConstraint($this)); + } + + public function onRun(CommandSender $sender, string $aliasUsed, array $args): void { + Await::f2c(function () use ($sender) { + $converter = LegacyConverter::getInstance(); + if (yield $converter->isLegacy()) { + $sender->sendMessage("Starting conversion..."); + yield $converter->convert(); + $sender->sendMessage("Conversion done!"); + } + }); + } +} \ No newline at end of file diff --git a/src/shock95x/auctionhouse/commands/subcommand/SellCommand.php b/src/shock95x/auctionhouse/commands/subcommand/SellCommand.php index d37bf78..d4c5e37 100644 --- a/src/shock95x/auctionhouse/commands/subcommand/SellCommand.php +++ b/src/shock95x/auctionhouse/commands/subcommand/SellCommand.php @@ -62,18 +62,18 @@ public function onRun(CommandSender $sender, string $aliasUsed, array $args): vo } $listingCount = yield DataStorage::getInstance()->getActiveCountByPlayer($sender, yield) => Await::ONCE; if($listingCount >= (Utils::getMaxListings($sender))) { - $sender->sendMessage(str_replace(["@max"], [Utils::getMaxListings($sender)], Locale::get($sender, "max-listings", true))); + $sender->sendMessage(str_ireplace(["{MAX}"], [Utils::getMaxListings($sender)], Locale::get($sender, "max-listings", true))); return; } if($price < Settings::getMinPrice() || ($price > Settings::getMaxPrice() && Settings::getMaxPrice() != -1)) { - $sender->sendMessage(str_replace(["@min", "@max"], [Settings::getMinPrice(), Settings::getMaxPrice()], Locale::get($sender, "price-range", true))); + $sender->sendMessage(str_ireplace(["{MIN}", "{MAX}"], [Settings::getMinPrice(), Settings::getMaxPrice()], Locale::get($sender, "price-range", true))); return; } if(Settings::getListingCooldown() != 0) { if(CooldownManager::inCooldown($sender)) { $cooldown = CooldownManager::getCooldown($sender); $endTime = (new DateTime())->diff((new DateTime())->setTimestamp($cooldown)); - $sender->sendMessage(str_replace(["@M", "@S"], [$endTime->i, $endTime->s], Locale::get($sender, "in-cooldown", true))); + $sender->sendMessage(str_ireplace(["{M}", "{S}"], [$endTime->i, $endTime->s], Locale::get($sender, "in-cooldown", true))); return; } if(CooldownManager::setCooldown($sender)) { @@ -90,7 +90,7 @@ public function onRun(CommandSender $sender, string $aliasUsed, array $args): vo $count = $item->getCount(); Utils::removeItem($sender, $item); $listing = yield DataStorage::getInstance()->createListing($sender, $item->setCount($count), (int) $price, yield) => Await::ONCE; - $sender->sendMessage(str_replace(["@player", "@item", "@price", "@amount"], [$sender->getName(), $item->getName(), $listing->getPrice(true, Settings::formatPrice()), $count], Locale::get($sender, "item-listed", true))); + $sender->sendMessage(str_ireplace(["{PLAYER}", "{ITEM}", "{PRICE}", "{AMOUNT}"], [$sender->getName(), $item->getName(), $listing->getPrice(true, Settings::formatPrice()), $count], Locale::get($sender, "item-listed", true))); }); } diff --git a/src/shock95x/auctionhouse/database/legacy/LegacyConverter.php b/src/shock95x/auctionhouse/database/legacy/LegacyConverter.php index 5675e31..7cea54c 100644 --- a/src/shock95x/auctionhouse/database/legacy/LegacyConverter.php +++ b/src/shock95x/auctionhouse/database/legacy/LegacyConverter.php @@ -1,6 +1,7 @@ database->getType()) { - case 'mysql': - $rowCount = count(yield $this->database->asyncSelectRaw("DESCRIBE auctions;")); - break; - case 'sqlite': - $rowCount = count(yield $this->database->asyncSelectRaw("PRAGMA table_info(auctions);")); - break; - }; + $type = $this->database->getType(); + $rowCount = count(yield $this->database->asyncSelectRaw($type == "mysql" ? "DESCRIBE auctions;" : "PRAGMA table_info(auctions);")); return $rowCount == 7; } public function convert(): Generator { - $type = $this->database->getType(); - if($type == 'mysql') { - yield $this->database->asyncChangeRaw(" - ALTER TABLE auctions - DROP PRIMARY KEY, - RENAME COLUMN id TO created, - RENAME COLUMN nbt TO item, - ADD COLUMN id INTEGER PRIMARY KEY AUTO_INCREMENT FIRST, - MODIFY COLUMN username VARCHAR(36), - MODIFY COLUMN uuid CHAR(36);"); - - yield $this->database->asyncChangeRaw("ALTER TABLE auctions MODIFY COLUMN item JSON;"); - } else if ($type == 'sqlite') { - yield $this->database->asyncChangeRaw("ALTER TABLE auctions RENAME TO auctions_old;"); - yield $this->database->asyncGeneric(Query::INIT); - yield $this->database->asyncGenericRaw("INSERT INTO auctions (uuid, username, item, price, created, end_time, expired) SELECT uuid, username, nbt, price, id, end_time, expired FROM auctions_old;"); - } - $rows = yield $this->database->asyncSelectRaw("SELECT * from auctions;"); + yield $this->database->asyncGeneric(Query::INIT); + yield $this->database->asyncGenericRaw("INSERT INTO listings (uuid, username, item, price, created, end_time, expired) SELECT uuid, username, nbt, price, id, end_time, expired FROM auctions;"); + $rows = yield $this->database->asyncSelectRaw("SELECT * from listings;"); foreach ($rows as $listing) { - $uuid = Uuid::fromBytes($listing['uuid']); - $root = $this->nbt->read(zlib_decode($listing["item"])); - $item = Item::nbtDeserialize($root->mustGetCompoundTag()); - yield $this->database->asyncGenericRaw("UPDATE auctions SET uuid = :uuid, item = :item WHERE id = :id;", ["uuid" => $uuid->toString(), "item" => json_encode($item->jsonSerialize()), "id" => $listing['id']]); + try { + $uuid = Uuid::fromBytes($listing['uuid']); + $nbt = $this->nbt->read(zlib_decode($listing["item"])); + $item = Item::nbtDeserialize($nbt->mustGetCompoundTag()); + yield $this->database->asyncGenericRaw("UPDATE listings SET uuid = :uuid, item = :item WHERE id = :id;", ["uuid" => $uuid->toString(), "item" => json_encode($item->jsonSerialize()), "id" => $listing['id']]); + } catch (Exception) {} } + yield $this->database->asyncChangeRaw("DROP TABLE auctions;"); } } \ No newline at end of file diff --git a/src/shock95x/auctionhouse/database/storage/DataStorage.php b/src/shock95x/auctionhouse/database/storage/DataStorage.php index b9c5c71..1ce8881 100644 --- a/src/shock95x/auctionhouse/database/storage/DataStorage.php +++ b/src/shock95x/auctionhouse/database/storage/DataStorage.php @@ -87,13 +87,13 @@ public function getExpiredListingsByPlayer(callable $callback, Player $player, i }); } - public function getListingCount(callable $callback): void { + public function getTotalListingCount(callable $callback): void { $this->database->getConnector()->executeSelect(Query::COUNT_ALL, [], function(array $rows) use ($callback): void { $callback($rows[0]["COUNT(*)"]); }); } - public function getActiveCount(callable $callback) { + public function getActiveListingCount(callable $callback) { $this->database->getConnector()->executeSelect(Query::COUNT_ACTIVE, [], function(array $rows) use ($callback): void { $callback($rows[0]["COUNT(*)"]); }); diff --git a/src/shock95x/auctionhouse/economy/BedrockEconomyProvider.php b/src/shock95x/auctionhouse/economy/BedrockEconomyProvider.php new file mode 100644 index 0000000..0a2d7b9 --- /dev/null +++ b/src/shock95x/auctionhouse/economy/BedrockEconomyProvider.php @@ -0,0 +1,39 @@ +economy = BedrockEconomyAPI::getInstance(); + } + + public function addMoney(string|Player $player, float $amount, ?callable $callback = null): void { + if($player instanceof Player) $player = $player->getName(); + $this->economy->addToPlayerBalance($player, $amount, ClosureContext::create(fn (bool $r) => $callback($r))); + } + + public function subtractMoney(string|Player $player, float $amount, ?callable $callback = null): void { + if($player instanceof Player) $player = $player->getName(); + $this->economy->subtractFromPlayerBalance($player, $amount, ClosureContext::create(fn (bool $r) => $callback($r))); + } + + public function getMoney(string|Player $player, callable $callback): void { + if($player instanceof Player) $player = $player->getName(); + $this->economy->getPlayerBalance($player, ClosureContext::create(fn (?int $balance) => $callback($balance))); + } + + public function getMonetaryUnit(): string { + return ""; + } + + public static function getName(): string { + return "BedrockEconomy"; + } +} \ No newline at end of file diff --git a/src/shock95x/auctionhouse/economy/EconomySProvider.php b/src/shock95x/auctionhouse/economy/EconomySProvider.php index bcc9573..1b8bfd8 100644 --- a/src/shock95x/auctionhouse/economy/EconomySProvider.php +++ b/src/shock95x/auctionhouse/economy/EconomySProvider.php @@ -16,11 +16,13 @@ public function __construct() { } public function addMoney(string|Player $player, float $amount, ?callable $callback = null): void { - $callback ? $callback($this->economyAPI->addMoney($player, $amount)) : $this->economyAPI->addMoney($player, $amount); + $ret = $this->economyAPI->addMoney($player, $amount); + if($callback) $callback($ret > 0); } public function subtractMoney(string|Player $player, float $amount, ?callable $callback = null): void { - $callback ? $callback($this->economyAPI->reduceMoney($player, $amount)) : $this->economyAPI->reduceMoney($player, $amount); + $ret = $this->economyAPI->reduceMoney($player, $amount); + if($callback) $callback($ret > 0); } public function getMoney(string|Player $player, callable $callback): void { diff --git a/src/shock95x/auctionhouse/menu/ConfirmPurchaseMenu.php b/src/shock95x/auctionhouse/menu/ConfirmPurchaseMenu.php index 47c24c9..2b07102 100644 --- a/src/shock95x/auctionhouse/menu/ConfirmPurchaseMenu.php +++ b/src/shock95x/auctionhouse/menu/ConfirmPurchaseMenu.php @@ -23,8 +23,8 @@ class ConfirmPurchaseMenu extends AHMenu { - const CONFIRM_INDEX = [9, 10, 11, 12]; - const CANCEL_INDEX = [14, 15, 16, 17]; + const INDEX_CONFIRM = [9, 10, 11, 12]; + const INDEX_CANCEL = [14, 15, 16, 17]; protected static string $inventoryType = InvMenu::TYPE_CHEST; @@ -35,11 +35,11 @@ public function __construct(Player $player, AHListing $listing) { } public function renderButtons(): void { - foreach (self::CONFIRM_INDEX as $x) { + foreach (self::INDEX_CONFIRM as $x) { $confirmItem = Utils::getButtonItem($this->player, "confirm_purchase", "purchase-confirm"); $this->getInventory()->setItem($x, $confirmItem); } - foreach (self::CANCEL_INDEX as $x) { + foreach (self::INDEX_CANCEL as $x) { $cancelItem = Utils::getButtonItem($this->player, "cancel_purchase", "purchase-cancel"); $this->getInventory()->setItem($x, $cancelItem); } @@ -52,25 +52,25 @@ public function renderListings(): void { $item = clone $listing->getItem(); $info = Locale::get($this->player, "purchase-item"); - $lore = str_replace(["%price%", "%seller%"], [$listing->getPrice(true, Settings::formatPrice()), $listing->getSeller()], preg_filter('/^/', TextFormat::RESET, $info["lore"])); + $lore = str_ireplace(["{PRICE}", "{SELLER}"], [$listing->getPrice(true, Settings::formatPrice()), $listing->getSeller()], preg_filter('/^/', TextFormat::RESET, $info["lore"])); $lore = Settings::allowLore() ? [...$item->getLore(), ...$lore] : $lore; $this->getInventory()->setItem(13, $item->setLore($lore)); } public function handle(Player $player, Item $itemClicked, Inventory $inventory, int $slot): bool { - if(in_array($slot, self::CANCEL_INDEX)) { + if(in_array($slot, self::INDEX_CANCEL)) { $player->removeCurrentWindow(); Locale::sendMessage($player, "cancelled-purchase"); return false; } - if (!in_array($slot, self::CONFIRM_INDEX)) return false; + if (!in_array($slot, self::INDEX_CONFIRM)) return false; Await::f2c(function () use ($player) { $storage = DataStorage::getInstance(); /** @var ?AHListing $listing */ $listing = yield $storage->getListingById($this->getListings()[0]?->getId(), yield) => Await::ONCE; - if($listing == null || $listing?->isExpired()) { + if($listing == null || $listing->isExpired()) { Locale::sendMessage($player, "listing-gone"); return; } @@ -96,20 +96,26 @@ public function handle(Player $player, Item $itemClicked, Inventory $inventory, $event->call(); if($event->isCancelled()) return; - $listing->setExpired(); $storage->removeListing($listing); - yield $economy->addMoney($listing->getSeller(), $listing->getPrice(), yield) => Await::ONCE; - yield $economy->subtractMoney($player, $listing->getPrice(), yield) => Await::ONCE; - - $player->getInventory()->addItem($item); - + $res = yield $economy->subtractMoney($player, $listing->getPrice(), yield) => Await::ONCE; + if(!$res) { + Locale::sendMessage($player, "purchase-economy-error"); + return; + } + $res = yield $economy->addMoney($listing->getSeller(), $listing->getPrice(), yield) => Await::ONCE; + if(!$res) { + $economy->addMoney($player, $listing->getPrice()); + Locale::sendMessage($player, "purchase-economy-error"); + return; + } $player->removeCurrentWindow(); - $player->sendMessage(str_replace(["@player", "@item", "@price", "@amount"], [$player->getName(), $item->getName(), $listing->getPrice(true, Settings::formatPrice()), $item->getCount()], Locale::get($player, "purchased-item", true))); + $player->getInventory()->addItem($item); + $player->sendMessage(str_ireplace(["{PLAYER}", "{ITEM}", "{PRICE}", "{AMOUNT}"], [$player->getName(), $item->getName(), $listing->getPrice(true, Settings::formatPrice()), $item->getCount()], Locale::get($player, "purchased-item", true))); $seller = AuctionHouse::getInstance()->getServer()->getPlayerByUUID(Uuid::fromString($listing->getSellerUUID())); $seller?->getWorld()->addSound($seller?->getPosition(), new FizzSound(), [$seller]); - $seller?->sendMessage(str_replace(["@player", "@item", "@price", "@amount"], [$player->getName(), $item->getName(), $listing->getPrice(true, Settings::formatPrice()), $item->getCount()], Locale::get($player, "seller-message", true))); + $seller?->sendMessage(str_ireplace(["{PLAYER}", "{ITEM}", "{PRICE}", "{AMOUNT}"], [$player->getName(), $item->getName(), $listing->getPrice(true, Settings::formatPrice()), $item->getCount()], Locale::get($player, "seller-message", true))); (new AuctionEndEvent($listing, AuctionEndEvent::PURCHASED, $player))->call(); }); return true; diff --git a/src/shock95x/auctionhouse/menu/ExpiredMenu.php b/src/shock95x/auctionhouse/menu/ExpiredMenu.php index 07a69b7..24cf6c2 100644 --- a/src/shock95x/auctionhouse/menu/ExpiredMenu.php +++ b/src/shock95x/auctionhouse/menu/ExpiredMenu.php @@ -6,6 +6,7 @@ use pocketmine\inventory\Inventory; use pocketmine\item\Item; use pocketmine\item\ItemFactory; +use pocketmine\item\VanillaItems; use pocketmine\player\Player; use pocketmine\utils\TextFormat; use shock95x\auctionhouse\database\storage\DataStorage; @@ -32,15 +33,13 @@ protected function init(DataStorage $storage): void { $this->setListings(yield $storage->getExpiredListingsByPlayer(yield, $this->player, (45 * $this->page) - 45) => Await::ONCE); $this->total = yield $storage->getExpiredCountByPlayer($this->player, yield) => Await::ONCE; $this->pages = (int) ceil($this->total / 45); - }, function () use ($storage) { - parent::init($storage); - }); + }, fn() => parent::init($storage)); } public function renderButtons() : void { parent::renderButtons(); - $stats = Utils::getButtonItem($this->player, "return_all", "expired-stats", ["%page%", "%max%", "%total%"], [$this->page, $this->page, $this->total]); + $stats = Utils::getButtonItem($this->player, "return_all", "expired-stats", ["{PAGE}", "{MAX}", "{TOTAL}"], [$this->page, $this->page, $this->total]); $this->getInventory()->setItem(53, Utils::getButtonItem($this->player, "info", "main-description")); $this->getInventory()->setItem(49, $stats); @@ -52,15 +51,13 @@ public function renderListings(): void { $expiredItem = Locale::get($this->player, "expired-item"); - $lore = str_replace(["%price%"], [$listing->getPrice(true, Settings::formatPrice())], preg_filter('/^/', TextFormat::RESET, $expiredItem)); + $lore = str_ireplace(["{PRICE}"], [$listing->getPrice(true, Settings::formatPrice())], preg_filter('/^/', TextFormat::RESET, $expiredItem)); $lore = Settings::allowLore() ? [...$item->getLore(), ...$lore] : $lore; $item->setLore($lore); $this->getInventory()->setItem($index, $item); } - for($i = count($this->getListings()); $i < 45; ++$i) { - $this->getInventory()->setItem($i, ItemFactory::air()); - } + parent::renderListings(); } public function handle(Player $player, Item $itemClicked, Inventory $inventory, int $slot): bool { @@ -75,9 +72,9 @@ public function handle(Player $player, Item $itemClicked, Inventory $inventory, $item = $listing->getItem(); if($player->getInventory()->canAddItem($item)) { $storage->removeListing($listing); - $inventory->setItem($slot, ItemFactory::air()); + $inventory->setItem($slot, VanillaItems::AIR()); $player->getInventory()->addItem($item); - $player->sendMessage(str_replace(["@item", "@amount"], [$item->getName(), $item->getCount()], Locale::get($player, "returned-item", true))); + $player->sendMessage(str_ireplace(["{ITEM}", "{AMOUNT}"], [$item->getName(), $item->getCount()], Locale::get($player, "returned-item", true))); } } if($slot == self::INDEX_RETURN_ALL) { @@ -88,7 +85,7 @@ public function handle(Player $player, Item $itemClicked, Inventory $inventory, foreach ($this->getListings() as $index => $expired) { if ($player->getInventory()->canAddItem($expired->getItem())) { $storage->removeListing($expired); - $inventory->setItem($index, ItemFactory::air()); + $inventory->setItem($index, VanillaItems::AIR()); $player->getInventory()->addItem($expired->getItem()); } } diff --git a/src/shock95x/auctionhouse/menu/ListingsMenu.php b/src/shock95x/auctionhouse/menu/ListingsMenu.php index 5e0711b..6b7f715 100644 --- a/src/shock95x/auctionhouse/menu/ListingsMenu.php +++ b/src/shock95x/auctionhouse/menu/ListingsMenu.php @@ -7,6 +7,7 @@ use pocketmine\inventory\Inventory; use pocketmine\item\Item; use pocketmine\item\ItemFactory; +use pocketmine\item\VanillaItems; use pocketmine\player\Player; use pocketmine\utils\TextFormat; use shock95x\auctionhouse\database\storage\DataStorage; @@ -31,15 +32,13 @@ protected function init(DataStorage $storage): void { $this->setListings(yield $storage->getActiveListingsByPlayer(yield, $this->player, (45 * $this->page) - 45) => Await::ONCE); $this->total = yield $storage->getActiveCountByPlayer($this->player, yield) => Await::ONCE; $this->pages = (int) ceil($this->total / 45); - }, function () use ($storage) { - parent::init($storage); - }); + }, fn() => parent::init($storage)); } public function renderButtons(): void { parent::renderButtons(); $info = Utils::getButtonItem($this->player, "info", "listings-description"); - $stats = Utils::getButtonItem($this->player, "stats", "listings-stats", ["%page%", "%max%", "%total%"], [$this->page, $this->pages, $this->total]); + $stats = Utils::getButtonItem($this->player, "stats", "listings-stats", ["{PAGE}", "{MAX}", "{TOTAL}"], [$this->page, $this->pages, $this->total]); $this->getInventory()->setItem(53, $info); $this->getInventory()->setItem(49, $stats); @@ -52,14 +51,12 @@ public function renderListings(): void { $endTime = (new DateTime())->diff((new DateTime())->setTimestamp($listing->getEndTime())); $listedItem = Locale::get($this->player, "your-listed-item"); - $lore = str_replace(["%price%", "{D}", "{H}", "{M}"], [$listing->getPrice(true, Settings::formatPrice()), $endTime->days, $endTime->h, $endTime->i], preg_filter('/^/', TextFormat::RESET, $listedItem)); + $lore = str_ireplace(["{PRICE}", "{D}", "{H}", "{M}"], [$listing->getPrice(true, Settings::formatPrice()), $endTime->days, $endTime->h, $endTime->i], preg_filter('/^/', TextFormat::RESET, $listedItem)); $lore = Settings::allowLore() ? [...$item->getLore(), ...$lore] : $lore; $item->setLore($lore); $this->getInventory()->setItem($index, $item); } - for($i = count($this->getListings()); $i < 45; ++$i) { - $this->getInventory()->setItem($i, ItemFactory::air()); - } + parent::renderListings(); } public function handle(Player $player, Item $itemClicked, Inventory $inventory, int $slot): bool { @@ -67,7 +64,7 @@ public function handle(Player $player, Item $itemClicked, Inventory $inventory, $listing = $this->getListings()[$slot]; DataStorage::getInstance()->setExpired($listing); (new AuctionEndEvent($listing, AuctionEndEvent::CANCELLED, $player))->call(); - $inventory->setItem($slot, ItemFactory::air()); + $inventory->setItem($slot, VanillaItems::AIR()); } return parent::handle($player, $itemClicked, $inventory, $slot); } diff --git a/src/shock95x/auctionhouse/menu/ShopMenu.php b/src/shock95x/auctionhouse/menu/ShopMenu.php index ac23f5f..4a8624c 100644 --- a/src/shock95x/auctionhouse/menu/ShopMenu.php +++ b/src/shock95x/auctionhouse/menu/ShopMenu.php @@ -22,7 +22,7 @@ class ShopMenu extends PagingMenu { - const INDEX_MAIN = 49; + const INDEX_STATS = 49; const INDEX_LISTINGS = 45; const INDEX_EXPIRED = 46; const INDEX_ADMIN = [47, 51]; @@ -41,23 +41,21 @@ protected function init(DataStorage $storage): void { $this->setListings(yield $storage->getActiveListings(yield, (45 * $this->page) - 45) => Await::ONCE); $this->selling = yield $storage->getActiveCountByPlayer($this->player, yield) => Await::ONCE; $this->expired = yield $storage->getExpiredCountByPlayer($this->player, yield) => Await::ONCE; - $this->total = yield $storage->getActiveCount(yield) => Await::ONCE; + $this->total = yield $storage->getActiveListingCount(yield) => Await::ONCE; $this->pages = (int) ceil($this->total / 45); - }, function () use ($storage) { - parent::init($storage); - }); + }, fn() => parent::init($storage)); } public function renderButtons(): void { parent::renderButtons(); - $chest = Utils::getButtonItem($this->player, "stats", "main-stats", ["%page%", "%max%", "%total%"], [$this->page, $this->pages, $this->total]); + $stats = Utils::getButtonItem($this->player, "stats", "main-stats", ["{PAGE}", "{MAX}", "{TOTAL}"], [$this->page, $this->pages, $this->total]); $howto = Utils::getButtonItem($this->player, "howto", "sell-description"); $info = Utils::getButtonItem($this->player, "info", "main-description"); - $listings = Utils::getButtonItem($this->player, "player_listings", "view-listed-items", ["%selling%"], [$this->selling]); - $expired = Utils::getButtonItem($this->player, "expired_listings", "view-expired-items", ["%expired%"], [$this->expired]); + $listings = Utils::getButtonItem($this->player, "player_listings", "view-listed-items", ["{SELLING}"], [$this->selling]); + $expired = Utils::getButtonItem($this->player, "expired_listings", "view-expired-items", ["{EXPIRED}"], [$this->expired]); $items = [ - self::INDEX_MAIN => $chest, + self::INDEX_STATS => $stats, self::INDEX_LISTINGS => $listings, self::INDEX_EXPIRED => $expired, 52 => $howto, @@ -78,14 +76,12 @@ public function renderListings(): void { $endTime = (new DateTime())->diff((new DateTime())->setTimestamp($listing->getEndTime())); $listedItem = Locale::get($this->player, "listed-item"); - $lore = str_replace(["%price%", "%seller%", "{D}","{H}", "{M}"], [$listing->getPrice(true, Settings::formatPrice()), $listing->getSeller(), $endTime->days, $endTime->h, $endTime->i], preg_filter('/^/', TextFormat::RESET, $listedItem)); + $lore = str_ireplace(["{PRICE}", "{SELLER}", "{D}","{H}", "{M}"], [$listing->getPrice(true, Settings::formatPrice()), $listing->getSeller(), $endTime->days, $endTime->h, $endTime->i], preg_filter('/^/', TextFormat::RESET, $listedItem)); $lore = Settings::allowLore() ? [...$item->getLore(), ...$lore] : $lore; $item->setLore($lore); $this->getInventory()->setItem($index, $item); } - for($i = count($this->getListings()); $i < 45; ++$i) { - $this->getInventory()->setItem($i, ItemFactory::air()); - } + parent::renderListings(); } public function handle(Player $player, Item $itemClicked, Inventory $inventory, int $slot): bool { diff --git a/src/shock95x/auctionhouse/menu/admin/AdminMenu.php b/src/shock95x/auctionhouse/menu/admin/AdminMenu.php index cfeae7b..99703e6 100644 --- a/src/shock95x/auctionhouse/menu/admin/AdminMenu.php +++ b/src/shock95x/auctionhouse/menu/admin/AdminMenu.php @@ -33,16 +33,14 @@ protected function init(DataStorage $storage): void { Await::f2c(function () use ($storage) { $this->setListings(yield $storage->getListings(yield, (45 * $this->page) - 45) => Await::ONCE); $this->expired = yield $storage->getExpiredCount(yield) => Await::ONCE; - $this->total = yield $storage->getListingCount(yield) => Await::ONCE; + $this->total = yield $storage->getTotalListingCount(yield) => Await::ONCE; $this->pages = (int) ceil($this->total / 45); - }, function () use ($storage) { - parent::init($storage); - }); + }, fn() => parent::init($storage)); } public function renderButtons(): void { parent::renderButtons(); - $stats = Utils::getButtonItem($this->player, "stats", "main-stats-admin", ["%page%", "%max%", "%expired%", "%total%"], [$this->page, $this->pages, $this->expired, $this->total]); + $stats = Utils::getButtonItem($this->player, "stats", "main-stats-admin", ["{PAGE}", "{MAX}", "{EXPIRED}", "{TOTAL}"], [$this->page, $this->pages, $this->expired, $this->total]); $stats->addEnchantment(new EnchantmentInstance(EnchantmentIdMap::getInstance()->fromId(AuctionHouse::FAKE_ENCH_ID))); $this->getInventory()->setItem(self::INDEX_REFRESH, $stats); } @@ -52,13 +50,11 @@ public function renderListings(): void { $item = clone $listing->getItem(); $status = Locale::get($this->player, $listing->isExpired() ? "status-expired" : "status-active"); $listedItem = Locale::get($this->player, "listed-item-admin"); - $item->setLore(str_replace(["%price%", "%seller%", "%status%"], [$listing->getPrice(true, Settings::formatPrice()), $listing->getSeller(), $status], preg_filter('/^/', TextFormat::RESET, $listedItem))); + $item->setLore(str_ireplace(["{PRICE}", "{SELLER}", "{STATUS}"], [$listing->getPrice(true, Settings::formatPrice()), $listing->getSeller(), $status], preg_filter('/^/', TextFormat::RESET, $listedItem))); $this->getInventory()->setItem($index, $item); } - for($i = count($this->getListings()); $i < 45; ++$i) { - $this->getInventory()->setItem($i, ItemFactory::air()); - } + parent::renderListings(); } public function handle(Player $player, Item $itemClicked, Inventory $inventory, int $slot): bool { diff --git a/src/shock95x/auctionhouse/menu/admin/ManageListingMenu.php b/src/shock95x/auctionhouse/menu/admin/ManageListingMenu.php index fcf3eac..db8544f 100644 --- a/src/shock95x/auctionhouse/menu/admin/ManageListingMenu.php +++ b/src/shock95x/auctionhouse/menu/admin/ManageListingMenu.php @@ -18,9 +18,9 @@ class ManageListingMenu extends AHMenu { - const INDEX_DUPLICATE = 39; + const INDEX_DUPLICATE = 38; const INDEX_STATUS = 40; - const INDEX_DELETE = 41; + const INDEX_DELETE = 42; public function __construct(Player $player, AHListing $listing) { $this->setName(Locale::get($player, "manage-listing-name")); @@ -31,9 +31,10 @@ public function __construct(Player $player, AHListing $listing) { public function renderButtons(): void { parent::renderButtons(); $listing = $this->getListings()[0]; - $duplicateItem = ItemFactory::getInstance()->get(ItemIDs::EMERALD_BLOCK)->setCustomName(TextFormat::RESET . Locale::get($this->player, "duplicate-item")); - $listingStatus = ItemFactory::getInstance()->get(ItemIDs::GOLD_BLOCK)->setCustomName(TextFormat::RESET . Locale::get($this->player, $listing->isExpired() ? "listing-active" : "listing-expired")); + $status = Locale::get($this->player, $listing->isExpired() ? "status-expired" : "status-active"); + $listingStatus = ItemFactory::getInstance()->get(ItemIDs::GOLD_BLOCK) + ->setCustomName(str_ireplace("{STATUS}", $status, implode("\n", preg_filter('/^/', TextFormat::RESET, Locale::get($this->player, "listing-status"))))); $deleteItem = ItemFactory::getInstance()->get(ItemIDs::REDSTONE_BLOCK)->setCustomName(TextFormat::RESET . Locale::get($this->player, "delete-item")); $this->inventory->setItem(self::INDEX_DUPLICATE, $duplicateItem); @@ -42,8 +43,7 @@ public function renderButtons(): void { } public function renderListings(): void { - $listing = $this->getListings()[0]; - $this->inventory->setItem(22, $listing->getItem()); + $this->inventory->setItem(22, $this->getListings()[0]->getItem()); } public function handle(Player $player, Item $itemClicked, Inventory $inventory, int $slot): bool { @@ -55,13 +55,13 @@ public function handle(Player $player, Item $itemClicked, Inventory $inventory, case self::INDEX_STATUS: if($listing->isExpired()) { $listing->setExpired(false); + DataStorage::getInstance()->setExpired($listing, value: false); $listing->setEndTime(Utils::getEndTime()); - $inventory->setItem($slot, $itemClicked->setCustomName(TextFormat::RESET . Locale::get($player, "listing-expired"))); } else { $listing->setExpired(); (new AuctionEndEvent($listing, AuctionEndEvent::ADMIN_REMOVED))->call(); - $inventory->setItem($slot, $itemClicked->setCustomName(TextFormat::RESET . Locale::get($player, "listing-active"))); } + $this->renderButtons(); break; case self::INDEX_DELETE: DataStorage::getInstance()->removeListing($listing); diff --git a/src/shock95x/auctionhouse/menu/category/CategoryListMenu.php b/src/shock95x/auctionhouse/menu/category/CategoryListMenu.php index bf138cc..083337e 100644 --- a/src/shock95x/auctionhouse/menu/category/CategoryListMenu.php +++ b/src/shock95x/auctionhouse/menu/category/CategoryListMenu.php @@ -38,7 +38,7 @@ public function renderButtons() : void { $item->setLore([TextFormat::RESET . TextFormat::GRAY . "Click to open category"]); $this->getInventory()->setItem($index, $item); } - $stats = Utils::getButtonItem($this->player, "stats", "category-list-stats", ["%page%", "%max%", "%total%"], [$this->page, $this->pages, $this->total]); + $stats = Utils::getButtonItem($this->player, "stats", "category-list-stats", ["{PAGE}", "{MAX}", "{TOTAL}"], [$this->page, $this->pages, $this->total]); $this->getInventory()->setItem(49, $stats); } diff --git a/src/shock95x/auctionhouse/menu/category/CategoryMenu.php b/src/shock95x/auctionhouse/menu/category/CategoryMenu.php index faf2e69..b88b65e 100644 --- a/src/shock95x/auctionhouse/menu/category/CategoryMenu.php +++ b/src/shock95x/auctionhouse/menu/category/CategoryMenu.php @@ -34,14 +34,12 @@ protected function init(DataStorage $storage): void { $this->setListings(yield $storage->getListings(yield, 0, PHP_INT_MAX) => Await::ONCE); $this->total = count($this->getListings()); $this->pages = (int) ceil($this->total / 45); - }, function () use ($storage) { - parent::init($storage); - }); + }, fn() => parent::init($storage)); } public function renderButtons(): void { parent::renderButtons(); - $stats = Utils::getButtonItem($this->player, "stats", "category-stats", ["%page%", "%max%", "%total%", "%category%"], [$this->page, $this->pages, $this->total, $this->category->getDisplayName()]); + $stats = Utils::getButtonItem($this->player, "stats", "category-stats", ["{PAGE}", "{MAX}", "{TOTAL}", "{CATEGORY}"], [$this->page, $this->pages, $this->total, $this->category->getDisplayName()]); $this->getInventory()->setItem(self::INDEX_REFRESH, $stats); } @@ -52,15 +50,13 @@ public function renderListings(): void { $endTime = (new DateTime())->diff((new DateTime())->setTimestamp($auction->getEndTime())); $listedItem = Locale::get($this->player, "listed-item"); - $lore = str_replace(["%price%", "%seller%", "{D}", "{H}", "{M}"], [$auction->getPrice(true, Settings::formatPrice()), $auction->getSeller(), $endTime->days, $endTime->h, $endTime->i], preg_filter('/^/', TextFormat::RESET, $listedItem)); + $lore = str_ireplace(["{PRICE}", "{SELLER}", "{D}", "{H}", "{M}"], [$auction->getPrice(true, Settings::formatPrice()), $auction->getSeller(), $endTime->days, $endTime->h, $endTime->i], preg_filter('/^/', TextFormat::RESET, $listedItem)); $lore = Settings::allowLore() ? [...$item->getLore(), ...$lore] : $lore; $item->setLore($lore); $this->getInventory()->setItem($key, $item); } - for($i = count($listings); $i < 45; ++$i) { - $this->getInventory()->setItem($i, ItemFactory::air()); - } + parent::renderListings(); } public function handle(Player $player, Item $itemClicked, Inventory $inventory, int $slot): bool { diff --git a/src/shock95x/auctionhouse/menu/player/PlayerListingMenu.php b/src/shock95x/auctionhouse/menu/player/PlayerListingMenu.php index 80a50ac..4a5da2d 100644 --- a/src/shock95x/auctionhouse/menu/player/PlayerListingMenu.php +++ b/src/shock95x/auctionhouse/menu/player/PlayerListingMenu.php @@ -24,7 +24,7 @@ class PlayerListingMenu extends PagingMenu { public function __construct(Player $player, string $username) { $this->username = $username; - $this->setName(str_replace("{player}", $username, Locale::get($player, "player-listing"))); + $this->setName(str_ireplace("{player}", $username, Locale::get($player, "player-listing"))); parent::__construct($player, true); } @@ -33,13 +33,11 @@ protected function init(DataStorage $storage): void { $this->setListings(yield $storage->getActiveListingsByUsername(yield, $this->username, (45 * $this->page) - 45) => Await::ONCE); $this->total = yield $storage->getActiveCountByUsername($this->username, yield) => Await::ONCE; $this->pages = (int) ceil($this->total / 45); - }, function () use ($storage) { - parent::init($storage); - }); + }, fn() => parent::init($storage)); } public function renderButtons() : void { - $stats = Utils::getButtonItem($this->player, "stats", "listings-stats", ["%page%", "%max%", "%total%"], [$this->page, $this->pages, $this->total]); + $stats = Utils::getButtonItem($this->player, "stats", "listings-stats", ["{PAGE}", "{MAX}", "{TOTAL}"], [$this->page, $this->pages, $this->total]); $this->getInventory()->setItem(49, $stats); } @@ -49,15 +47,13 @@ public function renderListings(): void { $endTime = (new DateTime())->diff((new DateTime())->setTimestamp($listing->getEndTime())); $listedItem = Locale::get($this->player, "listed-item"); - $lore = str_replace(["%price%", "%seller%", "{D}", "{H}", "{M}"], [$listing->getPrice(true, Settings::formatPrice()), $listing->getSeller(), $endTime->days, $endTime->h, $endTime->i], preg_filter('/^/', TextFormat::RESET, $listedItem)); + $lore = str_ireplace(["{PRICE}", "{SELLER}", "{D}", "{H}", "{M}"], [$listing->getPrice(true, Settings::formatPrice()), $listing->getSeller(), $endTime->days, $endTime->h, $endTime->i], preg_filter('/^/', TextFormat::RESET, $listedItem)); $lore = Settings::allowLore() ? array_merge($item->getLore(), $lore) : $lore; $item->setLore($lore); $this->getInventory()->setItem($index, $item); } - for($i = count($this->getListings()); $i < 45; ++$i) { - $this->getInventory()->setItem($i, ItemFactory::air()); - } + parent::renderListings(); } public function handle(Player $player, Item $itemClicked, Inventory $inventory, int $slot): bool { diff --git a/src/shock95x/auctionhouse/menu/type/AHMenu.php b/src/shock95x/auctionhouse/menu/type/AHMenu.php index 1bdbf36..f1e1985 100644 --- a/src/shock95x/auctionhouse/menu/type/AHMenu.php +++ b/src/shock95x/auctionhouse/menu/type/AHMenu.php @@ -6,10 +6,11 @@ use muqsit\invmenu\InvMenu; use muqsit\invmenu\InvMenuHandler; use muqsit\invmenu\session\InvMenuInfo; -use muqsit\invmenu\transaction\InvMenuTransaction; +use muqsit\invmenu\transaction\DeterministicInvMenuTransaction; use pocketmine\inventory\Inventory; use pocketmine\item\Item; use pocketmine\item\ItemFactory; +use pocketmine\item\VanillaItems; use pocketmine\player\Player; use pocketmine\scheduler\ClosureTask; use pocketmine\utils\TextFormat; @@ -43,7 +44,7 @@ public function __construct(Player $player, bool $returnMain = false) { $this->player = $player; $this->returnMain = $returnMain; - $this->setListener(InvMenu::readonly(function(InvMenuTransaction $transaction) { + $this->setListener(InvMenu::readonly(function(DeterministicInvMenuTransaction $transaction) { $this->player->getWorld()->addSound($this->player->getPosition(), new ClickSound(), [$this->player]); $this->handle($transaction->getPlayer(), $transaction->getItemClicked(), $transaction->getAction()->getInventory(), $transaction->getAction()->getSlot()); })); @@ -62,7 +63,11 @@ public function renderButtons(): void { } } - public function renderListings(): void {} + public function renderListings(): void { + for($i = count($this->listings); $i < 45; ++$i) { + $this->getInventory()->setItem($i, VanillaItems::AIR()); + } + } public function handle(Player $player, Item $itemClicked, Inventory $inventory, int $slot): bool { if($this->returnMain && $slot == self::INDEX_RETURN) { @@ -74,11 +79,13 @@ public function handle(Player $player, Item $itemClicked, Inventory $inventory, protected function openListing(int $slot, Item $itemClicked): bool { if($slot <= 44 && isset($this->getListings()[$slot])) { Await::f2c(function () use ($itemClicked, $slot) { + $plugin = AuctionHouse::getInstance(); $listing = $this->getListings()[$slot]; - $balance = yield AuctionHouse::getInstance()->getEconomyProvider()->getMoney($this->player, yield) => Await::ONCE; + $balance = yield $plugin->getEconomyProvider()->getMoney($this->player, yield) => Await::ONCE; if($balance < $listing->getPrice()) { + if($itemClicked->getId() == -161) return; $this->getInventory()->setItem($slot, ItemFactory::getInstance()->get(-161)->setCustomName(TextFormat::RESET . Locale::get($this->player, "cannot-afford"))); - AuctionHouse::getInstance()->getScheduler()->scheduleDelayedTask(new ClosureTask(function () use ($itemClicked, $slot) { + $plugin->getScheduler()->scheduleDelayedTask(new ClosureTask(function () use ($itemClicked, $slot) { $this->inventory?->setItem($slot, $itemClicked); }), 40); } else { @@ -115,16 +122,13 @@ public function onClose(Player $player): void { public static function open(self $menu, bool $newWindow = true): void { $session = InvMenuHandler::getPlayerManager()->get($menu->player); - if($session->getCurrent() == null) { - $menu->send($menu->player); - return; - } $currentMenu = $session->getCurrent()?->menu; - if($newWindow && $currentMenu instanceof AHMenu) { - $currentMenu->player->removeCurrentWindow(); + if($session->getCurrent() == null || ($newWindow && $currentMenu instanceof AHMenu)) { $menu->send($menu->player); return; } - $session->setCurrentMenu(new InvMenuInfo($menu, $session->getCurrent()->graphic)); + $currentMenu->getInventory()->clearAll(); + $currentMenu->setInventory($menu->getInventory()); + $currentMenu->setListener($menu->listener); } } \ No newline at end of file diff --git a/src/shock95x/auctionhouse/task/CheckLegacyTask.php b/src/shock95x/auctionhouse/task/CheckLegacyTask.php index e80ce62..489a2a7 100644 --- a/src/shock95x/auctionhouse/task/CheckLegacyTask.php +++ b/src/shock95x/auctionhouse/task/CheckLegacyTask.php @@ -14,9 +14,7 @@ public function __construct(private AuctionHouse $plugin) {} public function onRun(): void { Await::f2c(function () { if(yield LegacyConverter::getInstance()->isLegacy()) { - $this->plugin->getLogger()->info("Old database format detected, converting..."); - yield LegacyConverter::getInstance()->convert(); - $this->plugin->getLogger()->info("Conversion complete!"); + $this->plugin->getLogger()->notice("Old database format detected! Run '/ah convert' to update"); } }); } diff --git a/src/shock95x/auctionhouse/task/ListingExpireTask.php b/src/shock95x/auctionhouse/task/ListingExpireTask.php index 6614bdb..2eb5e8d 100644 --- a/src/shock95x/auctionhouse/task/ListingExpireTask.php +++ b/src/shock95x/auctionhouse/task/ListingExpireTask.php @@ -3,6 +3,7 @@ use DateTime; use pocketmine\scheduler\Task; +use shock95x\auctionhouse\AHListing; use shock95x\auctionhouse\database\Database; use shock95x\auctionhouse\database\storage\DataStorage; use shock95x\auctionhouse\event\AuctionEndEvent; @@ -17,12 +18,12 @@ public function onRun(): void { Await::f2c(function () { $time = new DateTime(); $dataStorage = DataStorage::getInstance(); - $listings = $this->createListingsFromRows(yield $this->database->asyncSelectRaw("SELECT * from auctions WHERE :time >= end_time AND expired = FALSE;", ["time" => time()])); + $listings = $this->createListingsFromRows(yield $this->database->asyncSelectRaw("SELECT * from listings WHERE :time >= end_time AND expired = FALSE;", ["time" => time()])); foreach ($listings as $listing) { yield $dataStorage->setExpired($listing, yield) => Await::ONCE; (new AuctionEndEvent($listing, AuctionEndEvent::EXPIRED))->call(); } - $listings = $this->createListingsFromRows(yield $this->database->asyncSelectRaw("SELECT * from auctions WHERE expired = TRUE;")); + $listings = $this->createListingsFromRows(yield $this->database->asyncSelectRaw("SELECT * from listings WHERE expired = TRUE;")); foreach ($listings as $listing) { $time->setTimestamp($listing->getEndTime()); if($time->diff(new DateTime())->days >= Settings::getExpiredDuration()) { @@ -33,11 +34,15 @@ public function onRun(): void { }); } - private function createListingsFromRows(array $listings): array { - $array = []; - foreach ($listings as $rows) { - $array[] = $this->database->createListingFromRows($rows); + /** + * @param array $rows + * @return AHListing[] + */ + private function createListingsFromRows(array $rows): array { + $listings = []; + foreach ($rows as $row) { + $listings[] = $this->database->createListingFromRows($row); } - return $array; + return $listings; } } \ No newline at end of file diff --git a/src/shock95x/auctionhouse/utils/Utils.php b/src/shock95x/auctionhouse/utils/Utils.php index 811f31c..143ea4c 100644 --- a/src/shock95x/auctionhouse/utils/Utils.php +++ b/src/shock95x/auctionhouse/utils/Utils.php @@ -3,7 +3,6 @@ namespace shock95x\auctionhouse\utils; - use pocketmine\inventory\Inventory; use pocketmine\item\Item; use pocketmine\item\LegacyStringToItemParser; @@ -51,7 +50,7 @@ public static function getButtonItem(Player $player, string $itemKey, string $me $item = LegacyStringToItemParser::getInstance()->parse(Settings::getButtons()[$itemKey]); $message = Locale::get($player, $messageKey); - $item->setCustomName(TextFormat::RESET . str_replace($searchArgs, $replaceArgs, $message["name"])); + $item->setCustomName(TextFormat::RESET . str_ireplace($searchArgs, $replaceArgs, $message["name"])); if(isset($message["lore"])) { if(is_array($message["lore"])) $item->setLore(preg_filter('/^/', TextFormat::RESET, str_replace($searchArgs, $replaceArgs, $message["lore"]))); } @@ -90,7 +89,7 @@ public static function checkConfig(Plugin $plugin, Config $config, string $key, $plugin->saveResource($configDir); $message = "Your {$info["basename"]} file is outdated. Your old {$info["basename"]} has been saved as $oldFile and a new {$info["basename"]} file has been created. Please update accordingly."; - $plugin->getScheduler()->scheduleDelayedTask(new ClosureTask(function() use ($plugin, $message): void{ + $plugin->getScheduler()->scheduleDelayedTask(new ClosureTask(function() use ($plugin, $message): void { $plugin->getLogger()->critical($message); }), 1); // should display once the server is done loading }