mirror of
https://codeberg.org/usrib/emeraldbank.git
synced 2024-08-20 13:24:08 +02:00
mcl titles instead chat msgs
This commit is contained in:
parent
a08c989040
commit
5fe12e55ab
6
bank.lua
6
bank.lua
@ -31,7 +31,7 @@ function emeraldbank.add_emeralds(player, num)
|
|||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if num then
|
if num then
|
||||||
meta:set_int("emeraldbank:emerald", bankemeralds+num)
|
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
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
@ -51,7 +51,7 @@ function emeraldbank.keep(player, itemstack)
|
|||||||
emeraldbank.add_emeralds(player, itemcount*9)
|
emeraldbank.add_emeralds(player, itemcount*9)
|
||||||
return true
|
return true
|
||||||
end
|
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
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ function emeraldbank.take(player)
|
|||||||
core.add_item(pos, "mcl_core:emerald "..num)
|
core.add_item(pos, "mcl_core:emerald "..num)
|
||||||
return true
|
return true
|
||||||
end
|
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
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
4
mod.conf
4
mod.conf
@ -1,5 +1,5 @@
|
|||||||
name = emeraldbank
|
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
|
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
|
supported_games = mineclone2, mineclone5
|
6
shop.lua
6
shop.lua
@ -298,7 +298,7 @@ core.register_on_player_receive_fields(function(sender, formname, fields)
|
|||||||
|
|
||||||
-- owner try exchanges
|
-- owner try exchanges
|
||||||
if meta:get_string("owner") == name then
|
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
|
else
|
||||||
|
|
||||||
@ -307,13 +307,13 @@ core.register_on_player_receive_fields(function(sender, formname, fields)
|
|||||||
-- have u money?
|
-- have u money?
|
||||||
if bankemeralds < old_price then
|
if bankemeralds < old_price then
|
||||||
can_exchange = false
|
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
|
end
|
||||||
|
|
||||||
--there are enough items?
|
--there are enough items?
|
||||||
if not minv:contains_item("stock", shop_item.." "..old_count, true) then
|
if not minv:contains_item("stock", shop_item.." "..old_count, true) then
|
||||||
can_exchange = false
|
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
|
end
|
||||||
|
|
||||||
-- do not trade air
|
-- do not trade air
|
||||||
|
Loading…
Reference in New Issue
Block a user