6.2 update

This commit is contained in:
mfnalex 2019-07-14 13:51:28 +02:00
parent 8e0827a006
commit b1c9b69aff
3 changed files with 26 additions and 24 deletions

View File

@ -314,7 +314,9 @@ public class JeffChestSortListener implements Listener {
break; break;
} }
if(!sort) return; if(!sort) {
return;
}
if(belongsToChestLikeBlock(event.getInventory())) { if(belongsToChestLikeBlock(event.getInventory())) {
plugin.organizer.sortInventory(event.getInventory()); plugin.organizer.sortInventory(event.getInventory());

View File

@ -61,7 +61,7 @@ public class JeffChestSortPlugin extends JavaPlugin {
JeffChestSortListener listener; JeffChestSortListener listener;
String sortingMethod; String sortingMethod;
ArrayList<String> disabledWorlds; ArrayList<String> disabledWorlds;
int currentConfigVersion = 12; int currentConfigVersion = 15;
boolean usingMatchingConfig = true; boolean usingMatchingConfig = true;
boolean debug = false; boolean debug = false;
boolean verbose = true; boolean verbose = true;
@ -100,13 +100,6 @@ public class JeffChestSortPlugin extends JavaPlugin {
// That's no problem // That's no problem
disabledWorlds = (ArrayList<String>) getConfig().getStringList("disabled-worlds"); disabledWorlds = (ArrayList<String>) getConfig().getStringList("disabled-worlds");
// DEBUG
if(disabledWorlds != null ) {
for(String disabledWorld : disabledWorlds) {
System.out.println("Disabled world: "+disabledWorld);
}
}
// Config version prior to 5? Then it must have been generated by ChestSort 1.x // Config version prior to 5? Then it must have been generated by ChestSort 1.x
if (getConfig().getInt("config-version", 0) < 5) { if (getConfig().getInt("config-version", 0) < 5) {
renameConfigIfTooOld(); renameConfigIfTooOld();
@ -142,7 +135,10 @@ public class JeffChestSortPlugin extends JavaPlugin {
getConfig().addDefault("check-for-updates", "true"); getConfig().addDefault("check-for-updates", "true");
getConfig().addDefault("auto-generate-category-files", true); getConfig().addDefault("auto-generate-category-files", true);
getConfig().addDefault("sort-time", "close"); getConfig().addDefault("sort-time", "close");
getConfig().addDefault("allow-shortcut", true); getConfig().addDefault("allow-hotkeys", true);
getConfig().addDefault("hotkeys.middle-click", true);
getConfig().addDefault("hotkeys.shift-click", true);
getConfig().addDefault("hotkeys.double-click", true);
getConfig().addDefault("verbose", true); // Prints some information in onEnable() getConfig().addDefault("verbose", true); // Prints some information in onEnable()
} }
@ -163,18 +159,11 @@ public class JeffChestSortPlugin extends JavaPlugin {
} }
private void showOldConfigWarning() { private void showOldConfigWarning() {
getLogger().warning("========================================================"); getLogger().warning("==============================================");
// getLogger().warning("YOU ARE USING AN OLD CONFIG FILE!"); getLogger().warning("You were using an old config file. ChestSort");
// getLogger().warning("This is not a problem, as ChestSort will just use the"); getLogger().warning("has updated the file to the newest version.");
// getLogger().warning("default settings for unset values. However, if you want"); getLogger().warning("Your changes have been kept.");
// getLogger().warning("to configure the new options, please go to"); getLogger().warning("==============================================");
// getLogger().warning("https://www.chestsort.de and replace your config.yml");
// getLogger().warning("with the new one. You can then insert your old changes");
// getLogger().warning("into the new file.");
getLogger().warning("You were using an old config file. ChestSort has");
getLogger().warning("updated the file to the newest version. Your changes");
getLogger().warning("have been kept.");
getLogger().warning("========================================================");
} }
private void renameConfigIfTooOld() { private void renameConfigIfTooOld() {
@ -260,7 +249,10 @@ public class JeffChestSortPlugin extends JavaPlugin {
getLogger().info("Sorting enabled by default: " + getConfig().getBoolean("sorting-enabled-by-default")); getLogger().info("Sorting enabled by default: " + getConfig().getBoolean("sorting-enabled-by-default"));
getLogger().info("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files")); getLogger().info("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files"));
getLogger().info("Sort time: " + getConfig().getString("sort-time")); getLogger().info("Sort time: " + getConfig().getString("sort-time"));
getLogger().info("Allow shortcut: " + getConfig().getString("allow-shortcut")); getLogger().info("Allow hotkeys: " + getConfig().getBoolean("allow-hotkeys"));
getLogger().info("|- Middle-Click: " + getConfig().getBoolean("hotkeys.middle-click"));
getLogger().info("|- Shift-Click: " + getConfig().getBoolean("hotkeys.shift-click"));
getLogger().info("|- Double-Click: " + getConfig().getBoolean("hotkeys.double-click"));
getLogger().info("Check for updates: " + getConfig().getString("check-for-updates")); getLogger().info("Check for updates: " + getConfig().getString("check-for-updates"));
getLogger().info("Categories: " + getCategoryList()); getLogger().info("Categories: " + getCategoryList());
} }
@ -320,6 +312,14 @@ public class JeffChestSortPlugin extends JavaPlugin {
metrics.addCustomChart(new Metrics.SimplePie("sort_time", () -> getConfig().getString("sort-time"))); metrics.addCustomChart(new Metrics.SimplePie("sort_time", () -> getConfig().getString("sort-time")));
metrics.addCustomChart(new Metrics.SimplePie("auto_generate_category_files", metrics.addCustomChart(new Metrics.SimplePie("auto_generate_category_files",
() -> Boolean.toString(getConfig().getBoolean("auto-generate-category-files")))); () -> Boolean.toString(getConfig().getBoolean("auto-generate-category-files"))));
metrics.addCustomChart(new Metrics.SimplePie("allow_hotkeys",
() -> Boolean.toString(getConfig().getBoolean("allow-hotkeys"))));
metrics.addCustomChart(new Metrics.SimplePie("hotkey_middle_click",
() -> Boolean.toString(getConfig().getBoolean("hotkeys.middle-click"))));
metrics.addCustomChart(new Metrics.SimplePie("hotkey_shift_click",
() -> Boolean.toString(getConfig().getBoolean("hotkeys.shift-click"))));
metrics.addCustomChart(new Metrics.SimplePie("hotkey_double_click",
() -> Boolean.toString(getConfig().getBoolean("hotkeys.double-click"))));
} }
// Saves default category files, when enabled in the config // Saves default category files, when enabled in the config

View File

@ -288,4 +288,4 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s
######################### #########################
# please do not change the following line manually! # please do not change the following line manually!
config-version: 14 config-version: 15