mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-03-31 08:45:41 +02:00
Add Purge.removePermissions through Vault system
This commit is contained in:
parent
dc3a8c1f06
commit
2514ae9852
@ -605,6 +605,8 @@ public class AuthMe extends JavaPlugin {
|
||||
dataManager.purgeLimitedCreative(cleared);
|
||||
if (Settings.purgeAntiXray)
|
||||
dataManager.purgeAntiXray(cleared);
|
||||
if (Settings.purgePermissions)
|
||||
dataManager.purgePermissions(cleared, permission);
|
||||
}
|
||||
|
||||
public Location getSpawnLocation(Player player) {
|
||||
|
@ -3,8 +3,12 @@ package fr.xephi.authme;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import net.milkbowl.vault.Vault;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
@ -48,7 +52,8 @@ public class DataManager extends Thread {
|
||||
playerFile.delete();
|
||||
i++;
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " AntiXRayData Files");
|
||||
}
|
||||
@ -76,7 +81,8 @@ public class DataManager extends Thread {
|
||||
playerFile.delete();
|
||||
i++;
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " LimitedCreative Survival, Creative and Adventure files");
|
||||
}
|
||||
@ -94,7 +100,8 @@ public class DataManager extends Thread {
|
||||
playerFile.delete();
|
||||
i++;
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " .dat Files");
|
||||
}
|
||||
@ -108,8 +115,24 @@ public class DataManager extends Thread {
|
||||
playerFile.delete();
|
||||
i++;
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " EssentialsFiles");
|
||||
}
|
||||
|
||||
public void purgePermissions(List<String> cleared, Permission permission) {
|
||||
int i = 0;
|
||||
for (String name : cleared) {
|
||||
try {
|
||||
OfflinePlayer p = Bukkit.getOfflinePlayer(name);
|
||||
for (String group : permission.getPlayerGroups((Player) p)) {
|
||||
permission.playerRemoveGroup(null, p, group);
|
||||
}
|
||||
i++;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " Permissions");
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class Messages extends CustomConfiguration {
|
||||
loc[0] = "Error with " + msg + " translation; Please contact the admin for verify or update translation files";
|
||||
return (loc);
|
||||
}
|
||||
int i = ((s.split("&n").length;
|
||||
int i = s.split("&n").length;
|
||||
String[] loc = new String[i];
|
||||
int a;
|
||||
for (a = 0; a < i; a++) {
|
||||
|
@ -239,8 +239,7 @@ public final class Settings extends YamlConfiguration {
|
||||
getWordPressPrefix = configFile.getString("ExternalBoardOptions.wordpressTablePrefix", "wp_");
|
||||
purgeLimitedCreative = configFile.getBoolean("Purge.removeLimitedCreativesInventories", false);
|
||||
purgeAntiXray = configFile.getBoolean("Purge.removeAntiXRayFile", false);
|
||||
// purgePermissions = configFile.getBoolean("Purge.removePermissions",
|
||||
// false);
|
||||
purgePermissions = configFile.getBoolean("Purge.removePermissions", false);
|
||||
enableProtection = configFile.getBoolean("Protection.enableProtection", false);
|
||||
countries = (List<String>) configFile.getList("Protection.countries", new ArrayList<String>());
|
||||
enableAntiBot = configFile.getBoolean("Protection.enableAntiBot", false);
|
||||
@ -407,8 +406,7 @@ public final class Settings extends YamlConfiguration {
|
||||
getWordPressPrefix = configFile.getString("ExternalBoardOptions.wordpressTablePrefix", "wp_");
|
||||
purgeLimitedCreative = configFile.getBoolean("Purge.removeLimitedCreativesInventories", false);
|
||||
purgeAntiXray = configFile.getBoolean("Purge.removeAntiXRayFile", false);
|
||||
// purgePermissions = configFile.getBoolean("Purge.removePermissions",
|
||||
// false);
|
||||
purgePermissions = configFile.getBoolean("Purge.removePermissions", false);
|
||||
enableProtection = configFile.getBoolean("Protection.enableProtection", false);
|
||||
countries = (List<String>) configFile.getList("Protection.countries");
|
||||
enableAntiBot = configFile.getBoolean("Protection.enableAntiBot", false);
|
||||
@ -586,6 +584,11 @@ public final class Settings extends YamlConfiguration {
|
||||
set("Hooks.customAttributes", false);
|
||||
changes = true;
|
||||
}
|
||||
if (!contains("Purge.removePermissions"))
|
||||
{
|
||||
set("Purge.removePermissions", false);
|
||||
changes = true;
|
||||
}
|
||||
|
||||
if (changes) {
|
||||
plugin.getLogger().warning("Merge new Config Options - I'm not an error, please don't report me");
|
||||
|
@ -402,6 +402,8 @@ Purge:
|
||||
removeLimitedCreativesInventories: false
|
||||
# Do we need to remove the AntiXRayData/PlayerData/player file during purge process ?
|
||||
removeAntiXRayFile: false
|
||||
# Do we need to remove permissions ?
|
||||
removePermissions: false
|
||||
Protection:
|
||||
# Enable some servers protection ( country based login, antibot )
|
||||
enableProtection: false
|
||||
|
Loading…
Reference in New Issue
Block a user