[Mod] Advanced Ban [advancedban] [0.2]

User avatar
srifqi
Member
 
Posts: 549
Joined: Sat Jun 28, 2014 04:31
Location: Indonesia
GitHub: srifqi
IRC: srifqi
In-game: srifqi

[Mod] Advanced Ban [advancedban] [0.2]

by srifqi » Wed Dec 24, 2014 14:25

Hi!
This mod will add new method of ban.

Features:
  • Ban ONLY username, not the ip address
  • Add manually to "bannedplayerlist.txt" (default), ONLY username, no need to know it's ip address

Usage:
Just type this chat command (require 'ban' privilege):
Code: Select all
/aban <player name>
/unaban <player name>

This command does NOT kick the player.
Use this to add to list AND kick the player. (require 'ban' and 'kick' privileges):
Code: Select all
/abankick <player name>


Also, there are shortcut to do this ALSO ban the IP.
Code: Select all
/aban+ <player name>
/unaban+ <player name>


See README

Github: https://github.com/srifqi/advancedban

Downloads:

License: CC0 1.0 Universal
Dependencies:

No need for screenshot. :P
Last edited by srifqi on Wed May 27, 2015 06:54, edited 2 times in total.
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

User avatar
Krock
Developer
 
Posts: 4146
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: [Mod] Advanced Ban [advancedban] [0.1]

by Krock » Thu Dec 25, 2014 09:18

How is this better than the default ban mod?
Someone could get banned with the troll account and simply join with an other one.

Also, how about using
Code: Select all
minetest.register_on_prejoinplayer(function(player)
     return "You have been banned"
end)
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

User avatar
Pitriss
Member
 
Posts: 253
Joined: Mon Aug 05, 2013 17:09
Location: Czech republic, Bohumin
GitHub: Pitriss
IRC: pitriss
In-game: pitriss

Re: [Mod] Advanced Ban [advancedban] [0.1]

by Pitriss » Thu Dec 25, 2014 16:50

maybe you can make your command shorter..:)

for example /aban and add /akickban (/akban respectively) which will also kick player after banning him:)
I reject your reality and substitute my own. (A. Savage, Mythbusters)
I'm not modding and/or playing minetest anymore. All my mods were released under WTFPL. You can fix/modify them yourself. Don't ask me for support. Thanks.
 

User avatar
Hybrid Dog
Member
 
Posts: 2683
Joined: Thu Nov 01, 2012 12:46

Re: [Mod] Advanced Ban [advancedban] [0.1]

by Hybrid Dog » Fri Dec 26, 2014 22:55

Krock wrote:How is this better than the default ban mod?
Someone could get banned with the troll account and simply join with an other one.

The default ban allows players to join again with the same name, just with another ip address.
viewtopic.php?p=45428#p45428

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
WebWolf
Member
 
Posts: 15
Joined: Thu Jun 19, 2014 05:00

Re: [Mod] Advanced Ban [advancedban] [0.1]

by WebWolf » Mon Dec 29, 2014 05:43

Hi all,

srifqi, thank you for your mod advancedban. It is really very useful.
Some players have dynamic IP (it means a bad player is able to change his IP just pressing a button in his modem) and in this way they can enter any server with any kind of banning mod with a new username *and* a new IP, without beeing banned. So, it seems your mod is a good option to be used alone (if some admins or the owner are able to play in the server sometimes, and watch / ban the bad players).
Of course other mods like xban (extended ban) and future_ban are also useful (for an automatic control, using IP), depending on the server (and the presence of admins in the server).

Anyway, I changed some lines in the code and I'd like to share with other people, for those who could eventually use it.
Instead of the code:
Code: Select all
minetest.register_on_joinplayer(function(player)
   if file_exists(minetest.get_worldpath()..DIR_DELIM..FILE_NAME) == true then
      local list = io.open(minetest.get_worldpath()..DIR_DELIM..FILE_NAME, "r")
      for username in list:lines() do
            local name = player:get_player_name()
            if name == username then
               minetest.after(0.1, function()
                  minetest.kick_player(name, BAN_MESSAGE) -- kick player
               end)
            end
         end
      list:close()
   end
end)


