From b1c9b69affcb91c40c15dd7ec3cc03a783fe3ce0 Mon Sep 17 00:00:00 2001 From: mfnalex <1122571+mfnalex@users.noreply.github.com> Date: Sun, 14 Jul 2019 13:51:28 +0200 Subject: [PATCH] 6.2 update --- .../JeffChestSort/JeffChestSortListener.java | 4 +- .../JeffChestSort/JeffChestSortPlugin.java | 44 +++++++++---------- src/main/resources/config.yml | 2 +- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortListener.java b/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortListener.java index c0ffb0a..8cac5d4 100644 --- a/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortListener.java +++ b/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortListener.java @@ -314,7 +314,9 @@ public class JeffChestSortListener implements Listener { break; } - if(!sort) return; + if(!sort) { + return; + } if(belongsToChestLikeBlock(event.getInventory())) { plugin.organizer.sortInventory(event.getInventory()); diff --git a/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java b/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java index e1864dc..c7b1992 100644 --- a/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java +++ b/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java @@ -61,7 +61,7 @@ public class JeffChestSortPlugin extends JavaPlugin { JeffChestSortListener listener; String sortingMethod; ArrayList disabledWorlds; - int currentConfigVersion = 12; + int currentConfigVersion = 15; boolean usingMatchingConfig = true; boolean debug = false; boolean verbose = true; @@ -99,13 +99,6 @@ public class JeffChestSortPlugin extends JavaPlugin { // Load disabled-worlds. If it does not exist in the config, it returns null. // That's no problem disabledWorlds = (ArrayList) 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 if (getConfig().getInt("config-version", 0) < 5) { @@ -142,7 +135,10 @@ public class JeffChestSortPlugin extends JavaPlugin { getConfig().addDefault("check-for-updates", "true"); getConfig().addDefault("auto-generate-category-files", true); 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() } @@ -163,18 +159,11 @@ public class JeffChestSortPlugin extends JavaPlugin { } private void showOldConfigWarning() { - getLogger().warning("========================================================"); -// getLogger().warning("YOU ARE USING AN OLD CONFIG FILE!"); -// getLogger().warning("This is not a problem, as ChestSort will just use the"); -// getLogger().warning("default settings for unset values. However, if you want"); -// getLogger().warning("to configure the new options, please go to"); -// 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("========================================================"); + getLogger().warning("=============================================="); + getLogger().warning("You were using an old config file. ChestSort"); + getLogger().warning("has updated the file to the newest version."); + getLogger().warning("Your changes have been kept."); + getLogger().warning("=============================================="); } 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("Auto generate category files: " + getConfig().getBoolean("auto-generate-category-files")); 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("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("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 diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 5541848..5fa7d71 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -288,4 +288,4 @@ message-error-invalid-options: "&cError: Unknown option %s. Valid options are %s ######################### # please do not change the following line manually! -config-version: 14 +config-version: 15