From 8dcdce2b392a98ba7d25e2cd169c5737734d78f1 Mon Sep 17 00:00:00 2001 From: BlackImpostor <106878493+SkyBuilder1717@users.noreply.github.com> Date: Fri, 17 May 2024 23:05:53 +0300 Subject: [PATCH] 0.7.4 --- ui/color_menu.lua | 1 + ui/ip.lua | 15 +++++++++++++++ ui/rename_item.lua | 7 +++++++ ui/rename_me.lua | 18 ++++++++++++++---- 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 ui/ip.lua diff --git a/ui/color_menu.lua b/ui/color_menu.lua index 083d1ba..6de0951 100644 --- a/ui/color_menu.lua +++ b/ui/color_menu.lua @@ -43,6 +43,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) player:set_properties({ nametag_color = fields.color }) + player:get_meta():set_string("essentials_color", fields.color) minetest.sound_play("clicked", name) minetest.close_formspec(name, formname) end diff --git a/ui/ip.lua b/ui/ip.lua new file mode 100644 index 0000000..ffba48d --- /dev/null +++ b/ui/ip.lua @@ -0,0 +1,15 @@ +local FORMNAME = "essentials:ip_command" + +function show_ip_info(name) + local formspec = "formspec_version[6]".. + "size[10.5,4.5]".. + "textarea[0.6,0.45;9.2,5.7;;;If you want to use /ip command, you must send a mail to the next address:\n\n"..core.colorize("blue", "SkyBuilderOFFICAL@yandex.ru").."\n\nAnd your message must have that text:\n\n\"I want to use a /ip command for Essentials mod in Minetest.\"\n\"Add a nickname \'Player\' in trusted ip users\"\n\nIf you will accepted, creator will put you in list of trusted ip users and you will can use /ip command]" + minetest.show_formspec(name, FORMNAME, formspec) +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= FORMNAME then + return + end + return +end) \ No newline at end of file diff --git a/ui/rename_item.lua b/ui/rename_item.lua index d404ff7..26d2eae 100644 --- a/ui/rename_item.lua +++ b/ui/rename_item.lua @@ -1,6 +1,13 @@ local FORMNAME = "essentials:rename_item" function show_renameitem_menu(name) + local player = minetest.get_player_by_name(name) + if player:get_wielded_item():get_name() == "" then + minetest.chat_send_player(name, core.colorize("red", "Cant rename an empty item.")) + minetest.sound_play("error") + return + end + local formspec = string.format([[ formspec_version[6] size[9.6,9.6] diff --git a/ui/rename_me.lua b/ui/rename_me.lua index bd528c3..e51e8fd 100644 --- a/ui/rename_me.lua +++ b/ui/rename_me.lua @@ -47,7 +47,12 @@ minetest.register_on_player_receive_fields(function(player, formname, field) if new_name == "" then minetest.chat_send_player(name, core.colorize("red", "New name cannot be empty!")) minetest.sound_play("error") - elseif color == "" then + return + end + minetest.get_player_by_name(name):set_properties({ + nametag_color = "", + }) + if color == "" then hide_names[name] = new_name minetest.chat_send_player(name, core.colorize("green", "Name changed to '".. new_name .."'")) minetest.sound_play("done") @@ -73,16 +78,21 @@ minetest.register_on_player_receive_fields(function(player, formname, field) if new_name == "" then minetest.chat_send_player(name, core.colorize("red", "New name cannot be empty!")) minetest.sound_play("error") - elseif color == "" then + return + end + minetest.get_player_by_name(othername):set_properties({ + nametag_color = "", + }) + if color == "" then hide_names[name] = new_name minetest.chat_send_player(name, core.colorize("green", "Name of ".. othername .." changed to '".. new_name .."'")) if essentials.changed_by then minetest.chat_send_player(othername, core.colorize("green", "Your name changed to \'".. new_name .."\' by ".. name)) end minetest.sound_play("done") + minetest.get_player_by_name(othername):set_properties({ - nametag = "*".. new_name, - nametag_color = "#AAAAAA" + nametag = core.colorize("#AAAAAA", "*"..new_name), }) minetest.close_formspec(name, formname) else