0.7.1
This commit is contained in:
parent
5b097c00f6
commit
59f898ad56
@ -8,8 +8,8 @@ function show_ban_menu(name)
|
||||
field[4.5,0.6;6.8,1;player;Player name;]
|
||||
field[4.5,2.1;6.8,1;reason;Reason of ban;]
|
||||
button[4.5,3.3;6.8,1.1;ban_btn;Ban the player]
|
||||
image[0.2,0.2;4.2,4.2;ban_user.png]
|
||||
image_button_exit[11.4,0.1;1,1;close_btn.png;close_btn;]
|
||||
image[0.2,0.2;4.2,4.2;essentials_ban_user.png]
|
||||
image_button_exit[11.4,0.1;1,1;essentials_close_btn.png;close_btn;]
|
||||
]]
|
||||
|
||||
minetest.show_formspec(name, FORMNAME, formspec)
|
||||
@ -21,6 +21,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
return
|
||||
end
|
||||
|
||||
if fields.close_btn then
|
||||
minetest.sound_play("clicked", name)
|
||||
end
|
||||
|
||||
if fields.ban_btn then
|
||||
local player_ban = minetest.get_player_by_name(fields.player)
|
||||
local player_banned = fields.player
|
||||
@ -28,14 +32,18 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
||||
if core.is_singleplayer() then
|
||||
minetest.chat_send_player(name, core.colorize("red", "You cannot ban in single mode!"))
|
||||
minetest.sound_play("error", name)
|
||||
elseif not player_ban then
|
||||
minetest.chat_send_player(name, core.colorize("red", "Player not found!"))
|
||||
minetest.sound_play("error", name)
|
||||
elseif reason_ban == "" then
|
||||
core.ban_player(fields.player)
|
||||
core.chat_send_all("Banned ".. player_banned ..".")
|
||||
minetest.sound_play("player_banned")
|
||||
else
|
||||
core.ban_player(fields.player)
|
||||
core.chat_send_all("Banned ".. player_banned .." for ".. reason_ban ..".")
|
||||
minetest.sound_play("player_banned")
|
||||
end
|
||||
end
|
||||
return
|
||||
|
50
ui/color_menu.lua
Normal file
50
ui/color_menu.lua
Normal file
@ -0,0 +1,50 @@
|
||||
local FORMNAME = "essentials:color_menu"
|
||||
|
||||
local function convertColor(table)
|
||||
local hex = string.format("#%02X%02X%02X", table.r, table.g, table.b)
|
||||
return hex
|
||||
end
|
||||
|
||||
minetest.register_on_chat_message(function(name, message)
|
||||
local prop = minetest.get_player_by_name(name):get_properties()
|
||||
minetest.chat_send_player(name, dump(prop.nametag_color))
|
||||
minetest.chat_send_all(core.format_chat_message(core.colorize(convertColor(prop.nametag_color), name), message))
|
||||
return true
|
||||
end)
|
||||
|
||||
function show_color_menu(name)
|
||||
local formspec = [[
|
||||
formspec_version[6]
|
||||
size[10,8]
|
||||
button[2.9,6.5;4.4,1.2;done;Accept]
|
||||
image_button_exit[8.8,0.2;1,1;essentials_close_btn.png;close_btn;]
|
||||
field[1.5,4.4;7.2,1.1;color;Color;]
|
||||
label[1.7,5.9;Or hex color or common color (red\, blue\, etc.)]
|
||||
label[2.7,1.6;Select color for your nickname]
|
||||
]]
|
||||
|
||||
minetest.show_formspec(name, FORMNAME, formspec)
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= FORMNAME then
|
||||
return
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
if fields.close_btn then
|
||||
minetest.sound_play("clicked", name)
|
||||
end
|
||||
if fields.done then
|
||||
if core.is_singleplayer() then
|
||||
minetest.chat_send_player(name, core.colorize("red", "Cannot coloring nickname or other in singleplayer"))
|
||||
minetest.sound_play("error")
|
||||
return
|
||||
end
|
||||
player:set_properties({
|
||||
nametag_color = fields.color
|
||||
})
|
||||
minetest.sound_play("clicked", name)
|
||||
minetest.close_formspec(name, formname)
|
||||
end
|
||||
return
|
||||
end)
|
@ -8,8 +8,8 @@ function show_kick_menu(name)
|
||||
field[1.2,0.6;6.8,1;player;Player name;]
|
||||
field[1.2,2.1;6.8,1;reason;Reason of kick;]
|
||||
button[1.2,3.3;6.8,1.1;kick_btn;Kick the player]
|
||||
image[8.2,0.2;4.2,4.2;kick_user.png]
|
||||
image_button_exit[0.1,0.1;1,1;close_btn.png;close_btn;]
|
||||
image[8.2,0.2;4.2,4.2;essentials_kick_user.png]
|
||||
image_button_exit[0.1,0.1;1,1;essentials_close_btn.png;close_btn;]
|
||||
]]
|
||||
|
||||
minetest.show_formspec(name, FORMNAME, formspec)
|
||||
@ -21,6 +21,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
return
|
||||
end
|
||||
|
||||
if fields.close_btn then
|
||||
minetest.sound_play("clicked", name)
|
||||
end
|
||||
|
||||
if fields.kick_btn then
|
||||
local player_kick = minetest.get_player_by_name(fields.player)
|
||||
local player_kicked = fields.player
|
||||
@ -28,14 +32,18 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
||||
if core.is_singleplayer() then
|
||||
minetest.chat_send_player(name, core.colorize("red", "You cannot kick in single mode!"))
|
||||
minetest.sound_play("error", name)
|
||||
elseif not player_kick then
|
||||
minetest.chat_send_player(name, core.colorize("red", "Player not found!"))
|
||||
minetest.sound_play("error", name)
|
||||
elseif reason_kick == "" then
|
||||
core.kick_player(fields.player, fields.reason)
|
||||
core.chat_send_all("Kicked ".. player_kicked ..".")
|
||||
minetest.sound_play("player_kicked")
|
||||
else
|
||||
core.kick_player(fields.player, fields.reason)
|
||||
core.chat_send_all("Kicked ".. player_kicked .." for ".. reason_kick ..".")
|
||||
minetest.sound_play("player_kicked")
|
||||
end
|
||||
end
|
||||
return
|
||||
|
@ -1,4 +1,4 @@
|
||||
local FORMNAME = "essentials:ban_menu"
|
||||
local FORMNAME = "essentials:mute_menu"
|
||||
|
||||
-- ban menu
|
||||
function show_mute_menu(name)
|
||||
@ -7,8 +7,8 @@ function show_mute_menu(name)
|
||||
size[4.5,9.6]
|
||||
field[0.1,4.9;4.3,1.1;player;Player for mute;]
|
||||
button[0.1,6.1;4.3,1.1;mute_btn;Mute the player]
|
||||
image[0.1,0.1;4.3,4.3;mute_user.png]
|
||||
image_button_exit[3.4,8.5;1,1;close_btn.png;close_btn;]
|
||||
image[0.1,0.1;4.3,4.3;essentials_mute_user.png]
|
||||
image_button_exit[3.4,8.5;1,1;essentials_close_btn.png;close_btn;]
|
||||
button[0.1,7.3;4.3,1.1;unmute_btn;Unmute the player]
|
||||
]]
|
||||
|
||||
@ -20,6 +20,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
return
|
||||
end
|
||||
|
||||
if fields.close_btn then
|
||||
minetest.sound_play("clicked", name)
|
||||
end
|
||||
|
||||
if fields.unmute_btn then
|
||||
local admin = player:get_player_name()
|
||||
local player_mutted = fields.player
|
||||
@ -27,12 +31,16 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
||||
if core.is_singleplayer() then
|
||||
minetest.chat_send_player(admin, core.colorize("red", "You cannot mute in single mode!"))
|
||||
minetest.sound_play("error", name)
|
||||
elseif player_mutted == "" then
|
||||
minetest.chat_send_player(admin, core.colorize("red", "Player name cannot be empty!"))
|
||||
minetest.sound_play("error", name)
|
||||
elseif not player then
|
||||
minetest.chat_send_player(admin, core.colorize("red", "Player not found!"))
|
||||
minetest.sound_play("error", name)
|
||||
elseif privs.shout == true then
|
||||
minetest.chat_send_player(admin, core.colorize("red", "Player already unmuted!"))
|
||||
minetest.sound_play("error", name)
|
||||
else
|
||||
local privs = minetest.get_player_privs(fields.player)
|
||||
minetest.chat_send_all(player_mutted .. " has been unmuted.")
|
||||
@ -48,12 +56,16 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
||||
if core.is_singleplayer() then
|
||||
minetest.chat_send_player(admin, core.colorize("red", "You cannot mute in single mode!"))
|
||||
minetest.sound_play("error", name)
|
||||
elseif player_mutted == "" then
|
||||
minetest.chat_send_player(admin, core.colorize("red", "Player name cannot be empty!"))
|
||||
minetest.sound_play("error", name)
|
||||
elseif not player then
|
||||
minetest.chat_send_player(admin, core.colorize("red", "Player not found!"))
|
||||
minetest.sound_play("error", name)
|
||||
elseif privs.shout == true then
|
||||
minetest.chat_send_player(admin, core.colorize("red", "Player already muted!"))
|
||||
minetest.sound_play("error", name)
|
||||
else
|
||||
local privs = minetest.get_player_privs(fields.player)
|
||||
minetest.chat_send_all(player_mutted .. " has been muted.")
|
||||
|
59
ui/rename_item.lua
Normal file
59
ui/rename_item.lua
Normal file
@ -0,0 +1,59 @@
|
||||
local FORMNAME = "essentials:rename_item"
|
||||
|
||||
function show_renameitem_menu(name)
|
||||
local formspec = string.format([[
|
||||
formspec_version[6]
|
||||
size[9.6,9.6]
|
||||
field[2.7,6.2;4.3,1.1;new_name;New name;]
|
||||
button[0.1,8.3;9.4,1.2;rename;Rename]
|
||||
image_button_exit[8.5,0.1;1,1;essentials_close_btn.png;close_btn;]
|
||||
label[3.2,0.9;Hold item in hand and]
|
||||
label[3.1,1.4;press "Rename" button]
|
||||
label[1.8,1.9;(Empty name for reset name of the item)]
|
||||
checkbox[3.7,4;format;Formatting;%s]
|
||||
label[2.8,0.3;--=How to rename item?=--]
|
||||
tooltip[format;Allows you to use "Minetest Lua" code for make text more cooler!]
|
||||
]],
|
||||
minetest.get_player_by_name(name):get_meta()
|
||||
:get_string("essentials_item_renamer_formatting")
|
||||
)
|
||||
|
||||
minetest.show_formspec(name, FORMNAME, formspec)
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, field)
|
||||
local itemstack = player:get_wielded_item()
|
||||
local meta = itemstack:get_meta()
|
||||
--local color = field.color
|
||||
|
||||
if formname ~= FORMNAME then
|
||||
return
|
||||
end
|
||||
|
||||
if field.format ~= nil then
|
||||
local pmeta = player:get_meta()
|
||||
pmeta:set_string("essentials_item_renamer_formatting", field.format)
|
||||
return
|
||||
end
|
||||
|
||||
if field.close_btn then
|
||||
minetest.sound_play("clicked")
|
||||
return
|
||||
end
|
||||
|
||||
if not field.rename then return end
|
||||
|
||||
local format = player:get_meta()
|
||||
:get_string("essentials_item_renamer_formatting")
|
||||
|
||||
if format == "true" then
|
||||
local parsed = loadstring("return " .. field.new_name)
|
||||
meta:set_string("description", parsed())
|
||||
else
|
||||
meta:set_string("description", field.new_name)
|
||||
end
|
||||
|
||||
--meta:set_string("color", field.color)
|
||||
player:set_wielded_item(itemstack)
|
||||
minetest.close_formspec(player:get_player_name(), formname)
|
||||
end)
|
102
ui/rename_me.lua
Normal file
102
ui/rename_me.lua
Normal file
@ -0,0 +1,102 @@
|
||||
local FORMNAME = "essentials:rename_me"
|
||||
hide_names = {}
|
||||
|
||||
minetest.register_on_chat_message(function(name, message)
|
||||
local new_name = hide_names[name]
|
||||
if new_name then
|
||||
minetest.chat_send_all(core.format_chat_message(core.colorize(color, new_name), message))
|
||||
return true
|
||||
end
|
||||
end)
|
||||
|
||||
function show_rename_menu(name)
|
||||
local formspec = [[
|
||||
formspec_version[6]
|
||||
size[4.5,11]
|
||||
field[0.1,5.3;4.3,1.1;new_name;New name;]
|
||||
button[0.1,9.7;4.3,1.2;rename;Rename]
|
||||
image_button_exit[3.4,0.1;1,1;essentials_close_btn.png;close_btn;]
|
||||
field[0.1,8.5;4.3,1.1;color;Color;]
|
||||
image[0.4,1.2;3.7,3.7;essentials_sussy_amogus_name.png]
|
||||
field[0.1,6.9;4.3,1.1;name;Player (Empty for yourself);]
|
||||
]]
|
||||
|
||||
minetest.show_formspec(name, FORMNAME, formspec)
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, field)
|
||||
local name = player:get_player_name();
|
||||
local new_name = field.new_name
|
||||
local color = field.color
|
||||
local othername = field.name
|
||||
if formname ~= FORMNAME then
|
||||
return
|
||||
end
|
||||
|
||||
if field.close_btn then
|
||||
minetest.sound_play("clicked")
|
||||
end
|
||||
|
||||
if field.rename then
|
||||
if core.is_singleplayer() then
|
||||
minetest.chat_send_player(name, core.colorize("red", "Cannot rename yourself or other in singleplayer"))
|
||||
minetest.sound_play("error")
|
||||
return
|
||||
end
|
||||
if othername == "" then
|
||||
if new_name == "" then
|
||||
minetest.chat_send_player(name, core.colorize("red", "New name cannot be empty!"))
|
||||
minetest.sound_play("error")
|
||||
elseif color == "" then
|
||||
hide_names[name] = new_name
|
||||
minetest.chat_send_player(name, core.colorize("green", "Name changed to '".. new_name .."'"))
|
||||
minetest.sound_play("done")
|
||||
player:set_properties({
|
||||
nametag = "*".. new_name,
|
||||
nametag_color = "#AAAAAA"
|
||||
})
|
||||
minetest.close_formspec(name, formname)
|
||||
else
|
||||
hide_names[name] = new_name
|
||||
minetest.chat_send_player(name, core.colorize("green", "Name changed to '".. new_name .."' with ").. core.colorize(color, "Color ".. color))
|
||||
minetest.sound_play("done")
|
||||
player:set_properties({
|
||||
nametag = core.colorize("#AAAAAA", "*").. core.colorize(color, new_name)
|
||||
})
|
||||
minetest.close_formspec(name, formname)
|
||||
end
|
||||
else
|
||||
if minetest.get_player_by_name(othername) == nil then
|
||||
minetest.chat_send_player(name, core.colorize("red", string.format("Player \"%s\" doesnt exist or offline!", othername)))
|
||||
return
|
||||
end
|
||||
if new_name == "" then
|
||||
minetest.chat_send_player(name, core.colorize("red", "New name cannot be empty!"))
|
||||
minetest.sound_play("error")
|
||||
elseif 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"
|
||||
})
|
||||
minetest.close_formspec(name, formname)
|
||||
else
|
||||
hide_names[name] = new_name
|
||||
minetest.chat_send_player(name, string.format("Name of %s changed to \'%s\' with %s", othername, new_name, core.colorize(color, "color ".. color)))
|
||||
if essentials.changed_by then
|
||||
minetest.chat_send_player(othername, core.colorize("green", "Your name changed to \'".. new_name .."\' with color ".. core.colorize(color, "color ".. color) .." by ".. name))
|
||||
end
|
||||
minetest.sound_play("done")
|
||||
minetest.get_player_by_name(othername):set_properties({
|
||||
nametag = core.colorize("#AAAAAA", "*").. core.colorize(color, new_name)
|
||||
})
|
||||
minetest.close_formspec(name, formname)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
52
ui/watermark.lua
Normal file
52
ui/watermark.lua
Normal file
@ -0,0 +1,52 @@
|
||||
local defs = {
|
||||
{
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0.02, y = 0.035},
|
||||
offset = {x = 0, y = 0},
|
||||
text = "essentials_logo.png",
|
||||
scale = { x = 1, y = 1},
|
||||
alignment = { x = 0, y = 0 },
|
||||
},
|
||||
{
|
||||
hud_elem_type = "text",
|
||||
position = {x = 0.055, y = 0.0145},
|
||||
offset = {x = 0, y = 0},
|
||||
text = "Essentials",
|
||||
alignment = -1,
|
||||
scale = { x = 50, y = 10},
|
||||
number = 0x00FFFF,
|
||||
},
|
||||
{
|
||||
hud_elem_type = "text",
|
||||
position = {x = 0.081, y = 0.03},
|
||||
offset = {x = 0, y = 0},
|
||||
text = "Powered and created by",
|
||||
alignment = -1,
|
||||
scale = { x = 50, y = 10},
|
||||
number = 0xFFFFFF,
|
||||
},
|
||||
{
|
||||
hud_elem_type = "text",
|
||||
position = {x = 0.075, y = 0.047},
|
||||
offset = {x = 0, y = 0},
|
||||
text = "SkyBuilder1717",
|
||||
alignment = -1,
|
||||
scale = { x = 50, y = 10},
|
||||
number = 0x00FF00,
|
||||
}
|
||||
}
|
||||
local hud
|
||||
|
||||
if essentials.watermark then
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
for i, def in pairs(defs) do
|
||||
hud = player:hud_add(def)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
for i, def in pairs(defs) do
|
||||
player:hud_remove(def)
|
||||
end
|
||||
end)
|
Loading…
x
Reference in New Issue
Block a user