I changed to:
Code: Select all
minetest.register_on_prejoinplayer(function(name, ip)
local lname = name:lower()
   if file_exists(minetest.get_worldpath()..DIR_DELIM..FILE_NAME) == true then
      local list = io.open(minetest.get_worldpath()..DIR_DELIM..FILE_NAME, "r")
         for username in list:lines() do
            if lname == username:lower() then --lname and username variables are in lowercase (so that the admin or server owner doesn't need to worry about typing BadGuy or badguy as an username; the script accepts all variations automatically)
               return BAN_MESSAGE -- This line uses the same ban message configured at the beginning of the mod
               --return "Sorry, this username is not available anymore. Please use another username (and play using one username only). Also, please do not use badnames or offensive names. Thank you." --This is just an idea for another ban message...
            end
         end
      list:close()
   end
end)


Basically the validation is done using "minetest.register_on_prejoinplayer" instead "minetest.register_on_joinplayer" (in other words, before the player logs in or enters the server).
It seems this change brings 3 interesting changes (faster and easier for the admins, and more productive for the server):
1) As the bad (banned) player is not able to log in (without need to be kicked after he joins), messages like "# player BadGuy entered the server" and (after being kicked) "# player BadGuy left the server", causing less span (unnecessary messages) in chat (what is good for all the players who are online and also for the server)
2) The validation is done before the player logs in, with (hopefully) some milliseconds in less time (that is, the server doesn't need to load all the player stuff like skin and items, probably using less CPU work in the server side).
3) There is a better psychological impact for the bad player: he is not able to enter the server (even for a few seconds before being kicked) and see the buildings, the spawn, the chat (conversation) or any other image inside the world in the server.

Additionaly, the lname and username variables are in lowercase (so that the admin or server owner doesn't need to worry about typing BadGuy or badguy as an username; the script accepts all variations automatically).

Well, just an idea. I hope it can be useful for other friends here. :)
If something is wrong, please correct or don't consider my post.

Regards,
WebWolf

P.S.: December, 29... Happy New Year 2015 for all people in this forum, including your family and friends.
 

User avatar
srifqi
Member
 
Posts: 549
Joined: Sat Jun 28, 2014 04:31
Location: Indonesia
GitHub: srifqi
IRC: srifqi
In-game: srifqi

UPDATE: [Mod] Advanced Ban [advancedban] [0.1.1]

by srifqi » Mon Dec 29, 2014 10:16

Released 0.1.1! (Banned Player Handling Update)
Changes:
  • Better banned player handling (Thanks, Krock and WebWolf!)
  • Shorter chat command for /advancedban -> /aban
  • Add new chat command /abankick that allows to kick after added to list
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

User avatar
srifqi
Member
 
Posts: 549
Joined: Sat Jun 28, 2014 04:31
Location: Indonesia
GitHub: srifqi
IRC: srifqi
In-game: srifqi

UPDATE: [Mod] Advanced Ban [advancedban] [0.2]

by srifqi » Wed May 27, 2015 06:54

Released 0.2! (Unban Update)
Changes:
  • Add method to unban player
  • Add chat command shortcut to ban IP
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

User avatar
poikilos
Member
 
Posts: 46
Joined: Thu Feb 18, 2016 13:45
GitHub: poikilos
In-game: Abiyahh

Re: [Mod] Advanced Ban [advancedban] [0.1]

by poikilos » Wed Oct 03, 2018 17:52

Krock wrote:How is this better than the default ban mod?
Someone could get banned with the troll account and simply join with an other one.

Also, how about using
Code: Select all
minetest.register_on_prejoinplayer(function(player)
     return "You have been banned"
end)


This mod is still useful in at least one case where keeping the person out is not guaranteed:
  • usernames that are against a server's code of conduct
...and at least two uses where keeping the person out is guaranteed (barring social/computer security issues):
  • whitelist servers can ban temporarily regardless of changing ip (my case)
  • whitelist servers can permanently or semi-permanently record a ban (as opposed to just removing the username from the whitelist and risking another admin will re-add them unknowingly)

I am aware that security is often not regarded as a big thing in Minetest (at least that's the way it seems--considering protection is not as advanced as Mine...:ahem:...another popular sandbox game with a rather young community which often has script kiddies and lesser skilled players who use their hacks), but:
  • Due to people being able to change their IP, a whitelisted server is the only way to guarantee user access control (barring password being guessed/obtained, or other social engineering--but I won't give people ideas :) ).
  • xban2 can allow banning an IP (like the default ban) but un-banning a username, but not banning only a username--hence it provides no helpful features for whitelisted servers other than unblocking people who have a duplicate external IP (and also, xban2 is bugged and noone wants to fix it--a random set of people get banned on a LAN party if one username is banned, even when the server is on the same LAN--I'm not sure whether this can happen when everything is on the WAN)

Due to these two facts, this is the most trustworthy ban mod (in combination with a whitelist).

Thanks for the mod, srifqi!
 


Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 2 guests