-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmd_testItemMod.lua
More file actions
20 lines (17 loc) · 753 Bytes
/
cmd_testItemMod.lua
File metadata and controls
20 lines (17 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
local enchants = cEnchantments() -- https://api.cuberite.org/cEnchantments.html
enchants:SetLevel(cEnchantments.enchFortune , 4)
enchants:SetLevel(cEnchantments.enchEfficiency, 6)
---@param split table<number, string> # https://api.cuberite.org/Writing-a-Cuberite-plugin.html
---@param player table # https://api.cuberite.org/cPlayer.html
function HandleTestItemModCommand(split, player)
item = player:GetEquippedItem()
if cItem.IsEmpty(item) == false then
enchanted = cItem(item) -- https://api.cuberite.org/cItem.html
enchanted.m_CustomName = 'modItem'
enchanted.m_Enchantments = enchants
inventory = player:GetInventory()
inventory:RemoveOneEquippedItem()
inventory:SetEquippedItem(enchanted)
end
return true
end