mcl titles instead chat msgs

This commit is contained in:
Freeman 2023-01-02 23:30:37 +01:00
parent a08c989040
commit 5fe12e55ab
3 changed files with 8 additions and 8 deletions

@ -31,7 +31,7 @@ function emeraldbank.add_emeralds(player, num)
local name = player:get_player_name()
if num then
meta:set_int("emeraldbank:emerald", bankemeralds+num)
core.chat_send_player(name, S("Emeralds in Bank: @1", bankemeralds+num) )
mcl_title.set(player, "actionbar", {text=S("Emeralds in Bank: @1", bankemeralds+num), color="yellow"})
return true
end
return false
@ -51,7 +51,7 @@ function emeraldbank.keep(player, itemstack)
emeraldbank.add_emeralds(player, itemcount*9)
return true
end
core.chat_send_player(name, S("You need keep emeralds or emeraldblocks in your hand!") )
mcl_title.set(player, "actionbar", {text=S("You need keep emeralds or emeraldblocks in your hand!"), color="red"})
return false
end
@ -69,7 +69,7 @@ function emeraldbank.take(player)
core.add_item(pos, "mcl_core:emerald "..num)
return true
end
core.chat_send_player(name, S("Not enough Emeralds in your account") )
mcl_title.set(player, "actionbar", {text=S("Not enough Emeralds in your account"), color="red"})
return false
end

@ -1,5 +1,5 @@
name = emeraldbank
depends = mcl_core, mcl_sounds, mcl_inventory, mcl_formspec
depends = mcl_core, mcl_sounds, mcl_inventory, mcl_formspec, mcl_title
optional_depends = irc
description = Keep your Emeralds in a bank
description = Keep your Emeralds in a bank! And trade with shops.
supported_games = mineclone2, mineclone5

@ -298,7 +298,7 @@ core.register_on_player_receive_fields(function(sender, formname, fields)
-- owner try exchanges
if meta:get_string("owner") == name then
core.chat_send_player(name, S("This is your own shop, you can't exchange to yourself!"))
mcl_title.set(sender, "subtitle", {text=S("This is your own shop, you can't exchange to yourself!"), color="red"})
else
@ -307,13 +307,13 @@ core.register_on_player_receive_fields(function(sender, formname, fields)
-- have u money?
if bankemeralds < old_price then
can_exchange = false
core.chat_send_player(name, S("Not enough Emeralds in your account") )
mcl_title.set(sender, "subtitle", {text=S("Not enough Emeralds in your account"), color="red"})
end
--there are enough items?
if not minv:contains_item("stock", shop_item.." "..old_count, true) then
can_exchange = false
core.chat_send_player(name, S("Out of Stock!") )
mcl_title.set(sender, "subtitle", {text=S("Out of Stock!"), color="red"})
end
-- do not trade air