Skip to content

Добавлен плагин priv_cc#123

Open
lord-papirus wants to merge 5 commits intomt-mods:masterfrom
lord-server-forks:master
Open

Добавлен плагин priv_cc#123
lord-papirus wants to merge 5 commits intomt-mods:masterfrom
lord-server-forks:master

Conversation

@lord-papirus
Copy link

@lord-papirus lord-papirus commented Dec 6, 2024

Added priv_cc plugin
The plugin creates a new privilege that allows players to create a new channel (cc/create_channel) Users without this privilege cannot create a channel. The plugin is enabled/disabled via minetest.conf beerchat.enable_priv_cc = true/false
The privilege name can be set in minetest.conf (by default it is created with the name chat_creator without specifying it in the config) beer chat.name_priv_cc = chat_creator

Плагин создает новую привилегию которая дает возможность игрокам создавать новый канал (cc/create_channel)
Пользователи без этой привилении создавать канал не могут.
Плагин включается/отключается через minetest.conf
eerchat.enable_priv_cc = true/false
Имя привилегии можно задать в minetest.conf (по умолчанию создается с именем chat_creator без указания в конфиге)
beerchat.name_priv_cc = chat_creator

Added priv_cc plugin
The plugin creates a new privilege that allows players to create a new channel (cc/create_channel)
Users without this privilege cannot create a channel.
The plugin is enabled/disabled via minetest.conf
eerchat.enable_priv_cc = true/false
The privilege name can be set in minetest.conf (by default it is created with the name chart_creator without specifying it in the config)
beer chat.name_priv_cc = chat_creator
@wsor4035
Copy link

wsor4035 commented Dec 6, 2024

seems you have some luacheck errors to fix

@lord-papirus
Copy link
Author

wsor4035 thanks, i missed this requirement.
I have corrected the luacheck remarks.

Copy link

@wsor4035 wsor4035 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settingtypes.txt should be updated with the new setting.

relating to calling name_priv_cc, i assume that means cc -> create channel, but might not be obvious on first go, perhaps it should explicitly be name_priv_create_channel. others feel free to comment here

@S-S-X
Copy link
Member

S-S-X commented Dec 7, 2024

Should probably add before_create_channel event for custom checks like this, though doesn't have to happen on this pr.

lord-papirus and others added 3 commits December 7, 2024 23:15
Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com>
Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com>
Remove get.translator.
Add info about mod beerchat to the description.
Comment on lines +5 to +8
minetest.register_privilege(name_priv2cc, {
description = "Allows you to create a channel (mod beerchat)",
give_to_singleplayer = false
})
Copy link

@wsor4035 wsor4035 Dec 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that it might be worth checking for the priv existing so that people can use one that already exists? Would need to wrap the registration + check in an on mods loaded callback so that mod loading isn't an issue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example check:

-- Privilege registration (if needed)
core.register_on_mods_loaded(function()
	if not core.registered_privileges[smartshop.report_priv] then
		core.register_privilege(smartshop.report_priv, {
			description = S("Allow the use of smreport command."),
			give_to_singleplayer = false
		})
	end
end)

Copy link

@wsor4035 wsor4035 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one last thing, otherwise looks good

@BuckarooBanzay BuckarooBanzay added the enhancement New feature or request label Dec 12, 2024
@@ -0,0 +1,8 @@
-- if you need to set a special name for privilege, use "beerchat.name_priv_cc = spec_name" in minetest.conf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setting name in comment is not updated

@@ -0,0 +1,8 @@
-- if you need to set a special name for privilege, use "beerchat.name_priv_cc = spec_name" in minetest.conf
local name_priv2cc = minetest.settings:get("beerchat.priv_cc.name")
if name_priv2cc == '' then name_priv2cc = 'chat_creator' end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel chat_creator should be beerchat_channel_creator or at least channel_creator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants