From f72b18ed2f74547ff102a60b200de4d3a9ee8290 Mon Sep 17 00:00:00 2001
From: Zughy <4279489-marco_a@users.noreply.gitlab.com>
Date: Thu, 21 Sep 2023 10:20:49 +0200
Subject: [PATCH] Don't leave a party when disconnecting (closes #9) | Add
 setting to leave the party when players disconnect, off by default (closes
 #8)

---
 IGNOREME/SETTINGS.lua  | 5 ++++-
 src/player_manager.lua | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/IGNOREME/SETTINGS.lua b/IGNOREME/SETTINGS.lua
index 38cf086..d645f0a 100644
--- a/IGNOREME/SETTINGS.lua
+++ b/IGNOREME/SETTINGS.lua
@@ -1,2 +1,5 @@
 -- the maximum amount of players a party can have
-parties.settings.MAX_PLAYERS_PER_PARTY = 6
\ No newline at end of file
+parties.settings.MAX_PLAYERS_PER_PARTY = 6
+
+-- whether players should automatically leave a party when disconnecting
+parties.settings.LEAVE_ON_DISCONNECT = false
\ No newline at end of file
diff --git a/src/player_manager.lua b/src/player_manager.lua
index 8bf432e..9953d95 100644
--- a/src/player_manager.lua
+++ b/src/player_manager.lua
@@ -7,7 +7,7 @@ end)
 minetest.register_on_leaveplayer(function(player)
   local p_name = player:get_player_name()
 
-  if parties.is_player_in_party(p_name) then
+  if parties.is_player_in_party(p_name) and parties.settings.LEAVE_ON_DISCONNECT then
     parties.leave(p_name)
   end