summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Entities/Player.cpp7
-rw-r--r--src/GroupManager.cpp21
2 files changed, 25 insertions, 3 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 7a5ff5696..ff519f890 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1393,7 +1393,12 @@ void cPlayer::LoadPermissionsFromDisk()
}
else
{
- LOGWARN("Failed to read the users.ini file. The player will be added only to the Default group.");
+ LOGWARN("Regenerating users.ini, player %s will be added to the \"Default\" group", m_PlayerName.c_str());
+ IniFile.AddHeaderComment(" This is the file in which the group the player belongs to is stored");
+ IniFile.AddHeaderComment(" The format is: [PlayerName] | Groups=GroupName");
+
+ IniFile.SetValue(m_PlayerName, "Groups", "Default");
+ IniFile.WriteFile("users.ini");
AddToGroup("Default");
}
ResolvePermissions();
diff --git a/src/GroupManager.cpp b/src/GroupManager.cpp
index df609f05b..1ffe3812f 100644
--- a/src/GroupManager.cpp
+++ b/src/GroupManager.cpp
@@ -47,8 +47,25 @@ cGroupManager::cGroupManager()
cIniFile IniFile;
if (!IniFile.ReadFile("groups.ini"))
{
- LOGWARNING("groups.ini inaccessible, no groups are defined");
- return;
+ LOGWARNING("Regenerating groups.ini, all groups will be reset");
+ IniFile.AddHeaderComment(" This is the MCServer permissions manager groups file");
+ IniFile.AddHeaderComment(" It stores all defined groups such as Administrators, Players, or Moderators");
+
+ IniFile.SetValue("Owner", "Permissions", "*", true);
+ IniFile.SetValue("Owner", "Color", "2", true);
+
+ IniFile.SetValue("Moderator", "Permissions", "core.time,core.item,core.teleport,core.ban,core.unban,core.save-all,core.toggledownfall");
+ IniFile.SetValue("Moderator", "Color", "2", true);
+ IniFile.SetValue("Moderator", "Inherits", "Player", true);
+
+ IniFile.SetValue("Player", "Permissions", "core.build", true);
+ IniFile.SetValue("Player", "Color", "f", true);
+ IniFile.SetValue("Player", "Inherits", "Default", true);
+
+ IniFile.SetValue("Default", "Permissions", "core.help,core.playerlist,core.pluginlist,core.spawn,core.listworlds,core.back,core.motd,core.gotoworld,core.coords,core.viewdistance", true);
+ IniFile.SetValue("Default", "Color", "f", true);
+
+ IniFile.WriteFile("groups.ini");
}
unsigned int NumKeys = IniFile.GetNumKeys();