Adds optional extensive sign protection which accounts for signs on gravity-affected blocks
This commit is contained in:
@ -42,6 +42,7 @@ public final class PermissionSigns extends JavaPlugin {
|
||||
private static String pluginVersion;
|
||||
private static PermissionSigns instance;
|
||||
private static boolean perWorldPermissions;
|
||||
private static boolean enableExtensiveSignProtection;
|
||||
|
||||
/**
|
||||
* Instantiates the permission signs class
|
||||
@ -120,42 +121,60 @@ public final class PermissionSigns extends JavaPlugin {
|
||||
return perWorldPermissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether permission signs on falling blocks should be protected
|
||||
*
|
||||
* @return <p>Whether permission signs on falling blocks should be protected</p>
|
||||
*/
|
||||
public static boolean extensiveSignProtectionEnabled() {
|
||||
return enableExtensiveSignProtection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadConfig() {
|
||||
super.reloadConfig();
|
||||
FileConfiguration config = this.getConfig();
|
||||
String language = config.getString("language");
|
||||
perWorldPermissions = config.getBoolean("perWorldPermissions");
|
||||
Translator.loadLanguages(language);
|
||||
Translator.loadLanguages(loadConfig());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
PluginDescriptionFile pluginDescriptionFile = this.getDescription();
|
||||
pluginVersion = pluginDescriptionFile.getVersion();
|
||||
//TODO: Display a notice in the console if a new version is available
|
||||
|
||||
FileConfiguration config = this.getConfig();
|
||||
config.options().copyDefaults(true);
|
||||
this.saveDefaultConfig();
|
||||
|
||||
String language = config.getString("language");
|
||||
perWorldPermissions = config.getBoolean("perWorldPermissions");
|
||||
|
||||
//Check if vault is loaded
|
||||
setupVault();
|
||||
|
||||
//Get plugin info
|
||||
PluginDescriptionFile pluginDescriptionFile = this.getDescription();
|
||||
pluginVersion = pluginDescriptionFile.getVersion();
|
||||
|
||||
//TODO: Display a notice in the console if a new version is available (requires Spigot resource first)
|
||||
|
||||
//Load config and write the default config if necessary
|
||||
FileConfiguration config = this.getConfig();
|
||||
config.options().copyDefaults(true);
|
||||
this.saveDefaultConfig();
|
||||
Translator.loadLanguages(loadConfig());
|
||||
|
||||
registerListeners();
|
||||
|
||||
Translator.loadLanguages(language);
|
||||
registerCommands();
|
||||
|
||||
runThreads();
|
||||
|
||||
SignManager.loadSigns();
|
||||
PermissionManager.loadTemporaryPermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the config file
|
||||
*
|
||||
* @return <p>The currently selected language</p>
|
||||
*/
|
||||
private String loadConfig() {
|
||||
FileConfiguration config = this.getConfig();
|
||||
String language = config.getString("language", "en");
|
||||
perWorldPermissions = config.getBoolean("perWorldPermissions", false);
|
||||
enableExtensiveSignProtection = config.getBoolean("enableExtensiveSignProtection", false);
|
||||
saveConfig();
|
||||
return language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts all separate threads for executing tasks
|
||||
*/
|
||||
|
Reference in New Issue
Block a user