Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions chatcommands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ local create_channel = {
func = function(lname, param)
local lowner = lname

--check player privileges if plugin priv_cc is enabled
if minetest.settings:get_bool("beerchat.enable_priv_cc") then
local name_priv2cc = minetest.settings:get("beerchat.priv_cc.name")
if not (minetest.check_player_privs(lowner, name_priv2cc) or
minetest.check_player_privs(lowner, beerchat.admin_priv)) then
return false, "You don't have that privilege."
end
end
--end check priv_cc

if not param or param == "" then
return false, "ERROR: Invalid number of arguments. Please supply the channel name as a minimum."
end
Expand Down
3 changes: 3 additions & 0 deletions plugin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ load_plugin("event-logging", true)

-- Allows linking channels through channel aliases
load_plugin("alias", false)

-- Add special priv to use create_channel command
load_plugin("priv_cc", false)
9 changes: 9 additions & 0 deletions plugin/priv_cc.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- 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

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

minetest.log("info", "to create channel add new priv: " .. name_priv2cc)
local S = minetest.get_translator("name_priv2cc")
lord-papirus marked this conversation as resolved.
Show resolved Hide resolved
minetest.register_privilege(name_priv2cc, {
description = S("Allows you to create a channel"),
give_to_singleplayer = false
})
Loading