diff --git a/init.lua b/init.lua index 3d02216..e4e9c8e 100644 --- a/init.lua +++ b/init.lua @@ -23,12 +23,28 @@ AuthInitFile( world_path, "auth.db" ) local auth_filter = AuthFilter( world_path, "greenlist.mt" ) local auth_db = AuthDatabase( world_path, "auth.db" ) local auth_watchdog = AuthWatchdog( ) +local is_50 = minetest.has_feature("object_use_texture_alpha") +local is_54 = minetest.has_feature("object_use_texture_alpha") -if minetest.register_on_auth_fail then - minetest.register_on_auth_fail( function ( player_name, player_ip ) - auth_db.on_login_failure( player_name, player_ip ) - auth_watchdog.on_failure( convert_ipv4( player_ip ) ) - end ) +if is_50 then + if minetest.register_on_auth_fail then + minetest.register_on_auth_fail( function ( player_name, player_ip ) + auth_db.on_login_failure( player_name, player_ip ) + auth_watchdog.on_failure( convert_ipv4( player_ip ) ) + end ) + end +end + +if is_54 then + if minetest.register_on_authplayer then + minetest.register_on_authplayer( function ( player_name, player_ip, is_success ) + if is_success then + return + end + auth_db.on_login_failure( player_name, player_ip ) + auth_watchdog.on_failure( convert_ipv4( player_ip ) ) + end ) + end end minetest.register_on_prejoinplayer( function ( player_name, player_ip )