Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minetest_game
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
minetest_game
Commits
6bdd13d1
There was a problem fetching the pipeline summary.
Commit
6bdd13d1
authored
8 years ago
by
tchncs
Browse files
Options
Downloads
Patches
Plain Diff
add submodule glow
parent
e5eeb666
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitmodules
+3
-0
3 additions, 0 deletions
.gitmodules
mods/glow
+1
-0
1 addition, 0 deletions
mods/glow
mods/player_spam/depends.txt
+0
-1
0 additions, 1 deletion
mods/player_spam/depends.txt
mods/player_spam/init.lua
+0
-91
0 additions, 91 deletions
mods/player_spam/init.lua
with
4 additions
and
92 deletions
.gitmodules
+
3
−
0
View file @
6bdd13d1
...
...
@@ -122,3 +122,6 @@
[submodule "mods/city_block"]
path = mods/city_block
url = https://github.com/minetest-mods/city_block
[submodule "mods/glow"]
path = mods/glow
url = https://github.com/bdjnk/glow
This diff is collapsed.
Click to expand it.
glow
@
30f9cf37
Subproject commit 30f9cf3752198250e1e4c628631b4a21ccdcd5b1
This diff is collapsed.
Click to expand it.
mods/player_spam/depends.txt
deleted
100644 → 0
+
0
−
1
View file @
e5eeb666
default
This diff is collapsed.
Click to expand it.
mods/player_spam/init.lua
deleted
100644 → 0
+
0
−
91
View file @
e5eeb666
-- Untested mod to prevent from chat flood
-- Allows players to send 4 messages in 2s when a silence of >= 2s follows
-- Created by Krock <mk939@ymail.com> - 2016
-- License: BSD 3-Clause
-- ALL YOUR BUG REPORT ARE BELONG TO ME
local
player_spam
=
{}
local
CHAR_REPEAT_MAX
=
4
minetest
.
register_on_chat_message
(
function
(
name
,
msg
)
if
msg
==
""
or
msg
:
sub
(
1
,
1
)
==
'/'
then
return
end
if
not
minetest
.
check_player_privs
(
name
,
{
shout
=
true
})
then
minetest
.
chat_send_player
(
name
,
"You can not chat. Missing privilege: shout"
)
return
true
end
local
count_as_messages
=
math.max
(
1
,
math.min
(
msg
:
len
()
/
100
,
5
))
player_spam
[
name
]
=
(
player_spam
[
name
]
or
0
)
+
math.floor
(
count_as_messages
+
0
.
5
)
if
player_spam
[
name
]
>
5
then
minetest
.
kick_player
(
name
,
"You spammer you!"
)
return
true
end
if
player_spam
[
name
]
>
3
then
-- A message per second maximal
minetest
.
chat_send_player
(
name
,
"Your message was not sent due to flood detection. "
..
"Please try again in some seconds."
)
return
true
end
local
new_msg
=
""
local
last_char
local
same_char_count
=
0
-- Prevent from repetive characters
for
c
in
msg
:
gmatch
(
"."
)
do
if
c
:
byte
()
<
0x20
then
c
=
' '
end
if
last_char
==
c
:
lower
()
then
same_char_count
=
same_char_count
+
1
else
last_char
=
c
:
lower
()
same_char_count
=
0
end
if
same_char_count
<
CHAR_REPEAT_MAX
then
new_msg
=
new_msg
..
c
end
end
if
new_msg
==
msg
then
return
-- Nothing to replace (message ok)
end
for
i
,
player
in
pairs
(
minetest
.
get_connected_players
())
do
local
player_name
=
player
:
get_player_name
()
if
player_name
~=
name
then
minetest
.
chat_send_player
(
player_name
,
"<"
..
name
..
"> "
..
new_msg
)
end
end
--if new_msg:len() < msg:len() then
-- minetest.chat_send_player(name, "Your message was shortened a bit to prevent from spam.")
--end
return
true
end
)
local
timed
=
0
-- 1 message per second, decrease message count by X all X seconds
local
CHECK_COUNT
=
2
minetest
.
register_globalstep
(
function
(
dtime
)
timed
=
timed
+
dtime
if
timed
<
CHECK_COUNT
then
return
end
timed
=
0
for
i
,
player
in
pairs
(
minetest
.
get_connected_players
())
do
local
player_name
=
player
:
get_player_name
()
local
num
=
player_spam
[
player_name
]
if
num
and
num
>
0
then
player_spam
[
player_name
]
=
math.max
(
0
,
num
-
CHECK_COUNT
)
end
end
end
)
minetest
.
register_on_leaveplayer
(
function
(
player
)
player_spam
[
player
:
get_player_name
()]
=
nil
end
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment