[Mod] Advanced Ban [advancedban] [0.2]

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
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):
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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):
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
/abankick <player name>


Also, there are shortcut to do this ALSO ban the IP.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
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
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_on_prejoinplayer(function(player)
     return "You have been banned"
end)
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
Pitriss
Member
 
Posts: 253
Joined: Mon Aug 05, 2013 17:09
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.
 

Hybrid Dog
Member
 
Posts: 2460
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:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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: 508
Joined: Sat Jun 28, 2014 04:31
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: 508
Joined: Sat Jun 28, 2014 04:31
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/)
 


Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 12 guests

cron