Skip to content

Commit

Permalink
fix: admin utils
Browse files Browse the repository at this point in the history
  • Loading branch information
leaftail1880 committed Sep 2, 2024
1 parent 5d5283d commit 37d2fe1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/lib/crates/crate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LocationInUnloadedChunkError, Player, system, world, type ShortcutDimensions } from '@minecraft/server'
import { MinecraftBlockTypes } from '@minecraft/vanilla-data'
import { is } from 'lib'
import { form } from 'lib/form/new'
import { FloatingText } from 'lib/rpg/floating-text'
import { LootTable } from 'lib/rpg/loot-table'
Expand Down Expand Up @@ -100,6 +101,13 @@ export class Crate {
player.fail('Пока не работает.')
})
.button('Посмотреть содержимое', this.previewItems.show)

if (is(player.id, 'techAdmin'))
f.button('admin: get key', () => {
const item = this.createKeyItemStack()
item.amount = 10
player.container?.addItem(item)
})
})

private previewItems = lootTablePreview(this.lootTable, t.header`${this.name + ' ящик'} > Содержимое`, true)
Expand Down
4 changes: 2 additions & 2 deletions src/modules/commands/items.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ItemStack } from '@minecraft/server'
import { ArrayForm, langToken } from 'lib'
import { ArrayForm, langToken, translateToken } from 'lib'

export const customItems: ItemStack[] = []

Expand All @@ -10,7 +10,7 @@ new Command('items')
new ArrayForm('Items', customItems)
.button(item => {
return [
`${item.nameTag ?? `%${langToken(item.typeId)}`}\n${item.getLore().join('')}`,
`${item.nameTag ?? translateToken(ctx.player.lang, langToken(item.typeId))}\n${item.getLore().join('')}`,
() => ctx.player.container?.addItem(item),
]
})
Expand Down

0 comments on commit 37d2fe1

Please sign in to comment.