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