Disable generic commands on fresh installs only
This commit is contained in:
parent
557476b5d6
commit
7c7edc7d5f
|
@ -34,7 +34,7 @@ public class BukkitConfigurationManager extends YamlConfigurationManager {
|
|||
|
||||
@Unreported private WorldGuardPlugin plugin;
|
||||
@Unreported private ConcurrentMap<String, BukkitWorldConfiguration> worlds = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean isFreshInstall;
|
||||
private boolean hasCommandBookGodMode;
|
||||
boolean disableGeneralCommands;
|
||||
boolean extraStats;
|
||||
|
@ -57,7 +57,8 @@ public class BukkitConfigurationManager extends YamlConfigurationManager {
|
|||
public void load() {
|
||||
super.load();
|
||||
this.extraStats = getConfig().getBoolean("custom-metrics-charts", true);
|
||||
this.disableGeneralCommands = getConfig().getBoolean("disable-general-commands", false);
|
||||
// Disable legacy commands for fresh installs
|
||||
this.disableGeneralCommands = getConfig().getBoolean("disable-general-commands", isFreshInstall);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,7 +69,7 @@ public class BukkitConfigurationManager extends YamlConfigurationManager {
|
|||
@Override
|
||||
public void copyDefaults() {
|
||||
// Create the default configuration file
|
||||
plugin.createDefaultConfiguration(new File(plugin.getDataFolder(), "config.yml"), "config.yml");
|
||||
isFreshInstall = plugin.createDefaultConfiguration(new File(plugin.getDataFolder(), "config.yml"), "config.yml");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -488,7 +488,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
|||
* @param actual The destination file
|
||||
* @param defaultName The name of the file inside the jar's defaults folder
|
||||
*/
|
||||
public void createDefaultConfiguration(File actual, String defaultName) {
|
||||
public boolean createDefaultConfiguration(File actual, String defaultName) {
|
||||
|
||||
// Make parent directories
|
||||
File parent = actual.getParentFile();
|
||||
|
@ -497,7 +497,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
|||
}
|
||||
|
||||
if (actual.exists()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
try (InputStream stream = getResource("defaults/" + defaultName)){
|
||||
|
@ -506,7 +506,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
|||
} catch (IOException e) {
|
||||
getLogger().severe("Unable to read default configuration: " + defaultName);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void copyDefaultConfig(InputStream input, File actual, String name) {
|
||||
|
|
Loading…
Reference in New Issue