From 954e32114a3d6ec5aebf0c8cd76b8229180e6d69 Mon Sep 17 00:00:00 2001 From: mfnalex <1122571+mfnalex@users.noreply.github.com> Date: Mon, 15 Jul 2019 22:46:00 +0200 Subject: [PATCH 1/2] updated default categories --- pom.xml | 2 +- .../JeffChestSort/JeffChestSortPlugin.java | 27 +++++++++++++++++++ .../resources/categories/909-food.default.txt | 2 ++ .../categories/910-valuables.default.txt | 20 ++++++++++++++ .../categories/930-brewing.default.txt | 3 +++ .../resources/categories/960-wood.default.txt | 15 ++++++++++- .../categories/970-stone.default.txt | 18 ++++++++++++- .../categories/980-plants.default.txt | 18 +++++++++++++ src/main/resources/plugin.yml | 2 +- 9 files changed, 103 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 4d46490..c63bd5a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ de.jeffclan JeffChestSort - 6.3 + 6.4-dev jar JeffChestSort diff --git a/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java b/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java index 6d30211..1738d97 100644 --- a/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java +++ b/src/main/java/de/jeffclan/JeffChestSort/JeffChestSortPlugin.java @@ -1,5 +1,7 @@ package de.jeffclan.JeffChestSort; +import java.io.BufferedWriter; + /* ChestSort - maintained by mfnalex / JEFF Media GbR ( www.jeff-media.de ) @@ -31,10 +33,12 @@ package de.jeffclan.JeffChestSort; */ import java.io.File; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -43,6 +47,7 @@ import java.util.UUID; import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; +import org.bukkit.Material; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; @@ -144,6 +149,7 @@ public class JeffChestSortPlugin extends JavaPlugin { getConfig().addDefault("hotkeys.shift-click", true); getConfig().addDefault("hotkeys.double-click", true); getConfig().addDefault("hotkeys.shift-right-click", true); + getConfig().addDefault("dump", false); getConfig().addDefault("hook-crackshot", true); getConfig().addDefault("hook-crackshot-prefix", "crackshot_weapon"); @@ -293,6 +299,15 @@ public class JeffChestSortPlugin extends JavaPlugin { } registerMetrics(); + + if(getConfig().getBoolean("dump")) { + try { + dump(); + } catch (IOException e) { + System.out.println("Error while writing dump file."); + e.printStackTrace(); + } + } } @@ -465,5 +480,17 @@ public class JeffChestSortPlugin extends JavaPlugin { PerPlayerSettings.remove(uniqueId.toString()); } } + + // Dumps all Materials into a csv file with their current category + void dump() throws IOException { + File file = new File(getDataFolder() + File.separator + "dump.csv"); + FileOutputStream fos = new FileOutputStream(file); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos)); + for(Material mat : Material.values()) { + bw.write(mat.name()+","+organizer.getCategoryLinePair(mat.name()).getCategoryName()); + bw.newLine(); + } + bw.close(); + } } diff --git a/src/main/resources/categories/909-food.default.txt b/src/main/resources/categories/909-food.default.txt index 85cdbea..de35c18 100644 --- a/src/main/resources/categories/909-food.default.txt +++ b/src/main/resources/categories/909-food.default.txt @@ -23,8 +23,10 @@ mushroom_stew porkchop cooked_porkchop cod +carrots salmon cooked_cod +sweet_berries cooked_salmon cake cookie diff --git a/src/main/resources/categories/910-valuables.default.txt b/src/main/resources/categories/910-valuables.default.txt index 862cfce..cda61a1 100644 --- a/src/main/resources/categories/910-valuables.default.txt +++ b/src/main/resources/categories/910-valuables.default.txt @@ -17,6 +17,7 @@ diamond emerald diamond_ore emerald_ore +emerald_block iron_ingot iron_ore gold_ingot @@ -26,11 +27,29 @@ diamond_block iron_block lapis_lazuli lapis_block +lapis_ore obsidian +nether_quartz_ore +nether_star beacon +prismarine_crystals conduit scute elytra +enchanted_golden_apple +enchanting_table +experience_bottle +firework_rocket +firework_star +glowstone* +name_tag +jukebox +golden_apple +ender_chest +end_crystal +end_gateway +end_portal_frame +end_rod ender_pearl ender_eye *_horse_armor @@ -39,4 +58,5 @@ heart_of_the_sea nautilus_shell gold_nugget iron_nugget +saddle enchanted_book \ No newline at end of file diff --git a/src/main/resources/categories/930-brewing.default.txt b/src/main/resources/categories/930-brewing.default.txt index 6154799..371e17b 100644 --- a/src/main/resources/categories/930-brewing.default.txt +++ b/src/main/resources/categories/930-brewing.default.txt @@ -16,10 +16,13 @@ sticky=false ghast_tear potion glass_bottle +blaze_rod fermented_spider_eye blaze_powder magma_cream brewing_stand +nether_wart +nether_wart_block cauldron glistering_melon_slice golden_carrot diff --git a/src/main/resources/categories/960-wood.default.txt b/src/main/resources/categories/960-wood.default.txt index 2dc5858..fced50d 100644 --- a/src/main/resources/categories/960-wood.default.txt +++ b/src/main/resources/categories/960-wood.default.txt @@ -14,10 +14,17 @@ sticky=false *_planks -*_sapling *_log *_wood *_leaves +*_sign +barrel +oak_sapling +spruce_sapling +birch_sapling +jungle_sapling +acacia_sapling +dark_oak_sapling acacia_slab birch_slab jungle_slab @@ -27,6 +34,12 @@ spruce_slab acacia_fence birch_fence jungle_fence +campfire +chest +composter +stick +ladder +crafting_table oak_fence dark_oak_fence spruce_fence diff --git a/src/main/resources/categories/970-stone.default.txt b/src/main/resources/categories/970-stone.default.txt index bd8a078..2c711c4 100644 --- a/src/main/resources/categories/970-stone.default.txt +++ b/src/main/resources/categories/970-stone.default.txt @@ -19,8 +19,24 @@ granite polished_granite diorite polished_diorite -andesite +andesite* +diorite* +granite* +end_stone* +brick +brick_wall +*sandstone +terracotta +mossy_stone_brick_wall +netherrack +nether_brick* +polished_andesite_* +polished_diorite_* +polished_granite_* +*_terracotta polished_andesite +stone_brick_wall +stone_stairs *stone_bricks stone_slab cobblestone_slab diff --git a/src/main/resources/categories/980-plants.default.txt b/src/main/resources/categories/980-plants.default.txt index 5a2f16f..5504181 100644 --- a/src/main/resources/categories/980-plants.default.txt +++ b/src/main/resources/categories/980-plants.default.txt @@ -14,6 +14,7 @@ sticky=false grass +bamboo fern dead_bush seagrass @@ -36,6 +37,23 @@ cactus vine lily_pad sunflower +beetroots +bone_meal +chorus_fruit +kelp +kelp_plant +lily_of_the_valley +popped_chorus_fruit +potatoes +potted_* +sweet_berry_bush +tall_seagrass +cocoa +cocoa_beans +dried_kelp_block +hay_block +flower_pot +cornflower lilac rose_bush peony diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b5ccc55..daf59e9 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ main: de.jeffclan.JeffChestSort.JeffChestSortPlugin name: ChestSort -version: 6.3 +version: 6.4-dev api-version: 1.13 description: Allows automatic chest sorting author: mfnalex From 4c02334913f28c32e5569652e60fa1a572647c66 Mon Sep 17 00:00:00 2001 From: mfnalex <1122571+mfnalex@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:25:26 +0200 Subject: [PATCH 2/2] update Todo for InventoryPages --- TODO.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TODO.md b/TODO.md index c9f052f..5cf4933 100644 --- a/TODO.md +++ b/TODO.md @@ -3,3 +3,6 @@ ## Change default categories ## Maybe dump option + +## Inventory pages support +Read from InventoryPages config which slots are used for the buttons, then ignore them in sorting when cycling through the slots and when gathering the inventory in the first place \ No newline at end of file